-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Data LayerManaging state, data, fetch info from API callsManaging state, data, fetch info from API callsNew FeatureNew feature or requestNew feature or requestUI/UXRequires making UI changesRequires making UI changes
Description
Overview
There are various pages and functionality that are specific to certain roles, such as an admin. Additionally, this provides the groundwork for future functionality such as customizing a user's. Access to these resources need to be restricted and authorized based on the user's role.
Authorization will be handled with a roles based system where a collection, namely the authorization collection, will hold documents containing the associated UserId from the User's collection as well as the roles array.
Tasks
- Add authorization collection to db
- Write function get a user's roles from db. This might include adding an index into FaunaDB, writing a custom FQL function to get roles based on UserId
- Create auth wrapper component that authenticates users based on role
- Restrict access to admin routes to users with admin role
Supplemental Information
- The design decision to segregate roles into the authorization collection, instead of the user collection, is done in part to avoid modifying the default NextAuth schema. This avoids the need to write a custom database adapter.
- https://next-auth.js.org/adapters/models
Metadata
Metadata
Assignees
Labels
Data LayerManaging state, data, fetch info from API callsManaging state, data, fetch info from API callsNew FeatureNew feature or requestNew feature or requestUI/UXRequires making UI changesRequires making UI changes