Skip to content

Commit

Permalink
fix: support pattern function in 3rd args of g (#199)
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
  • Loading branch information
nodece authored Oct 7, 2020
1 parent dc22145 commit 27005f8
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 103 deletions.
14 changes: 14 additions & 0 deletions examples/rbac_with_all_pattern_model.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[request_definition]
r = sub, dom, obj, act

[policy_definition]
p = sub, dom, obj, act

[role_definition]
g = _, _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub == p.sub && g(r.obj, p.obj, r.dom) && r.dom == p.dom && r.act == p.act
4 changes: 4 additions & 0 deletions examples/rbac_with_all_pattern_policy.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
p, alice, domain1, book_group, read
p, alice, domain2, book_group, write

g, /book/:id, book_group, *
14 changes: 14 additions & 0 deletions examples/rbac_with_domain_pattern_model.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[request_definition]
r = sub, dom, obj, act

[policy_definition]
p = sub, dom, obj, act

[role_definition]
g = _, _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub, r.dom) && r.dom == p.dom && r.obj == p.obj && r.act == p.act
7 changes: 7 additions & 0 deletions examples/rbac_with_domain_pattern_policy.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
p, admin, domain1, data1, read
p, admin, domain1, data1, write
p, admin, domain2, data2, read
p, admin, domain2, data2, write

g, alice, admin, *
g, bob, admin, domain2
Loading

0 comments on commit 27005f8

Please sign in to comment.