r

    Rounak Datta

    1 month ago
    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?
    Alex Olivier (Cerbos)

    Alex Olivier (Cerbos)

    1 month ago
    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

    Rounak Datta

    1 month ago
    Umm, the variable support in my use case is for derived roles actually 🙂 Looking for a similar construct like that in policy.
    Charith (Cerbos)

    Charith (Cerbos)

    1 month ago
    You can access the set of roles using
    request.principal.roles
    Alex Olivier (Cerbos)

    Alex Olivier (Cerbos)

    1 month ago
    You can create variables in any type of file
    r

    Rounak Datta

    1 month ago
    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? 😉
    Alex Olivier (Cerbos)

    Alex Olivier (Cerbos)

    1 month ago