Files
upstream-casbin/examples/rbac_with_abac_rule_policy.csv
upstream-mirror d8971e16fb
Some checks failed
Build / test (1.21) (push) Successful in 2m21s
Build / benchmark (1.21) (push) Failing after 2m28s
golangci-lint / golangci (push) Successful in 19m40s
snapshot of https://github.com/casbin/casbin.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 21:46:19 +05:00

821 B

1# RBAC roles combined with a per-policy ABAC condition.
2#
3# p, role, object, action, cond, effect
4#
5# read attributes that every request reaching it actually supplies: reading an
6# attribute the ctx does not have makes Enforce return an error rather than a
7p, employee, data1, read, r.ctx.Hour >= 9 && r.ctx.Hour < 18, allow
8p, employee, data2, write, r.ctx.Secure == true, allow
9p, admin, data3, read, true, allow
10# Deny overrides every allow above: a high-risk session gets nothing.
11p, employee, *, *, r.ctx.Risk == 'high', deny
12g, admin, employee
13g, alice, admin
14g, bob, employee