Skip to content

Feature/rbac auth#1446

Open
jeba57 wants to merge 2 commits into
salahlalami:masterfrom
jeba57:feature/rbac-auth
Open

Feature/rbac auth#1446
jeba57 wants to merge 2 commits into
salahlalami:masterfrom
jeba57:feature/rbac-auth

Conversation

@jeba57

@jeba57 jeba57 commented May 5, 2026

Copy link
Copy Markdown

Fixes #457

Description

This PR introduces role-based access control (RBAC) to the existing authentication system.

Previously, any logged-in user (ADMIN or STAFF) could access important actions like creating data.

Now, we have added a role check:

  • ADMIN → allowed to perform the action
  • STAFF → access is blocked

This ensures that only ADMIN users can perform sensitive operations.


Steps to Test

  1. Login using valid credentials to obtain JWT token

  2. Use the token in Postman (Authorization → Bearer Token)

  3. Test protected endpoint:

    POST /api/client/create

  4. Test with different roles:

    • Admin → Request succeeds
    • Staff → Access denied

Screenshots (if applicable)

  • Admin access (success response)
image
  • Staff access (access denied response)
image

Scope Note

This PR focuses on implementing role-based authorization (RBAC) using the existing authentication system.

User registration, login, and logout functionalities are already present in the project. Enhancements to those can be handled in a separate PR if needed.


Checklist

✔ I have tested these changes
✘ I have updated the relevant documentation (not done – this PR focuses on RBAC only)
✔ I have commented my code, particularly in hard-to-understand areas
✔ I have made corresponding changes to the codebase
✔ My changes generate no new warnings or errors
✔ The title of my pull request is clear and descriptive

@jeba57

jeba57 commented May 5, 2026

Copy link
Copy Markdown
Author

Hi, I have implemented RBAC so that admin users can access protected routes while staff users are restricted. Kindly review the changes. Thank you!

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.

User Authentication process

1 participant