[Feature Request] Role based authorization
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
# 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
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。