-
Notifications
You must be signed in to change notification settings - Fork 5
Gt1050 #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Gt1050 #192
Conversation
* Add test cases for controllers * Update maven.yml with SUPPORTED_PKCS10_MIN_MODULUS * Update maven.yml * Update maven.yml * Add application.properties to run test * Fix test * Remove unused import * Revert the user CN change
Sae126V
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code flow is looking good to me. Just a few things mostly Q&A and minor fixes.
| * @throws java.io.IOException | ||
| */ | ||
| @RequestMapping(value = "/changeroletouser", method = RequestMethod.POST) | ||
| public String changeRoleCertificate(@RequestParam long cert_key, RedirectAttributes redirectAttrs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add @Transactional here to allow rollbacks if any errors occur ? - What I mean is I think we should add @Transactional for a method where it is making the DB calls. I will leave it in your fine hands to decide that, Manoj .
| return false; | ||
| } | ||
|
|
||
| // Compare DN attributes (OU and L) between current user and target certificate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the Organization(O) comparison as well. I might be wrong, here.
| */ | ||
| @Secured("ROLE_CAOP") | ||
| @RequestMapping(value = "/approverolechange", method = RequestMethod.POST) | ||
| public String approverolechange(@RequestParam long certKey, @RequestParam Integer requestId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous, @Transactional perhaps because we are making a commits to the DB ?
| */ | ||
| @Secured("ROLE_CAOP") | ||
| @RequestMapping(value = "/rejectrolechange", method = RequestMethod.POST) | ||
| public String rejectrolechange(@RequestParam long certKey, @RequestParam Integer requestId, RedirectAttributes redirectAttrs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional perhaps because we are making a commits to the DB ?
| * | ||
| * @param dataSource | ||
| */ | ||
| @Autowired |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to remove the unused imports here. I think same goes for other *Dao.java files as well.
| @@ -0,0 +1,17 @@ | |||
| package uk.ac.ngs.dao; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add copyright ?
| @@ -0,0 +1,77 @@ | |||
| package uk.ac.ngs.domain; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add copyright here ? Also, In *Tests.java files there few places we might need to add.
| String targetCertOU = CertUtil.extractDnAttribute(targetCert.getDn(), CertUtil.DNAttributeType.OU); | ||
| String targetCertL = CertUtil.extractDnAttribute(targetCert.getDn(), CertUtil.DNAttributeType.L); | ||
|
|
||
| return currentUserOU.equals(targetCertOU) && currentUserL.equals(targetCertL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am leaving up to you, Manoj. Should we add null-safe comparison here ?
| CertificateRow requestedBy = roleChangeRequestRepository.findById(requestId) | ||
| .map(RoleChangeRequest::getRequestedBy) | ||
| .map(jdbcCertDao::findById) | ||
| .orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since requestedBy can be null. I think we should add a null check before getting the data when the methods like sendEmailNotificationOnApproval, sendEmailNotificationOnRejection and other places where the method receives the variable
|
|
||
| if (canViewerManageRaopRole(targetCert)) { | ||
| String newRole = "RA Operator"; | ||
| certificateService.raiseRoleChangeRequest(cert_key, targetCert, newRole, currentUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flow finally saves the Data to the DB. May be we need to add @Transaction ?
Role assignment interface for RA Operators
Notification system for role changes request and approval
Page for request approval for CA Admins
Database update upon approval
Role downgrade functionality for RA Operators
Page for RAOP

Page for CAOP
