Closed rotated8 closed 2 years ago
To implement role management, we should consider the following three options:
CanCanCan
gemThe most popular option among all options I found, the CanCanCan
gem simplifies role management by having one Ability
class where all roles are defined, and having all controllers use the permissions defined in that class. The gem is also used by Samvera for role management.
Pundit
gemAnother popular gem for implementing role management is Pundit
, which relies on creating separate policy classes for each resource.
This option will require us designing and implementing role management logic from scratch, which could be very useful if we have very specific criteria that we should account for when adding role management.
I personally recommend using the CanCanCan
gem, given how widely used it is in the Rails ecosystem, and how well documented it is. As for the criteria below:
I believe all options satisfy those criteria, the CanCanCan
gem will allow us to satisfy those criteria and implement role management much faster.
One thing worth mentioning is none of the options above include any UI for role management. The options above are strictly used to define roles and their permissions within the app. For anything UI related e.g. UI to assign users to a given role, or organize users into role groups, I recommend a separate research ticket that will focus on what UI libraries are available.
@rotated8 @eporter23 @lovinscari let me know if you have any questions!
@rotated8 - This all looks good to me based on our earlier conversation. Please close this ticket once you have reviewed. Thanks!
@rotated8 - can you please look at this?
@rotated8 - Please review and close this ticket once you have reviewed and determined any next steps.
@lovinscari @rotated8 I am adding CanCanCan
to the application for role management. Please refer to #1275. I will close this ticket, please let me know if you have any other questions!
Take a day to research and recommend an approach for user role management.
The recommendation should take into account
The recommendation will be used to implement role-based authorization for admins, allowing them to see an admin dashboard and access admin-only features.