Skip to content

Commit

Permalink
Fixed small user changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlistairMRoss committed Oct 20, 2023
1 parent d731e9a commit ba34388
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ public ResponseEntity<String> makeAR(AccessRequestRequest request, User authenti
public List<AccessRequest> getAllAccessRequests() {
List<AccessRequest> ar = accessRequestRepository.findAll();
for(AccessRequest accessRequest : ar){
accessRequest.getUser_id().setFirst_name(encryptionService.decryptString(accessRequest.getUser_id().getFirst_name()));
accessRequest.getUser_id().setLast_name(encryptionService.decryptString(accessRequest.getUser_id().getLast_name()));
User currentAssignee = accessRequest.getUser_id();
User decryptedCurrentAssignee = new User();
decryptedCurrentAssignee.setUser_id(currentAssignee.getUser_id());
decryptedCurrentAssignee.setFirst_name(encryptionService.decryptString(currentAssignee.getFirst_name()));
decryptedCurrentAssignee.setLast_name(encryptionService.decryptString(currentAssignee.getLast_name()));
decryptedCurrentAssignee.setRole(currentAssignee.getRole());
accessRequest.setUser_id(currentAssignee);
}
return ar;
}
Expand Down Expand Up @@ -82,7 +87,7 @@ public ResponseEntity<String> reviewAccessRequest(ReviewRequest reviewRequest) {
}
} else {
deleteService.deleteAccessRequestAndSaveToSecondary(reviewRequest.getRequest_id());
emailUser(reviewRequest.getUser_email(), "", "Denied");
emailUser(encryptionService.decryptString(reviewRequest.getUser_email()), "", "Denied");
String message = "rejected access";
return ResponseEntity.ok(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ public ResponseEntity<String> makeAR(AssetRequestRequest request, User authentic
public List<AssetRequests> getAllAssetRequests() {
List<AssetRequests> ar = assetRequestRepository.findAll();
for (AssetRequests assetRequests : ar) {
assetRequests.getUser().setFirst_name(encryptionService.decryptString(assetRequests.getUser().getFirst_name()));
assetRequests.getUser().setLast_name(encryptionService.decryptString(assetRequests.getUser().getLast_name()));
User currentAssignee = assetRequests.getUser();
User decryptedCurrentAssignee = new User();
decryptedCurrentAssignee.setUser_id(currentAssignee.getUser_id());
decryptedCurrentAssignee.setFirst_name(encryptionService.decryptString(currentAssignee.getFirst_name()));
decryptedCurrentAssignee.setLast_name(encryptionService.decryptString(currentAssignee.getLast_name()));
decryptedCurrentAssignee.setRole(currentAssignee.getRole());
assetRequests.setUser(currentAssignee);
}
return ar;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ public ResponseEntity<String> makeSR(SupportRequestRequest request, User authent
public List<SupportRequest> getAllSupportRequests() {
List<SupportRequest> sr = supportRequestRepository.findAll();
for(SupportRequest supportRequest : sr){
supportRequest.getUser_id().setFirst_name(encryptionService.decryptString(supportRequest.getUser_id().getFirst_name()));
supportRequest.getUser_id().setLast_name(encryptionService.decryptString(supportRequest.getUser_id().getLast_name()));
User currentAssignee = supportRequest.getUser_id();
User decryptedCurrentAssignee = new User();
decryptedCurrentAssignee.setUser_id(currentAssignee.getUser_id());
decryptedCurrentAssignee.setFirst_name(encryptionService.decryptString(currentAssignee.getFirst_name()));
decryptedCurrentAssignee.setLast_name(encryptionService.decryptString(currentAssignee.getLast_name()));
decryptedCurrentAssignee.setRole(currentAssignee.getRole());
supportRequest.setUser_id(currentAssignee);
}
return sr;
}
Expand Down Expand Up @@ -107,8 +112,13 @@ public SupportRequest updateSupportRequest(SupportRequestRequest supportRequest)
public List<SupportRequest> getUserSupportRequests(int user_id) {
List<SupportRequest> sr = supportRequestRepository.findAllByUserId(user_id);
for(SupportRequest supportRequest : sr){
supportRequest.getUser_id().setFirst_name(encryptionService.decryptString(supportRequest.getUser_id().getFirst_name()));
supportRequest.getUser_id().setLast_name(encryptionService.decryptString(supportRequest.getUser_id().getLast_name()));
User currentAssignee = supportRequest.getUser_id();
User decryptedCurrentAssignee = new User();
decryptedCurrentAssignee.setUser_id(currentAssignee.getUser_id());
decryptedCurrentAssignee.setFirst_name(encryptionService.decryptString(currentAssignee.getFirst_name()));
decryptedCurrentAssignee.setLast_name(encryptionService.decryptString(currentAssignee.getLast_name()));
decryptedCurrentAssignee.setRole(currentAssignee.getRole());
supportRequest.setUser_id(currentAssignee);
}
return sr;
}
Expand Down

0 comments on commit ba34388

Please sign in to comment.