snapshot of https://github.com/casbin/casbin.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
11
examples/abac_model.conf
Normal file
11
examples/abac_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = r.sub == r.obj.Owner
|
||||
11
examples/abac_not_using_policy_model.conf
Normal file
11
examples/abac_not_using_policy_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, eft
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))
|
||||
|
||||
[matchers]
|
||||
m = r.sub == r.obj.Owner
|
||||
4
examples/abac_rule_effect_policy.csv
Normal file
4
examples/abac_rule_effect_policy.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
p, alice, /data1, read, deny
|
||||
p, alice, /data1, write, allow
|
||||
p, bob, /data2, write, deny
|
||||
p, bob, /data2, read, allow
|
||||
|
11
examples/abac_rule_model.conf
Normal file
11
examples/abac_rule_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub_rule, obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = eval(p.sub_rule) && r.obj == p.obj && r.act == p.act
|
||||
2
examples/abac_rule_policy.csv
Normal file
2
examples/abac_rule_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, r.sub.Age > 18, /data1, read
|
||||
p, r.sub.Age < 60, /data2, write
|
||||
|
2
examples/basic_inverse_policy.csv
Normal file
2
examples/basic_inverse_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, alice, data1, write
|
||||
p, bob, data2, read
|
||||
|
11
examples/basic_model.conf
Normal file
11
examples/basic_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && r.obj == p.obj && r.act == p.act
|
||||
11
examples/basic_model_without_spaces.conf
Normal file
11
examples/basic_model_without_spaces.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && r.obj == p.obj && r.act == p.act
|
||||
2
examples/basic_policy.csv
Normal file
2
examples/basic_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, alice, data1, read
|
||||
p, bob, data2, write
|
||||
|
11
examples/basic_with_root_model.conf
Normal file
11
examples/basic_with_root_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && r.obj == p.obj && r.act == p.act || r.sub == "root"
|
||||
11
examples/basic_without_resources_model.conf
Normal file
11
examples/basic_without_resources_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = r.sub == p.sub && r.act == p.act
|
||||
2
examples/basic_without_resources_policy.csv
Normal file
2
examples/basic_without_resources_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, alice, read
|
||||
p, bob, write
|
||||
|
11
examples/basic_without_users_model.conf
Normal file
11
examples/basic_without_users_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = r.obj == p.obj && r.act == p.act
|
||||
2
examples/basic_without_users_policy.csv
Normal file
2
examples/basic_without_users_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, data1, read
|
||||
p, data2, write
|
||||
|
14
examples/biba_model.conf
Normal file
14
examples/biba_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, sub_level, obj, obj_level, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m =(r.act == "read" && r.sub_level <= r.obj_level) || (r.act == "write" && r.sub_level >= r.obj_level)
|
||||
14
examples/blp_model.conf
Normal file
14
examples/blp_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, sub_level, obj, obj_level, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = (r.act == "read" && r.sub_level >= r.obj_level) || (r.act == "write" && r.sub_level <= r.obj_level)
|
||||
12
examples/comment_model.conf
Normal file
12
examples/comment_model.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act ; Request definition
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow)) # This is policy effect.
|
||||
|
||||
# Matchers
|
||||
[matchers]
|
||||
m = r.sub == p.sub && r.obj == p.obj && r.act == p.act
|
||||
11
examples/error/error_model.conf
Normal file
11
examples/error/error_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && r.obj == p.obj && r.act == p.act
|
||||
2
examples/error/error_policy.csv
Normal file
2
examples/error/error_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, alice, data1, read
|
||||
bob, data2, write
|
||||
|
11
examples/eval_operator_model.conf
Normal file
11
examples/eval_operator_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub_rule, obj_rule, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = eval(p.sub_rule) && eval(p.obj_rule) && (p.act == '*' || r.act == p.act)
|
||||
1
examples/eval_operator_policy.csv
Normal file
1
examples/eval_operator_policy.csv
Normal file
@@ -0,0 +1 @@
|
||||
p, r.sub == 'admin' || false, r.obj == 'users', write
|
||||
|
11
examples/glob_model.conf
Normal file
11
examples/glob_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && globMatch(r.obj, p.obj) && r.act == p.act
|
||||
4
examples/glob_policy.csv
Normal file
4
examples/glob_policy.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
p, u1, /foo/*, read
|
||||
p, u2, /foo*, read
|
||||
p, u3, /*/foo/*, read
|
||||
p, u4, *, read
|
||||
|
11
examples/ipmatch_model.conf
Normal file
11
examples/ipmatch_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = ipMatch(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
2
examples/ipmatch_policy.csv
Normal file
2
examples/ipmatch_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, 192.168.2.0/24, data1, read
|
||||
p, 10.0.0.0/16, data2, write
|
||||
|
11
examples/keyget2_model.conf
Normal file
11
examples/keyget2_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && keyGet2(r.obj, p.obj, 'resource') in ('age', 'name') && regexMatch(r.act, p.act)
|
||||
11
examples/keyget_model.conf
Normal file
11
examples/keyget_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && (r.obj == p.obj || keyGet(r.obj, p.obj) in ('age','name')) && regexMatch(r.act, p.act)
|
||||
11
examples/keymatch2_model.conf
Normal file
11
examples/keymatch2_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && keyMatch2(r.obj, p.obj) && regexMatch(r.act, p.act)
|
||||
2
examples/keymatch2_policy.csv
Normal file
2
examples/keymatch2_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, alice, /alice_data/:resource, GET
|
||||
p, alice, /alice_data2/:id/using/:resId, GET
|
||||
|
11
examples/keymatch_custom_model.conf
Normal file
11
examples/keymatch_custom_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && keyMatchCustom(r.obj, p.obj) && regexMatch(r.act, p.act)
|
||||
11
examples/keymatch_model.conf
Normal file
11
examples/keymatch_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[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 && keyMatch(r.obj, p.obj) && regexMatch(r.act, p.act)
|
||||
7
examples/keymatch_policy.csv
Normal file
7
examples/keymatch_policy.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
p, alice, /alice_data/*, GET
|
||||
p, alice, /alice_data/resource1, POST
|
||||
|
||||
p, bob, /alice_data/resource2, GET
|
||||
p, bob, /bob_data/*, POST
|
||||
|
||||
p, cathy, /cathy_data, (GET)|(POST)
|
||||
|
14
examples/keymatch_with_rbac_in_domain.conf
Normal file
14
examples/keymatch_with_rbac_in_domain.conf
Normal file
@@ -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) && keyMatch(r.dom, p.dom) && keyMatch(r.obj, p.obj) && regexMatch(r.act, p.act)
|
||||
6
examples/keymatch_with_rbac_in_domain.csv
Normal file
6
examples/keymatch_with_rbac_in_domain.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
g, can_manage, can_use, *
|
||||
|
||||
p, can_manage, engines/*, *, (pause)|(resume)
|
||||
p, can_use, engines/*, *, (attach)|(detach)
|
||||
|
||||
g, Username==test2, can_manage, engines/engine1
|
||||
|
14
examples/lbac_model.conf
Normal file
14
examples/lbac_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, subject_confidentiality, subject_integrity, obj, object_confidentiality, object_integrity, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = (r.act == "read" && r.subject_confidentiality >= r.object_confidentiality && r.subject_integrity >= r.object_integrity) || (r.act == "write" && r.subject_confidentiality <= r.object_confidentiality && r.subject_integrity <= r.object_integrity)
|
||||
19
examples/multiple_policy_definitions_model.conf
Normal file
19
examples/multiple_policy_definitions_model.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
r2 = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
p2= sub_rule, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
#RABC
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
#ABAC
|
||||
m2 = eval(p2.sub_rule) && r2.obj == p2.obj && r2.act == p2.act
|
||||
5
examples/multiple_policy_definitions_policy.csv
Normal file
5
examples/multiple_policy_definitions_policy.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
p, data2_admin, data2, read
|
||||
p2, r2.sub.Age > 18 && r2.sub.Age < 60, /data1, read, allow
|
||||
p2, r2.sub.Age > 60 && r2.sub.Age < 100, /data1, read, deny
|
||||
|
||||
g, alice, data2_admin
|
||||
|
14
examples/object_conditions_model.conf
Normal file
14
examples/object_conditions_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, sub_rule, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && eval(p.sub_rule) && r.act == p.act
|
||||
5
examples/object_conditions_policy.csv
Normal file
5
examples/object_conditions_policy.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
p, alice, r.obj.price < 25, read
|
||||
p, admin, r.obj.category_id = 2, read
|
||||
p, bob, r.obj.author = bob, write
|
||||
|
||||
g, alice, admin
|
||||
|
16
examples/orbac_model.conf
Normal file
16
examples/orbac_model.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
[request_definition]
|
||||
r = sub, org, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = role, activity, view, org
|
||||
|
||||
[role_definition]
|
||||
g = _, _, _
|
||||
g2 = _, _, _
|
||||
g3 = _, _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.role, r.org) && g2(r.act, p.activity, r.org) && g3(r.obj, p.view, r.org) && r.org == p.org
|
||||
25
examples/orbac_policy.csv
Normal file
25
examples/orbac_policy.csv
Normal file
@@ -0,0 +1,25 @@
|
||||
# Permission rules: role, activity, view, organization
|
||||
p, manager, modify, document, org1
|
||||
p, manager, consult, document, org1
|
||||
p, employee, consult, document, org1
|
||||
p, manager, modify, report, org2
|
||||
p, manager, consult, report, org2
|
||||
p, employee, consult, report, org2
|
||||
|
||||
# Empower: subject, role, organization
|
||||
g, alice, manager, org1
|
||||
g, bob, employee, org1
|
||||
g, charlie, manager, org2
|
||||
g, david, employee, org2
|
||||
|
||||
# Use: action, activity, organization
|
||||
g2, write, modify, org1
|
||||
g2, read, consult, org1
|
||||
g2, write, modify, org2
|
||||
g2, read, consult, org2
|
||||
|
||||
# Consider: object, view, organization
|
||||
g3, data1, document, org1
|
||||
g3, data2, document, org1
|
||||
g3, report1, report, org2
|
||||
g3, report2, report, org2
|
||||
|
11
examples/pbac_model.conf
Normal file
11
examples/pbac_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub_rule, obj_rule, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = eval(p.sub_rule) && eval(p.obj_rule) && r.act == p.act
|
||||
2
examples/pbac_policy.csv
Normal file
2
examples/pbac_policy.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
p, r.sub.Role == 'admin', r.obj.Type == 'doc', read
|
||||
p, r.sub.Age >= 18, r.obj.Type == 'video', play
|
||||
|
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub, r.obj) && keyMatch4(r.obj, p.obj) && regexMatch(r.act, p.act)
|
||||
1
examples/priority_indeterminate_policy.csv
Normal file
1
examples/priority_indeterminate_policy.csv
Normal file
@@ -0,0 +1 @@
|
||||
p, alice, data1, read, indeterminate
|
||||
|
14
examples/priority_model.conf
Normal file
14
examples/priority_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = priority(p.eft) || deny
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
16
examples/priority_model_enforce_context.conf
Normal file
16
examples/priority_model_enforce_context.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
r2 = sub, obj
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = priority(p.eft) || deny
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
m2 = g(r2.sub, p.sub)
|
||||
14
examples/priority_model_explicit.conf
Normal file
14
examples/priority_model_explicit.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = priority, sub, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = priority(p.eft) || deny
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
14
examples/priority_model_explicit_customized.conf
Normal file
14
examples/priority_model_explicit_customized.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = subject, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = customized_priority, obj, act, eft, subject
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = priority(p.eft) || deny
|
||||
|
||||
[matchers]
|
||||
m = g(r.subject, p.subject) && r.obj == p.obj && r.act == p.act
|
||||
12
examples/priority_policy.csv
Normal file
12
examples/priority_policy.csv
Normal file
@@ -0,0 +1,12 @@
|
||||
p, alice, data1, read, allow
|
||||
p, data1_deny_group, data1, read, deny
|
||||
p, data1_deny_group, data1, write, deny
|
||||
p, alice, data1, write, allow
|
||||
|
||||
g, alice, data1_deny_group
|
||||
|
||||
p, data2_allow_group, data2, read, allow
|
||||
p, bob, data2, read, deny
|
||||
p, bob, data2, write, deny
|
||||
|
||||
g, bob, data2_allow_group
|
||||
|
12
examples/priority_policy_enforce_context.csv
Normal file
12
examples/priority_policy_enforce_context.csv
Normal file
@@ -0,0 +1,12 @@
|
||||
p, alice, data1, read, allow
|
||||
p, data1_deny_group, data1, read, deny
|
||||
p, data1_deny_group, data1, write, deny
|
||||
p, alice, data1, write, allow
|
||||
|
||||
g, alice, data1_deny_group
|
||||
|
||||
p, data2_allow_group, data2, read, allow
|
||||
p, bob, data2, read, deny
|
||||
p, bob, data2, write, deny
|
||||
|
||||
g, bob, data2_allow_group
|
||||
|
12
examples/priority_policy_explicit.csv
Normal file
12
examples/priority_policy_explicit.csv
Normal file
@@ -0,0 +1,12 @@
|
||||
p, 10, data1_deny_group, data1, read, deny
|
||||
p, 10, data1_deny_group, data1, write, deny
|
||||
p, 10, data2_allow_group, data2, read, allow
|
||||
p, 10, data2_allow_group, data2, write, allow
|
||||
|
||||
|
||||
p, 1, alice, data1, write, allow
|
||||
p, 1, alice, data1, read, allow
|
||||
p, 1, bob, data2, read, deny
|
||||
|
||||
g, bob, data2_allow_group
|
||||
g, alice, data1_deny_group
|
||||
|
12
examples/priority_policy_explicit_customized.csv
Normal file
12
examples/priority_policy_explicit_customized.csv
Normal file
@@ -0,0 +1,12 @@
|
||||
p, 10, data1, read, deny, data1_deny_group
|
||||
p, 10, data1, write, deny, data1_deny_group
|
||||
p, 10, data2, read, allow, data2_allow_group
|
||||
p, 10, data2, write, allow, data2_allow_group
|
||||
|
||||
|
||||
p, 1, data1, write, allow, alice
|
||||
p, 1, data1, read, allow, alice
|
||||
p, 1, data2, read, deny, bob
|
||||
|
||||
g, bob, data2_allow_group
|
||||
g, alice, data1_deny_group
|
||||
|
14
examples/rbac_model.conf
Normal file
14
examples/rbac_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
15
examples/rbac_model_in_multi_line.conf
Normal file
15
examples/rbac_model_in_multi_line.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj \
|
||||
&& r.act == p.act
|
||||
14
examples/rbac_model_matcher_using_in_op.conf
Normal file
14
examples/rbac_model_matcher_using_in_op.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act || r.obj in ('data2', 'data3')
|
||||
14
examples/rbac_model_matcher_using_in_op_bracket.conf
Normal file
14
examples/rbac_model_matcher_using_in_op_bracket.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act || r.obj in ['data2', 'data3']
|
||||
5
examples/rbac_policy.csv
Normal file
5
examples/rbac_policy.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
p, alice, data1, read
|
||||
p, bob, data2, write
|
||||
p, data2_admin, data2, read
|
||||
p, data2_admin, data2, write
|
||||
g, alice, data2_admin
|
||||
|
14
examples/rbac_with_abac_rule_model.conf
Normal file
14
examples/rbac_with_abac_rule_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act, ctx
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, cond, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && keyMatch(r.obj, p.obj) && keyMatch(r.act, p.act) && eval(p.cond)
|
||||
20
examples/rbac_with_abac_rule_policy.csv
Normal file
20
examples/rbac_with_abac_rule_policy.csv
Normal file
@@ -0,0 +1,20 @@
|
||||
# RBAC roles combined with a per-policy ABAC condition.
|
||||
#
|
||||
# p, role, object, action, cond, effect
|
||||
#
|
||||
# "cond" is a matcher expression evaluated against the ctx argument of the
|
||||
# request. Write "true" for a policy that carries no condition. A cond may only
|
||||
# read attributes that every request reaching it actually supplies: reading an
|
||||
# attribute the ctx does not have makes Enforce return an error rather than a
|
||||
# plain "denied", so pass a struct (or a map with every attribute filled in).
|
||||
|
||||
p, employee, data1, read, r.ctx.Hour >= 9 && r.ctx.Hour < 18, allow
|
||||
p, employee, data2, write, r.ctx.Secure == true, allow
|
||||
p, admin, data3, read, true, allow
|
||||
|
||||
# Deny overrides every allow above: a high-risk session gets nothing.
|
||||
p, employee, *, *, r.ctx.Risk == 'high', deny
|
||||
|
||||
g, admin, employee
|
||||
g, alice, admin
|
||||
g, bob, employee
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 3.
|
14
examples/rbac_with_all_pattern_model.conf
Normal file
14
examples/rbac_with_all_pattern_model.conf
Normal file
@@ -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
examples/rbac_with_all_pattern_policy.csv
Normal file
4
examples/rbac_with_all_pattern_policy.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
p, alice, domain1, book_group, read
|
||||
p, alice, domain2, book_group, write
|
||||
|
||||
g, /book/:id, book_group, *
|
||||
|
20
examples/rbac_with_constraints_model.conf
Normal file
20
examples/rbac_with_constraints_model.conf
Normal file
@@ -0,0 +1,20 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[constraint_definition]
|
||||
c = sod("finance_requester", "finance_approver")
|
||||
c2 = sodMax(["payroll_view", "payroll_edit", "payroll_approve"], 1)
|
||||
c3 = roleMax("superadmin", 2)
|
||||
c4 = rolePre("db_admin", "security_trained")
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
7
examples/rbac_with_cycle_policy.csv
Normal file
7
examples/rbac_with_cycle_policy.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
p, alice, data1, read
|
||||
p, bob, data2, write
|
||||
p, data2_admin, data2, read
|
||||
p, data2_admin, data2, write
|
||||
g, alice, data2_admin
|
||||
g, data2_admin, super_admin
|
||||
g, super_admin, alice
|
||||
|
14
examples/rbac_with_deny_model.conf
Normal file
14
examples/rbac_with_deny_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow)) && !some(where (p.eft == deny))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
7
examples/rbac_with_deny_policy.csv
Normal file
7
examples/rbac_with_deny_policy.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
p, alice, data1, read, allow
|
||||
p, bob, data2, write, allow
|
||||
p, data2_admin, data2, read, allow
|
||||
p, data2_admin, data2, write, allow
|
||||
p, alice, data2, write, deny
|
||||
|
||||
g, alice, data2_admin
|
||||
|
15
examples/rbac_with_different_types_of_roles_model.conf
Normal file
15
examples/rbac_with_different_types_of_roles_model.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, dom, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _, _, (_, _)
|
||||
g2 = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub, p.dom) && g2(r.obj, p.dom) && regexMatch(r.act, p.act)
|
||||
12
examples/rbac_with_different_types_of_roles_policy.csv
Normal file
12
examples/rbac_with_different_types_of_roles_policy.csv
Normal file
@@ -0,0 +1,12 @@
|
||||
p, role:owner, domain1, _, (read|write)
|
||||
p, role:developer, domain1, _, read
|
||||
|
||||
p, role:owner, domain2, _, (read|write)
|
||||
p, role:developer, domain2, _, read
|
||||
|
||||
g, alice, role:owner, domain1, _, _
|
||||
g, bob, role:developer, domain2, _, 9999-12-30 00:00:00
|
||||
g, carol, role:owner, domain2, _, 0000-01-02 00:00:00
|
||||
|
||||
g2, data1, domain1
|
||||
g2, data2, domain2
|
||||
|
14
examples/rbac_with_domain_pattern_model.conf
Normal file
14
examples/rbac_with_domain_pattern_model.conf
Normal file
@@ -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
|
||||
8
examples/rbac_with_domain_pattern_policy.csv
Normal file
8
examples/rbac_with_domain_pattern_policy.csv
Normal file
@@ -0,0 +1,8 @@
|
||||
p, admin, domain1, data1, read
|
||||
p, admin, domain1, data1, write
|
||||
p, admin, domain2, data2, read
|
||||
p, admin, domain2, data2, write
|
||||
p, admin, *, data3, read
|
||||
|
||||
g, alice, admin, *
|
||||
g, bob, admin, domain2
|
||||
|
14
examples/rbac_with_domain_temporal_roles_model.conf
Normal file
14
examples/rbac_with_domain_temporal_roles_model.conf
Normal file
@@ -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
|
||||
24
examples/rbac_with_domain_temporal_roles_policy.csv
Normal file
24
examples/rbac_with_domain_temporal_roles_policy.csv
Normal file
@@ -0,0 +1,24 @@
|
||||
p, alice, domain1, data1, read
|
||||
p, alice, domain1, data1, write
|
||||
p, data2_admin, domain2, data2, read
|
||||
p, data2_admin, domain2, data2, write
|
||||
p, data3_admin, domain3, data3, read
|
||||
p, data3_admin, domain3, data3, write
|
||||
p, data4_admin, domain4, data4, read
|
||||
p, data4_admin, domain4, data4, write
|
||||
p, data5_admin, domain5, data5, read
|
||||
p, data5_admin, domain5, data5, write
|
||||
p, data6_admin, domain6, data6, read
|
||||
p, data6_admin, domain6, data6, write
|
||||
p, data7_admin, domain7, data7, read
|
||||
p, data7_admin, domain7, data7, write
|
||||
p, data8_admin, domain8, data8, read
|
||||
p, data8_admin, domain8, data8, write
|
||||
|
||||
g, alice, data2_admin, domain2, 0000-01-01 00:00:00, 0000-01-02 00:00:00
|
||||
g, alice, data3_admin, domain3, 0000-01-01 00:00:00, 9999-12-30 00:00:00
|
||||
g, alice, data4_admin, domain4, _, _
|
||||
g, alice, data5_admin, domain5, _, 9999-12-30 00:00:00
|
||||
g, alice, data6_admin, domain6, _, 0000-01-02 00:00:00
|
||||
g, alice, data7_admin, domain7, 0000-01-01 00:00:00, _
|
||||
g, alice, data8_admin, domain8, 9999-12-30 00:00:00, _
|
||||
|
@@ -0,0 +1,5 @@
|
||||
p, role_top, domainx, data_top, read
|
||||
p, role_solo, domainx, data_solo, read
|
||||
g, alice, role_mid, domainx, _, _
|
||||
g, role_mid, role_top, domainx, 0000-01-01 00:00:00, 0000-01-02 00:00:00
|
||||
g, alice, role_solo, domainx, 0000-01-01 00:00:00, 0000-01-02 00:00:00
|
||||
|
15
examples/rbac_with_domains_conditional_model.conf
Normal file
15
examples/rbac_with_domains_conditional_model.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[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 && \
|
||||
(keyMatch(r.act, p.act) || keyMatch2(r.act, p.act) || keyMatch3(r.act, p.act) || keyMatch4(r.act, p.act) || keyMatch5(r.act, p.act) || globMatch(r.act, p.act))
|
||||
13
examples/rbac_with_domains_conditional_policy.csv
Normal file
13
examples/rbac_with_domains_conditional_policy.csv
Normal file
@@ -0,0 +1,13 @@
|
||||
p, test1, domain1, service1, /list
|
||||
p, test1, domain1, service1, /get/:id/*
|
||||
p, test1, domain1, service1, /add
|
||||
p, test1, domain1, service1, /user/*
|
||||
p, admin, domain1, service1, /*
|
||||
p, qa1, domain2, service2, /broadcast
|
||||
p, qa1, domain2, service2, /trip
|
||||
p, qa1, domain2, service2, /notify
|
||||
p, qa1, domain2, service2, /dynamic-sql
|
||||
|
||||
g, alice, test1, domain1, _, 2999-12-30 00:00:00
|
||||
g, bob, qa1, domain2, _, 2999-12-30 00:00:00
|
||||
g, jack, test1, domain1, _, 0000-12-30 00:00:00
|
||||
|
14
examples/rbac_with_domains_model.conf
Normal file
14
examples/rbac_with_domains_model.conf
Normal file
@@ -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
|
||||
6
examples/rbac_with_domains_policy.csv
Normal file
6
examples/rbac_with_domains_policy.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
p, admin, domain1, data1, read
|
||||
p, admin, domain1, data1, write
|
||||
p, admin, domain2, data2, read
|
||||
p, admin, domain2, data2, write
|
||||
g, alice, admin, domain1
|
||||
g, bob, admin, domain2
|
||||
|
9
examples/rbac_with_domains_policy2.csv
Normal file
9
examples/rbac_with_domains_policy2.csv
Normal file
@@ -0,0 +1,9 @@
|
||||
p, admin, domain1, data1, read
|
||||
p, admin, domain1, data1, write
|
||||
p, admin, domain2, data2, read
|
||||
p, admin, domain2, data2, write
|
||||
p, user, domain3, data2, read
|
||||
g, alice, admin, domain1
|
||||
g, alice, admin, domain2
|
||||
g, bob, admin, domain2
|
||||
g, bob, user, domain3
|
||||
|
10
examples/rbac_with_hierarchy_policy.csv
Normal file
10
examples/rbac_with_hierarchy_policy.csv
Normal file
@@ -0,0 +1,10 @@
|
||||
p, alice, data1, read
|
||||
p, bob, data2, write
|
||||
p, data1_admin, data1, read
|
||||
p, data1_admin, data1, write
|
||||
p, data2_admin, data2, read
|
||||
p, data2_admin, data2, write
|
||||
|
||||
g, alice, admin
|
||||
g, admin, data1_admin
|
||||
g, admin, data2_admin
|
||||
|
11
examples/rbac_with_hierarchy_with_domains_policy.csv
Normal file
11
examples/rbac_with_hierarchy_with_domains_policy.csv
Normal file
@@ -0,0 +1,11 @@
|
||||
p, role:reader, domain1, data1, read
|
||||
p, role:writer, domain1, data1, write
|
||||
|
||||
p, alice, domain1, data2, read
|
||||
p, alice, domain2, data2, read
|
||||
|
||||
g, role:global_admin, role:reader, domain1
|
||||
g, role:global_admin, role:writer, domain1
|
||||
|
||||
g, alice, role:global_admin, domain1
|
||||
|
||||
|
17
examples/rbac_with_multiple_policy_model.conf
Normal file
17
examples/rbac_with_multiple_policy_model.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
[request_definition]
|
||||
r = user, thing, action
|
||||
|
||||
[policy_definition]
|
||||
p = role, thing, action
|
||||
p2 = role, action
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.user, p.role) && r.thing == p.thing && r.action == p.action
|
||||
m2 = g(r.user, p2.role) && r.action == p.action
|
||||
|
||||
[role_definition]
|
||||
g = _,_
|
||||
g2 = _,_
|
||||
9
examples/rbac_with_multiple_policy_policy.csv
Normal file
9
examples/rbac_with_multiple_policy_policy.csv
Normal file
@@ -0,0 +1,9 @@
|
||||
p, user, /data, GET
|
||||
p, admin, /data, POST
|
||||
|
||||
p2, user, view
|
||||
p2, admin, create
|
||||
|
||||
g, admin, user
|
||||
g, alice, admin
|
||||
g2, alice, user
|
||||
|
14
examples/rbac_with_not_deny_model.conf
Normal file
14
examples/rbac_with_not_deny_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = !some(where (p.eft == deny))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
15
examples/rbac_with_pattern_model.conf
Normal file
15
examples/rbac_with_pattern_model.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
g2 = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && g2(r.obj, p.obj) && regexMatch(r.act, p.act)
|
||||
28
examples/rbac_with_pattern_policy.csv
Normal file
28
examples/rbac_with_pattern_policy.csv
Normal file
@@ -0,0 +1,28 @@
|
||||
p, alice, /pen/1, GET
|
||||
p, alice, /pen2/1, GET
|
||||
p, book_admin, book_group, GET
|
||||
p, pen_admin, pen_group, GET
|
||||
p, *, pen3_group, GET
|
||||
|
||||
p, /book/admin/:id, pen4_group, GET
|
||||
g, /book/user/:id, /book/admin/1
|
||||
|
||||
p, /book/leader/2, pen4_group, POST
|
||||
g, /book/user/:id, /book/leader/2
|
||||
|
||||
g, alice, book_admin
|
||||
g, bob, pen_admin
|
||||
|
||||
g, cathy, /book/1/2/3/4/5
|
||||
g, cathy, pen_admin
|
||||
|
||||
g2, /book/*, book_group
|
||||
|
||||
g2, /book/:id, book_group
|
||||
g2, /pen/:id, pen_group
|
||||
|
||||
g2, /book2/{id}, book_group
|
||||
g2, /pen2/{id}, pen_group
|
||||
|
||||
g2, /pen3/:id, pen3_group
|
||||
g2, /pen4/:id, pen4_group
|
||||
|
15
examples/rbac_with_resource_roles_model.conf
Normal file
15
examples/rbac_with_resource_roles_model.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
g2 = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && g2(r.obj, p.obj) && r.act == p.act
|
||||
7
examples/rbac_with_resource_roles_policy.csv
Normal file
7
examples/rbac_with_resource_roles_policy.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
p, alice, data1, read
|
||||
p, bob, data2, write
|
||||
p, data_group_admin, data_group, write
|
||||
|
||||
g, alice, data_group_admin
|
||||
g2, data1, data_group
|
||||
g2, data2, data_group
|
||||
|
14
examples/rbac_with_temporal_roles_model.conf
Normal file
14
examples/rbac_with_temporal_roles_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _, (_, _)
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
24
examples/rbac_with_temporal_roles_policy.csv
Normal file
24
examples/rbac_with_temporal_roles_policy.csv
Normal file
@@ -0,0 +1,24 @@
|
||||
p, alice, data1, read
|
||||
p, alice, data1, write
|
||||
p, data2_admin, data2, read
|
||||
p, data2_admin, data2, write
|
||||
p, data3_admin, data3, read
|
||||
p, data3_admin, data3, write
|
||||
p, data4_admin, data4, read
|
||||
p, data4_admin, data4, write
|
||||
p, data5_admin, data5, read
|
||||
p, data5_admin, data5, write
|
||||
p, data6_admin, data6, read
|
||||
p, data6_admin, data6, write
|
||||
p, data7_admin, data7, read
|
||||
p, data7_admin, data7, write
|
||||
p, data8_admin, data8, read
|
||||
p, data8_admin, data8, write
|
||||
|
||||
g, alice, data2_admin, 0000-01-01 00:00:00, 0000-01-02 00:00:00
|
||||
g, alice, data3_admin, 0000-01-01 00:00:00, 9999-12-30 00:00:00
|
||||
g, alice, data4_admin, _, _
|
||||
g, alice, data5_admin, _, 9999-12-30 00:00:00
|
||||
g, alice, data6_admin, _, 0000-01-02 00:00:00
|
||||
g, alice, data7_admin, 0000-01-01 00:00:00, _
|
||||
g, alice, data8_admin, 9999-12-30 00:00:00, _
|
||||
|
15
examples/rebac_model.conf
Normal file
15
examples/rebac_model.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = role, obj_type, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _, _
|
||||
g2 = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, r.obj, p.role) && g2(r.obj, p.obj_type) && r.act == p.act
|
||||
7
examples/rebac_policy.csv
Normal file
7
examples/rebac_policy.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
p, collaborator, doc, read
|
||||
|
||||
g, alice, doc1, collaborator
|
||||
g, bob, doc2, collaborator
|
||||
|
||||
g2, doc1, doc
|
||||
g2, doc2, doc
|
||||
|
14
examples/subject_priority_model.conf
Normal file
14
examples/subject_priority_model.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act, eft
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = subjectPriority(p.eft) || deny
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
|
||||
14
examples/subject_priority_model_with_domain.conf
Normal file
14
examples/subject_priority_model_with_domain.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, dom, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, dom, act, eft #sub can't change position,must be first
|
||||
|
||||
[role_definition]
|
||||
g = _, _, _
|
||||
|
||||
[policy_effect]
|
||||
e = subjectPriority(p.eft) || deny
|
||||
|
||||
[matchers]
|
||||
m = g(r.sub, p.sub, r.dom) && r.dom == p.dom && r.obj == p.obj && r.act == p.act
|
||||
16
examples/subject_priority_policy.csv
Normal file
16
examples/subject_priority_policy.csv
Normal file
@@ -0,0 +1,16 @@
|
||||
p, root, data1, read, deny
|
||||
p, admin, data1, read, deny
|
||||
|
||||
p, editor, data1, read, deny
|
||||
p, subscriber, data1, read, deny
|
||||
|
||||
p, jane, data1, read, allow
|
||||
p, alice, data1, read, allow
|
||||
|
||||
g, admin, root
|
||||
|
||||
g, editor, admin
|
||||
g, subscriber, admin
|
||||
|
||||
g, jane, editor
|
||||
g, alice, subscriber
|
||||
|
7
examples/subject_priority_policy_with_domain.csv
Normal file
7
examples/subject_priority_policy_with_domain.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
p, admin, data1, domain1, write, deny
|
||||
p, alice, data1, domain1, write, allow
|
||||
p, admin, data2, domain2, write, deny
|
||||
p, bob, data2, domain2, write, allow
|
||||
|
||||
g, alice, admin, domain1
|
||||
g, bob, admin, domain2
|
||||
|
11
examples/syntax_matcher_model.conf
Normal file
11
examples/syntax_matcher_model.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p_eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = r.sub == "a.p.p.l.e"
|
||||
Reference in New Issue
Block a user