Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions policies/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -639,3 +639,57 @@ resourcePolicy:
match:
expr: >
!(request.resource.attr.categories.exists(cat, cat.subCategories.exists(sub, sub.name == "finance")))

- actions:
- "string-concat"
effect: EFFECT_ALLOW
roles:
- USER
condition:
match:
expr: >
request.resource.attr.aString == "prefix:" + request.resource.attr.id

- actions:
- "string-concat-principal"
effect: EFFECT_ALLOW
roles:
- USER
condition:
match:
any:
of:
- expr: P.attr.context == "projects"
- expr: P.attr.context == "projects:" + request.resource.attr.id

- actions:
- "hierarchy-overlaps"
effect: EFFECT_ALLOW
roles:
- USER
condition:
match:
expr: >
hierarchy(P.attr.context, ":").overlaps(hierarchy(["projects", R.id]))

- actions:
- "hierarchy-ancestor-of"
effect: EFFECT_ALLOW
roles:
- USER
condition:
match:
expr: >
hierarchy(P.attr.scope).ancestorOf(hierarchy(R.attr.scope))

- actions:
- "hierarchy-descendent-of"
effect: EFFECT_ALLOW
roles:
- USER
condition:
match:
expr: >
hierarchy(R.attr.scope).descendentOf(hierarchy(P.attr.scope))


11 changes: 11 additions & 0 deletions prisma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ An adapter library that takes a [Cerbos](https://cerbos.dev) Query Plan ([PlanRe
- Collection operators: `exists`, `exists_one`, `all`, `filter`, `except`
- Set operations: `hasIntersection`

#### String Concatenation

- `add` operator for string/numeric concatenation in conditions
- Algebraic solving: `P.attr.context == "projects:" + R.attr.id` → `{ id: { equals: "123" } }`

#### Hierarchy Operators

- `hierarchy(string)`, `hierarchy(string, delimiter)`, `hierarchy([segments])`
- `overlaps`: segment-wise prefix comparison between two hierarchies
- `ancestorOf` / `descendentOf`: strict prefix relationship between hierarchies

#### Advanced Features

- Deep nested relations support
Expand Down
Loading
Loading