-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrbac.authz_test.rego
112 lines (106 loc) · 6.2 KB
/
rbac.authz_test.rego
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package rbac.authz
acl = {
"group_roles": {
"admin": ["admin"],
"quality_head_design": ["quality_head_design"],
"quality_head_system": ["quality_head_system"],
"quality_head_manufacture": ["quality_head_manufacture"],
"kpi_editor_design": ["kpi_editor_design"],
"kpi_editor_system": ["kpi_editor_system"],
"kpi_editor_manufacture": ["kpi_editor_manufacture"],
"viewer": ["viewer"],
"viewer_limit_ds": ["viewer_limit_ds"],
"viewer_limit_m": ["viewer_limit_m"],
"design_group_kpi_editor": ["kpi_editor_design", "viewer_limit_ds"],
"system_group_kpi_editor": ["kpi_editor_system", "viewer_limit_ds"],
"manufacture_group_kpi_editor": ["kpi_editor_manufacture", "viewer"],
"project_leader": ["viewer_limit_ds", "viewer_limit_m"],
},
"role_permissions": {
"admin": [
{"action": "view_all", "object": "design"},
{"action": "edit", "object": "design"},
{"action": "view_all", "object": "system"},
{"action": "edit", "object": "system"},
{"action": "view_all", "object": "manufacture"},
{"action": "edit", "object": "manufacture"},
],
"quality_head_design": [
{"action": "view_all", "object": "design"},
{"action": "edit", "object": "design"},
{"action": "view_all", "object": "system"},
{"action": "view_all", "object": "manufacture"},
],
"quality_head_system": [
{"action": "view_all", "object": "design"},
{"action": "view_all", "object": "system"},
{"action": "edit", "object": "system"},
{"action": "view_all", "object": "manufacture"},
],
"quality_head_manufacture": [
{"action": "view_all", "object": "design"},
{"action": "view_all", "object": "system"},
{"action": "view_all", "object": "manufacture"},
{"action": "edit", "object": "manufacture"},
],
"kpi_editor_design": [
{"action": "view_all", "object": "design"},
{"action": "edit", "object": "design"},
],
"kpi_editor_system": [
{"action": "view_all", "object": "system"},
{"action": "edit", "object": "system"},
],
"kpi_editor_manufacture": [
{"action": "view_all", "object": "manufacture"},
{"action": "edit", "object": "manufacture"},
],
"viewer": [
{"action": "view_all", "object": "design"},
{"action": "view_all", "object": "system"},
{"action": "view_all", "object": "manufacture"},
],
"viewer_limit_ds": [
{"action": "view_all", "object": "design"},
{"action": "view_all", "object": "system"},
],
"viewer_limit_m": [{"action": "view_l3_project", "object": "manufacture"}],
},
}
test_design_group_kpi_editor {
allow with input as {"user": ["design_group_kpi_editor"], "action": "view_all", "object": "design"} with data.rbac.authz.acl as acl
allow with input as {"user": ["design_group_kpi_editor"], "action": "edit", "object": "design"} with data.rbac.authz.acl as acl
allow with input as {"user": ["design_group_kpi_editor"], "action": "view_all", "object": "system"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["design_group_kpi_editor"], "action": "edit", "object": "system"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["design_group_kpi_editor"], "action": "view_all", "object": "manufacture"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["design_group_kpi_editor"], "action": "edit", "object": "manufacture"} with data.rbac.authz.acl as acl
}
test_system_group_kpi_editor {
allow with input as {"user": ["system_group_kpi_editor"], "action": "view_all", "object": "design"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["system_group_kpi_editor"], "action": "edit", "object": "design"} with data.rbac.authz.acl as acl
allow with input as {"user": ["system_group_kpi_editor"], "action": "view_all", "object": "system"} with data.rbac.authz.acl as acl
allow with input as {"user": ["system_group_kpi_editor"], "action": "edit", "object": "system"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["system_group_kpi_editor"], "action": "view_all", "object": "manufacture"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["system_group_kpi_editor"], "action": "edit", "object": "manufacture"} with data.rbac.authz.acl as acl
}
test_manufacture_group_kpi_editor {
allow with input as {"user": ["manufacture_group_kpi_editor"], "action": "view_all", "object": "design"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["manufacture_group_kpi_editor"], "action": "edit", "object": "design"} with data.rbac.authz.acl as acl
allow with input as {"user": ["manufacture_group_kpi_editor"], "action": "view_all", "object": "system"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["manufacture_group_kpi_editor"], "action": "edit", "object": "system"} with data.rbac.authz.acl as acl
allow with input as {"user": ["manufacture_group_kpi_editor"], "action": "view_all", "object": "manufacture"} with data.rbac.authz.acl as acl
allow with input as {"user": ["manufacture_group_kpi_editor"], "action": "edit", "object": "manufacture"} with data.rbac.authz.acl as acl
}
test_project_leader {
allow with input as {"user": ["project_leader"], "action": "view_all", "object": "design"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["project_leader"], "action": "edit", "object": "design"} with data.rbac.authz.acl as acl
allow with input as {"user": ["project_leader"], "action": "view_all", "object": "system"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["project_leader"], "action": "edit", "object": "system"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["project_leader"], "action": "view_all", "object": "manufacture"} with data.rbac.authz.acl as acl
not allow with input as {"user": ["project_leader"], "action": "edit", "object": "manufacture"} with data.rbac.authz.acl as acl
allow with input as {"user": ["project_leader"], "action": "view_l3_project", "object": "manufacture"} with data.rbac.authz.acl as acl
}
test_design_group_kpi_editor_and_system_group_kpi_editor {
allow with input as {"user": ["design_group_kpi_editor", "system_group_kpi_editor"], "action": "edit", "object": "design"} with data.rbac.authz.acl as acl
allow with input as {"user": ["design_group_kpi_editor", "system_group_kpi_editor"], "action": "edit", "object": "system"} with data.rbac.authz.acl as acl
}