Hello! I am writing a derived role where I want to...
# community
r
Hello! I am writing a derived role where I want to store the parentRole (that the user is coming as) into a variable. This will help me simplify and templatize my conditional expressions. Is it currently supported in Cerbos CEL?
a
There is support for variables in a policy https://docs.cerbos.dev/cerbos/latest/policies/conditions.html#_policy_variables Does this do what you need?
r
Umm, the variable support in my use case is for derived roles actually 🙂 Looking for a similar construct like that in policy.
c
You can access the set of roles using
request.principal.roles
a
You can create variables in any type of file
r
Interesting, let me try it out, thanks
On the similar lines, like we define variables for fixed values, Can we define expressions into variables for re-usability? 😉
a