seala va
06/15/2022, 3:22 AMDennis (Cerbos)
test
role.
- actions: ['view:public']
effect: EFFECT_ALLOW
derivedRoles:
- test
# add a condition if necessary
Dennis (Cerbos)
test
role instead of its parent role, spare you from repeating request.principal.attr.beta_tester == true
expressionseala va
06/15/2022, 3:31 AMDennis (Cerbos)
test
role in the request.Dennis (Cerbos)
seala va
06/15/2022, 3:39 AMDennis (Cerbos)
test
role in the request. Cerbos assumes it is a parent role and can’t find it.seala va
06/15/2022, 4:04 AMDennis (Cerbos)
Luca Carangella
06/15/2022, 9:13 AMAlex Olivier (Cerbos)
seala va
06/15/2022, 12:13 PMseala va
06/16/2022, 12:29 AMDennis (Cerbos)
test
role and attributes. Cerbos works in a different way: the request contains the parent roles (user
in your case), the attributes and the cerbos derive a new role “test”.Dennis (Cerbos)
Dennis (Cerbos)
seala va
06/16/2022, 8:03 AMDennis (Cerbos)
roles: ["member", "guest"]
. For editor `roles: ["editor", "member", "guest"]`` etc.Charith (Cerbos)
seala va
06/16/2022, 8:19 AMDennis (Cerbos)
Luca Carangella
06/16/2022, 8:22 AMseala va
06/16/2022, 8:25 AMLuca Carangella
06/16/2022, 8:34 AMThe most straightforward solution would be to have separate rules for all roles and then you’d pass inherited roles in the request, so for a member you would passI think this is were we somehow got confused as well and the name "derived role" didn't help either. I think there is a sort of inheritance but only at the 1st level. It does't go deeper than that. For instance, we have a case where we have internal and external users for our application. and external users can have 2 roles: "data provider" or "agency". Then we can make deal with different agencies which can have different permissions (an easy example is allowed or deny specific sections of the application or to do some sort of action on a resources). We were thinking of starting from external users, give some default permissions (common for both data provider and agency roles), then add more (or overriding if necessary) based on the different needs of data provider and agency. After that, the plan was to keep going. For example for agencies, we wanted to derived a further role from agency role, for example agencyA, and again, adding or overriding based on requirements. So on and so forth. INTERNAL USERS • DIRECTOR • SALES • etc. EXTERNAL USERS • AGENCY ◦ AGENCY A ◦ AGENCY B ◦ etc. • DATA PROVIDER ◦ DATA PROVIDER A ◦ DATA PROVIDER B ◦ etc.. For editor `roles: ["editor", "member", "guest"]`` etc.roles: ["member", "guest"]
Luca Carangella
06/16/2022, 8:34 AMLuca Carangella
06/16/2022, 8:35 AMLuca Carangella
06/16/2022, 8:47 AMseala va
06/17/2022, 1:31 AMCharith (Cerbos)
Luca Carangella
06/17/2022, 8:50 AMCharith (Cerbos)
seala va
06/17/2022, 9:42 AMseala va
06/17/2022, 10:15 AMAlex Olivier (Cerbos)
Alex Olivier (Cerbos)
seala va
06/17/2022, 10:39 AMguest
], but why it is opposite。
In the comments below is what I think it should be:Alex Olivier (Cerbos)
parentRoles
list, the user is given an extra role of the value name
.
In my example, the user will be given the guest
role if the IdP role is one of admin, editor, member, guest
Alex Olivier (Cerbos)
editor
the user would have derived roles of editor
, member
and guest
seala va
06/17/2022, 10:49 AMLuca Carangella
06/17/2022, 11:15 AMCharith (Cerbos)
Charith (Cerbos)
Resource-X/scope="" (all standard access rules for resource X)
|
|- Resource-X/scope="agency" (overrides for all agencies)
| |- Resource-X/scope="agency.agencyA" (overrides for agency A)
| |- Resource-X/scope="agency.agencyB" (overrides for agency B)
|
|- Resource-X/scope="data-provider" (overrides for all data providers)
|- Resource-X/scope="data-provider.data-provider-A" (overrides for data provider A)
Luca Carangella
06/20/2022, 10:46 AMMykola Belgovskyi
06/20/2022, 11:22 AMVariables and derived roles imports are not inherited between policies. Explicitly import any derived roles and re-define any variables in each policy that requires them.
As I understand scoped policies can't inherit main ones. This will require me to copy-paste all permission structure for new office even if I need to change few small things.Charith (Cerbos)
Charith (Cerbos)
Mykola Belgovskyi
06/20/2022, 12:03 PMThe Cerbos engine could process up to four policies to arrive at the final decision:
I thought this means that if you will use your scopes fully on each step (not just a.b.c.d.e
scope without having a.b
scope) means you can't practically go deeper than 4. Or were you mentioning only about current example?
If that is so it seems a good option to use this feature.Charith (Cerbos)