I have the following database design for Users
, Roles
& Permissions
:
Users
* ---- * Roles
Roles
* ---- * Permissions
A user may have many roles. A role has many permissions. There is a downside though: What if I want to give a particular special user some specific permission that is not in that user's existing roles?
Imagine I have role "Manager". John Doe is a manager. I want to give John a permission "See Activity". "See Activity" is in the "Observer" role but not in "Manager". Although I want to let John "See Activity" I don't want to give him the "Observer" role, as it has other permissions too.
One way to solve it would be to have roles corresponding to each permission together with existing roles. And whenever John needs permission "See Activity", I will grant him role "See Activity Role" which contains only one permission.
What are other designs?