
apiVersion: api.cerbos.dev/v1
resourcePolicy:
version: default
resource: abacExample
rules:
# If the principal's role is ADMIN then all the actions are allowed.
- actions:
- "*"
effect: EFFECT_ALLOW
roles:
- ADMIN
# If the principal's role is USER or MANAGER then creating is allowed.
- actions:
- create
effect: EFFECT_ALLOW
roles:
- USER
- MANAGER
# If the principal's role is USER they read a resource as
# long as it is published or owned by the user
- actions:
- read
effect: EFFECT_ALLOW
roles:
- USER
condition:
match:
any:
of:
- expr: request.resource.attr.isPublished == true
- expr: request.resource.attr.ownerId == request.principal.id
# If the principal's role is MANAGER then they can also update
- actions:
- update
effect: EFFECT_ALLOW
roles:
- MANAGER
In this policy for a purchase order a user is granted permission to do defined actions based on their role and attributes. Admins can do all actions, users can create, and managers can also update a PO. Users can also read a purchase order if the isPublished attribute is TRUE or the ownerId attribute of the purchase order is equal to their userID.
Fit Cerbos seamlessly into your tech stack
Prototype policies in your browser right now
Implement roles & permissions in your app
Book an intro call and learn more
Join thousands of developers | Features and updates | 1x per month | No spam, just goodies.
What is Cerbos?
Cerbos is an end-to-end enterprise authorization software for Zero Trust environments and AI-powered systems. It enforces fine-grained, contextual, and continuous authorization across apps, APIs, AI agents, MCP servers, services, and workloads.
Cerbos consists of an open-source Policy Decision Point, Enforcement Point integrations, and a centrally managed Policy Administration Plane (Cerbos Hub) that coordinates unified policy-based authorization across your architecture. Enforce least privilege & maintain full visibility into access decisions with Cerbos authorization.