Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add keymatch3, keymatch4, and keymatch5 to model list #199

Merged
merged 1 commit into from
Jan 11, 2025
Merged
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
feat: add keymatch3, keymatch4, and keymatch5 examples to casbin-mode…
… editor
  • Loading branch information
HashCookie committed Jan 11, 2025
commit eb708d9d9538a3603f092582dc58d3908faa71b8
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
Loading