Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Role-Based Access Control (RBAC) database model [closed]

What is the best database schema to track role-based access controls for a web application?

I am using Rails, but the RBAC plugin linked by Google looks unmaintained (only 300 commits to SVN; latest was almost a year ago).

The concept is simple enough to implement from scratch, yet complex and important enough that it's worth getting right.

So how do others architect and implement their RBAC model?

like image 534
JasonSmith Avatar asked Oct 10 '08 05:10

JasonSmith


People also ask

Which is better RBAC or ABAC?

Essentially, ABAC has a much greater number of possible control variables than RBAC. ABAC is implemented to reduce risks due to unauthorized access, as it can control security and access on a more fine-grained basis.

What is RBAC access control model?

Role-based access control (RBAC) is a method of restricting network access based on the roles of individual users within an enterprise. RBAC ensures employees access only information they need to do their jobs and prevents them from accessing information that doesn't pertain to them.

What are the three primary rules for RBAC?

3 Primary Rules for RBAC:Role assignment: A user can exercise a permission only if the subject has been assigned a role. Role-based authorization: A user's active role must be authorized. With rule 1 above, this rule ensures that users can take on only roles for which they are authorized.


1 Answers

To my rather basic knowledge in that area, the basic actors of an RBAC are:

  • Resources.
  • Permissions.
  • Users.
  • Roles (i.e. Groups).

Resources <- require -> (one or many) Permissions.

Roles <- are collections of -> (one or many) Permissions.

Users <- can have -> (one or many) Roles.

The tables for such a model would be:

  • permission
  • role
  • user
  • role_permission
  • user_role

Now you might want to include resources here as well if you want users of your application to be able to configure which permissions a resource need. But I never needed that. Hope that helps.

like image 133
Amr Mostafa Avatar answered Sep 26 '22 00:09

Amr Mostafa