Skip to content
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

PIMS-1545: AgenciesController auth checks #2320

Merged
merged 5 commits into from
Apr 12, 2024
Merged

PIMS-1545: AgenciesController auth checks #2320

merged 5 commits into from
Apr 12, 2024

Conversation

LawrenceLau2020
Copy link
Collaborator

@LawrenceLau2020 LawrenceLau2020 commented Apr 11, 2024

🎯 Summary

PIMS-1545: - AgenciesController auth checks

Added a frontend authorization check to the agency management and the agency details pages and changed the route to a protected route.
You can test using a role of "General User" which shouldn't be able to access the Agency admin page: http://localhost:3000/admin/agencies and should be redirected to the homepage.
Only admin and auditor roles should be able to access it.
May need to confirm that auditors should be able to access these pages.

🔰 Checklist

  • I have read and agree with the following checklist and am following the guidelines in our Code of Conduct document.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation where required.
  • I have tested my changes to the best of my ability.
  • My changes generate no new warnings.

Copy link

🚀 Deployment Information

The Express API Image has been built with the tag: 2320. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the API deployment. For more updates please monitor Image Tags Page on Wiki.

Copy link

codeclimate bot commented Apr 11, 2024

Code Climate has analyzed commit df19522 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 94.8%.

View more on Code Climate.

Copy link

🚀 Deployment Information

The React APP Image has been built with the tag: 2320. Please make sure to utilize this specific tag when promoting these changes to the TEST and PROD environments during the APP deployment. For more updates please monitor Image Tags Page on Wiki.

Copy link
Collaborator

@dbarkowsky dbarkowsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me.
In the future, let's see if we could extract this check into a single function. Then it could be used in many places without duplicate code.

@GrahamS-Quartech
Copy link
Contributor

This is acceptable if we only need this for agencies pages right now but this is really something that should be implemented in the AuthRouteGuard or some similar wrapper component.

@LawrenceLau2020 LawrenceLau2020 merged commit bfbfb5e into main Apr 12, 2024
9 checks passed
@LawrenceLau2020 LawrenceLau2020 deleted the PIMS-1545 branch April 12, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants