Skip to content

Conversation

@garaimanoj
Copy link
Contributor

@garaimanoj garaimanoj commented Sep 23, 2025

  • 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
image

Page for CAOP
image

@garaimanoj garaimanoj self-assigned this Oct 21, 2025
@garaimanoj garaimanoj requested a review from jnc74743 October 21, 2025 13:48
@garaimanoj garaimanoj marked this pull request as ready for review October 21, 2025 13:48
@garaimanoj garaimanoj requested a review from Sae126V November 12, 2025 14:00
* 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
Copy link

@Sae126V Sae126V left a 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)
Copy link

@Sae126V Sae126V Dec 10, 2025

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
Copy link

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,
Copy link

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)
Copy link

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
Copy link

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;
Copy link

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;
Copy link

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);
Copy link

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);
Copy link

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);
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants