This documentation is for a previous version of Cerbos. Choose 0.34.0 from the version picker at the top right or navigate to for the latest version.

Principal policies

Principal policies define overrides for a specific user.

apiVersion: ""
  principal: daffy_duck (1)
  version: "dev" (2)
  scope: "acme.corp" (3)
    import: (4)
      - apatr_common_variables
    local: (5)
      is_dev_record: request.resource.attr.dev_record == true
    - resource: leave_request (6)
        - name: dev_record_wildcard (7)
          action: "*" (8)
          condition: (9)
              expr: variables.is_dev_record
          effect: EFFECT_ALLOW
          output: (10)
            expr: |-
    - resource: employee_profile
        - name: view_employee_profile
          action: "*"
                  - expr: V.is_dev_record
                  - expr: request.resource.attr.public == true
          effect: EFFECT_ALLOW
    - resource: salary_record
        - action: "*"
          effect: EFFECT_DENY
1 Principal to whom this policy applies.
2 Version of this policy. Policies are uniquely identified by the principal name and version pair. You can have multiple policy versions for the same principal (e.g. production vs. staging). The version value default is special as it is the default fallback when no version is specified in the request.
3 Optional scope for this policy.
4 Variable definitions to import (optional).
5 Local variable definitions (optional).
6 Resource to which this override applies. Wildcards are supported here.
7 Optional name for the rule.
8 Actions that can be performed on the resource. Wildcards are supported here.
9 Optional conditions required to match this rule.
10 Optional output for the action rule. You can define a single expression per rule which will be evaluated and output in the response. An output expression can contain anything that condition expressions can have.