use of com.odysseusinc.arachne.portal.model.security.ArachneUser in project ArachneCentralAPI by OHDSI.
the class TokenUtils method validateToken.
public Boolean validateToken(String token, UserDetails userDetails) {
String uuid = getUUIDFromToken(token);
boolean result = false;
if (!invalidatedTokens.containsKey(uuid)) {
ArachneUser user = (ArachneUser) userDetails;
final String username = getUsernameFromToken(token);
final Date created = getCreatedDateFromToken(token);
result = (username.equals(user.getUsername()) && !(isTokenExpired(token)) && !(isCreatedBeforeLastPasswordReset(created, user.getLastPasswordReset())));
}
return result;
}
use of com.odysseusinc.arachne.portal.model.security.ArachneUser in project ArachneCentralAPI by OHDSI.
the class DataNodeToDataNodeDTOConverter method convert.
@Override
public DataNodeDTO convert(DataNode dataNode) {
final DataNodeDTO dataNodeDTO = new DataNodeDTO();
dataNodeDTO.setId(dataNode.getId());
dataNodeDTO.setName(dataNode.getName());
dataNodeDTO.setDescription(dataNode.getDescription());
dataNodeDTO.setVirtual(dataNode.getVirtual());
dataNodeDTO.setPublished(dataNode.getPublished());
dataNodeDTO.setAtlasVerion(dataNode.getAtlasVersion());
CommonHealthStatus healthStatus = dataNode.getHealthStatus();
dataNodeDTO.setHealthStatus(healthStatus);
dataNodeDTO.setHealthStatusTitle(healthStatus.toString());
final Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
final Long loggedUserId = ((ArachneUser) principal).getId();
final User loggedUser = new User();
loggedUser.setId(loggedUserId);
dataNodeDTO.setCurrentUserDataOwner(DataNodeUtils.isDataNodeOwner(dataNode, loggedUser));
return dataNodeDTO;
}
use of com.odysseusinc.arachne.portal.model.security.ArachneUser in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionToSubmissionDTOConverter method convert.
@Override
public DTO convert(T source) {
DTO dto = super.convert(source);
dto.setInsight(insightDTO(source.getSubmissionInsight()));
final Status status = statusConverter(source.getStatus());
final Boolean execConfirmed = status.isExecConfirmed();
dto.setIsExecConfirmed(execConfirmed);
final Boolean resultConfirmed = status.isResultConfirmed();
dto.setIsResultConfirmed(resultConfirmed);
dto.setAction(source.getStatus().toString());
IDataSource dataSource = source.getDataSource();
Long loggedUserId = ((ArachneUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
final boolean isOwner = DataNodeUtils.isDataNodeOwner(dataSource.getDataNode(), loggedUserId);
dto.setIsOwner(isOwner);
return dto;
}
Aggregations