Skip to content

Commit

Permalink
feat: add keymatch3, keymatch4, and keymatch5 to model list (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
HashCookie authored Jan 11, 2025
1 parent ca387c8 commit 39a8df9
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions app/components/editor/casbin-mode/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,66 @@ alice, /alice_data/hello, POST`,
customConfig: undefined,
enforceContext: undefined,
},
keymatch3: {
name: 'RESTful (KeyMatch3)',
model: `[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub == p.sub && keyMatch3(r.obj, p.obj) && regexMatch(r.act, p.act)`,
policy: `p, alice, /alice_data/{resource}/, GET
p, alice, /alice_data2/{id}/using/{resId}/, GET`,
request: `alice, /alice_data/hello/, GET
alice, /alice_data/hello/, POST`,
customConfig: undefined,
enforceContext: undefined,
},
keymatch4: {
name: 'RESTful (KeyMatch4)',
model: `[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub == p.sub && keyMatch4(r.obj, p.obj) && regexMatch(r.act, p.act)`,
policy: `p, alice, /alice_data/{resource}?, GET
p, alice, /alice_data2/{id}/using/{resId}?, GET`,
request: `alice, /alice_data/hello?, GET
alice, /alice_data/hello?, POST`,
customConfig: undefined,
enforceContext: undefined,
},
keymatch5: {
name: 'RESTful (KeyMatch5)',
model: `[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub == p.sub && keyMatch5(r.obj, p.obj) && regexMatch(r.act, p.act)`,
policy: `p, alice, /alice_data/{resource}/.*, GET
p, alice, /alice_data2/{id}/using/{resId}/.*, GET`,
request: `alice, /alice_data/hello/123, GET
alice, /alice_data/hello/123, POST`,
customConfig: undefined,
enforceContext: undefined,
},
ipmatch: {
name: 'IP match',
model: `[request_definition]
Expand Down

0 comments on commit 39a8df9

Please sign in to comment.