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

feat: implement getRoleId method to enhance role-based access control #540

Merged
merged 2 commits into from
Aug 24, 2024

Conversation

yungstarry
Copy link
Contributor

@yungstarry yungstarry commented Aug 23, 2024

Description:

This pull request introduces the getRoleId method to the application. The method is designed to retrieve the ID and details of a specific role within an organization, ensuring that only authorized users can access this information. It adds an essential layer of security by verifying both the existence of the role within the specified organization and the user's permission to access the role.

Related Issue:

hngprojects/hng_boilerplate_nextjs#1445

Motivation and Context:

This change is required to enhance the security and flexibility of the application's role-based access control. By implementing this method, the system can now enforce more granular permissions, ensuring that roles are only accessible to users with the appropriate organizational context.

How Has This Been Tested?

The getRoleId method has been rigorously tested through:

  • Unit Tests: Validating the correct behavior when roles exist or do not exist within the specified organization.
    Screenshot (159)

  • Permission Tests: Ensuring that users without the necessary organizational association are denied access.

  • Integration Tests: Checking the integration of this method with existing systems, confirming that it correctly returns role information or appropriate error messages.

  • Manual Testing: Performed in a development environment to simulate real-world scenarios and edge cases.
    Screenshot (159)

Screenshots (if appropriate - Postman, etc):

Screenshot (160)

Types of changes:

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Dev-Tonia Dev-Tonia merged commit 46379cb into hngprojects:dev Aug 24, 2024
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