Yong Cheng Toh
01/25/2022, 3:09 AMBUSINESS
principal, which has 2 other principals nested under it: API_KEY
and USER
.
• How can I use Cerbos to map the constraints such that:
◦ A USER
will be constrained by it’s BUSINESS
’s policies? For example:
▪︎ The BUSINESS
is banned from accessing Product A
▪︎ The USER
that belongs to this BUSINESS
should also be banned from accessing Product ADennis (Cerbos)
USER
belongs to BUSINESS
? Is the latter a group of users?Charith (Cerbos)
BUSINESS
is the "group". We have support for modelling such tree-like relationships using hierarchy functions: https://docs.cerbos.dev/cerbos/latest/policies/conditions.html#hierarchiesCharith (Cerbos)
Alex Olivier (Cerbos)
Yong Cheng Toh
01/25/2022, 9:38 AMCan you please elaborate what you mean by saying that aYes, I’m trying to model something like a group membership scenario, wherebelongs toUSER
? Is the latter a group of users?BUSINESS
BUSINESS
is the group here, with the USERS
as members.
You can write your policy rules to inspect the hierarchy that the principal belongs to (which should be sent as an attribute in the request) and model your rules that way.I see! So that means i’ll need to keep passing in those attributes every time we evaluate the rules and policies?
Here is an example that has the concept of organisations which the principal belongs to and defines their access to resources. It is modeled after a finance application https://play.cerbos.dev/p/hTScZq617bc385f0m9LhKf5JpYmxTOm6Thanks I’ll take a look at this.
Yong Cheng Toh
01/25/2022, 9:44 AMUser
is in a Group
.
Group
has generic Read/Write permissions to Resource A
, and how Users
within that Group
can again have a second level of Read/Write permissions to Resource A
.Charith (Cerbos)
Yong Cheng Toh
01/25/2022, 9:51 AMSo individual users have specific permissions that the group does not?yep, so if I am the
Group
Admin
, I can change the access of my own Users
to Resource A
.Charith (Cerbos)
Alex Olivier (Cerbos)