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

Implement Role-Based Access Control #114

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

ambroisegithub
Copy link
Collaborator

@ambroisegithub ambroisegithub commented Jul 22, 2024

This PR adds role-based access control (RBAC) to the frontend of the project, allowing for fine-grained access management based on user roles.

Tasks Completed:

  • Defined roles and permissions for vendors, buyers, and admins.
  • Integrated an API endpoint for managing roles and permissions.
  • Enforced role-based access control throughout the frontend application.
  • Implemented appropriate error handling and user feedback for access control issues.
  • Added comprehensive unit tests for the RBAC implementation.

How to Test:

  • Clone the repository and set up the development environment.
  • Perform CRUD operations on roles by interacting with the /api/v1/roles route via the frontend interface.
  • Test the checkRole and checkPermissions middleware by accessing routes that require specific roles and permissions.
  • Verify that users with different roles see the appropriate UI elements and have access to the correct features.

Context:

  • There are three roles: Vendor, Buyer, and Admin.

Vendor Permissions:

  • Manage Products
  • Fulfill Orders
  • View Sales Reports
  • Manage Inventory
  • Manage Account

Buyer Permissions:

  • Browse Products
  • Add to Cart
  • Check Out
  • Order History
  • Track Orders
  • Manage Account
  • Leave Reviews
  • View Wishlist
  • Receive Notifications

Admin Permissions:

  • Manage Users
  • Manage Roles
  • Manage Products
  • Manage Orders
  • Manage Categories
  • Manage Shipping
  • Manage Payments

Copy link

netlify bot commented Jul 22, 2024

Deploy Preview for dynamite-frontend ready!

Name Link
🔨 Latest commit 8a137c4
🔍 Latest deploy log https://app.netlify.com/sites/dynamite-frontend/deploys/66a21ce964da98000881cca7
😎 Deploy Preview https://deploy-preview-114--dynamite-frontend.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ambroisegithub ambroisegithub linked an issue Jul 22, 2024 that may be closed by this pull request
@ambroisegithub ambroisegithub force-pushed the ft-admin-manage-user-role-#104 branch 9 times, most recently from 9ad7c99 to 613ba38 Compare July 24, 2024 19:14
@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 71.14625% with 146 lines in your changes missing coverage. Please review.

Project coverage is 75.65%. Comparing base (5104bd9) to head (8a137c4).

Files Patch % Lines
src/components/dashBoard/UserRole.tsx 63.30% 131 Missing ⚠️
src/features/userRole/userRoleSlice.tsx 88.63% 15 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #114      +/-   ##
===========================================
- Coverage    75.85%   75.65%   -0.21%     
===========================================
  Files          106      108       +2     
  Lines        11876    12382     +506     
  Branches       741      787      +46     
===========================================
+ Hits          9008     9367     +359     
- Misses        2866     3013     +147     
  Partials         2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dushimeemma dushimeemma added ready for review The PR is ready for review to be mergrd and removed WIP labels Jul 25, 2024
@ambroisegithub
Copy link
Collaborator Author

ambroisegithub commented Jul 25, 2024

Screenshot from 2024-07-25 10-37-07
Screenshot from 2024-07-25 10-37-56

@ambroisegithub
Copy link
Collaborator Author

ambroisegithub commented Jul 25, 2024

Screenshot from 2024-07-25 11-02-32
Screenshot from 2024-07-25 11-03-29

@ambroisegithub
Copy link
Collaborator Author

ambroisegithub commented Jul 25, 2024

Screenshot from 2024-07-25 11-22-17
Screenshot from 2024-07-25 11-03-29

@ambroisegithub
Copy link
Collaborator Author

ambroisegithub commented Jul 25, 2024

Screenshot from 2024-07-25 11-13-42

Screenshot from 2024-07-25 11-12-15

[Delivers #101]
Co-authored-by: AMBROISE Muhayimana <107347030+ambroisegithub@users.noreply.github.com>
@dushimeemma dushimeemma merged commit fbb40eb into develop Jul 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Front-End ready for review The PR is ready for review to be mergrd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement User Role Functionalities
7 participants