-
Notifications
You must be signed in to change notification settings - Fork 0
/
configs.ts
46 lines (38 loc) · 837 Bytes
/
configs.ts
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
const model = `
# Request definition
[request_definition]
# Can subject, do_action, on_object
r = sub, act, obj
# Policy definition
[policy_definition]
p = sub, act, obj
# Role definition
[role_definition]
g = _, _
# Policy effect
[policy_effect]
e = some(where (p.eft == allow))
# Matchers
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
`;
const policy = [
["p", "cat", "walk", "ground"],
["p", "cat", "run", "ground"],
["p", "cat", "swim", "water"],
["p", "cat", "breathe", "air"],
["p", "bird", "fly", "air"],
["p", "bird", "breathe", "air"],
["p", "bird", "walk", "ground"],
["p", "fish", "swim", "water"],
["p", "fish", "breathe", "water"],
];
/**
* backend response imitation
*/
export const getPermissionsFromBackend = async () => {
return {
m: model,
p: policy,
};
};