https://github.com/omjogani/access-control-routing-nextjs
Access Control routing with nextjs (Guard Approach)
https://github.com/omjogani/access-control-routing-nextjs
Last synced: 7 months ago
JSON representation
Access Control routing with nextjs (Guard Approach)
- Host: GitHub
- URL: https://github.com/omjogani/access-control-routing-nextjs
- Owner: omjogani
- Created: 2024-09-16T12:40:26.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-16T12:56:34.000Z (about 1 year ago)
- Last Synced: 2025-01-22T20:31:23.694Z (9 months ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multi Role Routing (Guard Approach)
Naive demonstration of Multi-Role Routing in NextJs with Guard Approach.
### General Architecture
### Output
This example demonstrates a role-based access control system with four distinct user roles:
1. Admin
2. Care-Provider
3. Client (Referred)
4. Client (Not Referred)The system includes a table that defines which routes (pages) are accessible to each user role. Users can switch between different roles and navigate to various pages to see how permissions change based on their current role.
The access control is implemented using an AuthorizationGuard component. This guard is wrapped around the layout file and serves as the decision-making mechanism. It determines whether a particular role should be allowed access to a specific page or not.