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

[Feature Request] Role based authorization #66

Open
4 tasks
stevenmqnguyen opened this issue Jan 22, 2022 · 0 comments
Open
4 tasks

[Feature Request] Role based authorization #66

stevenmqnguyen opened this issue Jan 22, 2022 · 0 comments
Assignees
Labels
Data Layer Managing state, data, fetch info from API calls New Feature New feature or request UI/UX Requires making UI changes

Comments

@stevenmqnguyen
Copy link
Member

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
@stevenmqnguyen stevenmqnguyen added New Feature New feature or request Data Layer Managing state, data, fetch info from API calls UI/UX Requires making UI changes labels Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Data Layer Managing state, data, fetch info from API calls New Feature New feature or request UI/UX Requires making UI changes
Projects
None yet
Development

No branches or pull requests

2 participants