use of org.pmiops.workbench.annotations.AuthorityRequired in project workbench by all-of-us.
the class ProfileController method reviewIdVerification.
@Override
@AuthorityRequired({ Authority.REVIEW_ID_VERIFICATION })
public ResponseEntity<IdVerificationListResponse> reviewIdVerification(Long userId, IdVerificationReviewRequest review) {
BlockscoreIdVerificationStatus status = review.getNewStatus();
Boolean oldVerification = userDao.findUserByUserId(userId).getBlockscoreVerificationIsValid();
String newValue;
if (status == BlockscoreIdVerificationStatus.VERIFIED) {
userService.setIdVerificationApproved(userId, true);
newValue = "true";
} else {
userService.setIdVerificationApproved(userId, false);
newValue = "false";
}
userService.logAdminUserAction(userId, "manual ID verification", oldVerification, newValue);
return getIdVerificationsForReview();
}
use of org.pmiops.workbench.annotations.AuthorityRequired in project workbench by all-of-us.
the class ProfileController method getIdVerificationsForReview.
@Override
@AuthorityRequired({ Authority.REVIEW_ID_VERIFICATION })
public ResponseEntity<IdVerificationListResponse> getIdVerificationsForReview() {
IdVerificationListResponse response = new IdVerificationListResponse();
List<Profile> responseList = new ArrayList<Profile>();
try {
for (User user : userService.getNonVerifiedUsers()) {
responseList.add(profileService.getProfile(user));
}
} catch (ApiException e) {
log.log(Level.INFO, "Error calling FireCloud", e);
return ResponseEntity.status(e.getCode()).build();
}
response.setProfileList(responseList);
return ResponseEntity.ok(response);
}
use of org.pmiops.workbench.annotations.AuthorityRequired in project workbench by all-of-us.
the class WorkspacesController method getWorkspacesForReview.
// Note we do not paginate the workspaces list, since we expect few workspaces
// to require review.
//
// We can add pagination in the DAO by returning Slice<Workspace> if we want the method to return
// pagination information (e.g. are there more workspaces to get), and Page<Workspace> if we
// want the method to return both pagination information and a total count.
@Override
@AuthorityRequired({ Authority.REVIEW_RESEARCH_PURPOSE })
public ResponseEntity<WorkspaceListResponse> getWorkspacesForReview() {
WorkspaceListResponse response = new WorkspaceListResponse();
List<org.pmiops.workbench.db.model.Workspace> workspaces = workspaceService.findForReview();
response.setItems(workspaces.stream().map(TO_CLIENT_WORKSPACE).collect(Collectors.toList()));
return ResponseEntity.ok(response);
}
use of org.pmiops.workbench.annotations.AuthorityRequired in project workbench by all-of-us.
the class WorkspacesController method reviewWorkspace.
/**
* Record approval or rejection of research purpose.
*/
@Override
@AuthorityRequired({ Authority.REVIEW_RESEARCH_PURPOSE })
public ResponseEntity<EmptyResponse> reviewWorkspace(String ns, String id, ResearchPurposeReviewRequest review) {
org.pmiops.workbench.db.model.Workspace workspace = workspaceService.get(ns, id);
userService.logAdminWorkspaceAction(workspace.getWorkspaceId(), "research purpose approval", workspace.getApproved(), review.getApproved());
workspaceService.setResearchPurposeApproved(ns, id, review.getApproved());
return ResponseEntity.ok(new EmptyResponse());
}
use of org.pmiops.workbench.annotations.AuthorityRequired in project workbench by all-of-us.
the class AuthDomainController method addUserToAuthDomain.
@Override
@AuthorityRequired({ Authority.MANAGE_GROUP })
public ResponseEntity<Void> addUserToAuthDomain(String groupName, AuthDomainRequest request) {
User user = userDao.findUserByEmail(request.getEmail());
DataAccessLevel previousAccess = user.getDataAccessLevel();
try {
fireCloudService.addUserToGroup(request.getEmail(), groupName);
} catch (ApiException e) {
ExceptionUtils.convertFirecloudException(e);
}
// TODO(blrubenstein): Parameterize this.
user.setDataAccessLevel(DataAccessLevel.REGISTERED);
user.setDisabled(false);
userDao.save(user);
userService.logAdminUserAction(user.getUserId(), "user access to " + groupName + " domain", previousAccess, DataAccessLevel.REGISTERED);
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}
Aggregations