Inheriting roles from other resources
Using the relations
feature
If two resources have a hierarchical relationship (e.g. parent-child), users commonly inherit roles or permissions on the subordinate resource from their role on the superior resource.
In this case, users often rely on Polar's relations
feature, which often
expresses the relationship between the resources in the subordinate resource's
definition.
A common example of this is files and folders; granting access to a folder typically grants access to the folder's contents.
In this example, anyone with a role on a folder also has the same role on any file/folder it contains.
Oso Policy
Using longhand rules
If two types of resources have any kind of relationship (hierarchical or otherwise), you can inherit roles on one resource from the other. For example, in a parent-child relationship, users can inherit roles from the child on the parent.
This essentially uses the same convention as the relations
feature (relying on
has_relation
facts in your authorization data), but requires writing out the
rule in longhand.
Oso Policy