https://cerbos.dev logo
#help
Title
# help
d

Dung Truong

08/24/2023, 9:52 PM
Hi, is it possible to return
arbitrary object
instead of just
EFFECT_ALLOW/DENY
The use case of mine is, i want to return list of
fields
user could access based on
action
.
d

Dennis (Cerbos)

08/24/2023, 10:42 PM
Yes, with the help of output expressions:
Copy code
rules:
    - actions: ['view']
      effect: EFFECT_ALLOW
      roles:
        - user 
      condition:
        match:
          expr: request.resource.attr.public == true
      output: 
        expr: |-
          "view_allowed:%s".format([request.principal.id])
d

Dung Truong

08/24/2023, 11:01 PM
Thanks @Dennis (Cerbos)
2 Views