# yaml-language-server: $schema=https://api.cerbos.dev/latest/cerbos/policy/v1/Policy.schema.json
---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
  version: default
  resource: subaccount
  schemas:
    principalSchema:
      ref: cerbos:///principal.json
    resourceSchema:
      ref: cerbos:///tenant_owned_resource.json
  importDerivedRoles:
    - a360_roles
  rules:
  - name: create
    actions: ["create"]
    derivedRoles: [
      "account_admin",
      "contract_admin"
    ]
    condition:
      match:
        all:
          of:
            - expr: R.attr.is_distributor == true
    effect: EFFECT_ALLOW
  - name: delete
    actions: ["delete"]
    derivedRoles: [
      "account_admin"
    ]
    effect: EFFECT_ALLOW
