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

B Cerkezi

08/16/2022, 4:45 PM
Hey 👋 , I have been evaluating the tool today - looks really cool! One basic question: when using the principal attributes as a condition expression I can't get the "in" operator to work? here is the code:
Copy code
---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
  resource: album
  version: default
  rules:
    - actions: ['view']
      effect: EFFECT_ALLOW
      roles:
        - editor
      condition:
        match:
          expr: 'test' in request.principal.attr.products
and response
failed to convert YAML to JSON: yaml: line 12: did not find expected key
a

Alex Olivier (Cerbos)

08/16/2022, 4:50 PM
Hey, There is an issue with using
'
at the start of an expression - you can break out onto a new line as follows which works
Copy code
---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
  resource: album
  version: default
  rules:
    - actions: ['view']
      effect: EFFECT_ALLOW
      roles:
        - editor
      condition:
        match:
          expr: >
            'test' in request.principal.attr.products
b

B Cerkezi

08/16/2022, 4:52 PM
ah great - thanks for the quick response
9 Views