Modeling Authorization Layer, Object Types, and Role-Based Permissions in Warrant #176
-
Hey Team, I am in the process of modeling an authorization layer for our application and I find myself in need of your advice. My main objectives are effectively managing permissions for specific roles and users, accurately modeling "object types", and ensuring that permissions are assigned to roles per object in Warrant. To paint a clearer picture: We have an object (such as an article) that is associated with a user carrying a specific role, for instance, an "Owner". We also have other users with roles like "Readers" and "Editors", each possessing distinct set of permissions. Furthermore, it's essential to mention that a user does not have a global role, but rather, a role associated with each object. Besides this, users may have individual permissions, such as create, edit, update, or delete. My aim is to establish a mechanism whereby I could query the Warrant API to verify if a certain user (identified by their userID) is authorized to perform a specific operation (like 'create') on a particular object (identified by the object type and object id). Importantly, these permissions should be associated with the role per object in Warrant, not globally. In addition, I'm seeking guidance on how to model "object types". What are the best practices for designing and structuring these object types in our particular context? I would highly appreciate your guidance on structuring this request to the Warrant API using only the userID, object type, object id, and the operation the user seeks to perform. Furthermore, any insights or recommendations for modeling object types and effectively assigning permissions to roles per object in Warrant would be tremendously beneficial. Looking forward to your invaluable insights and suggestions. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @vstepanyuk, Thanks for the detailed description. If I were to summarize, I believe what you're looking for is a hybrid of fine-grained (object-level) and RBAC (role-based) access control. First, looking at your example, here's how I'd express a basic 'article' object-type within Warrant:
This representation defines an 'article' type with 'owner', 'editor' and 'reader' relations (or roles). The With this object-type defined, you can create warrants such as:
Which would yield the following checks:
If your checks only take user/subject, relation (role) and object into account, this object type should be enough to build out full fine-grained authz. However, it seems like you're also implying that your use-case references an additional layer of abstraction (permissions/operations) like 'create', 'update', 'edit' and 'delete'? Is it only these 4 permissions or are there more/a variable amount? Regardless, you can add these 'operations'/'permissions' directly within the 'article' object-type as well:
Now, with this updated object-type definition and using just the 2 warrants described above (user:1 owner of article:x, user:3 reader of article:x), you'd be able to issue the following checks as well:
Let me know if this makes sense for your use cases. |
Beta Was this translation helpful? Give feedback.
Hey @vstepanyuk,
Thanks for the detailed description. If I were to summarize, I believe what you're looking for is a hybrid of fine-grained (object-level) and RBAC (role-based) access control.
First, looking at your example, here's how I'd express a basic 'article' object-type within Warrant:
This representation defines an 'article' type with 'owner', 'editor' and 'reader' relations (or roles). The
inheritIf
attribute allows us to specify that any subject (user) having an 'editor' relation to an 'article' also has the 'reader' relation and any subject (u…