@alauda/doom 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,19 +22,25 @@ const RolesPermission = ({ functionResource, roleTemplates, verb, }) => {
|
|
|
22
22
|
const functionResourceName = functionResource.metadata.name;
|
|
23
23
|
const actions = functionResource.metadata.annotations['auth.cpaas.io/actions'];
|
|
24
24
|
return roleTemplates.map(({ metadata: { name }, spec: { rules } }) => {
|
|
25
|
-
const found = rules.find((r) => r.functionResourceRef
|
|
25
|
+
const found = rules.find((r) => ['*', functionResourceName].includes(r.functionResourceRef));
|
|
26
26
|
let hasPermission = false;
|
|
27
27
|
if (found) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let verbs;
|
|
29
|
+
if (actions) {
|
|
30
|
+
const actionsVerbs = actions.split(',');
|
|
31
|
+
if (found.verbs.includes('*')) {
|
|
32
|
+
verbs = actionsVerbs;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
verbs = intersection(found.verbs, actionsVerbs);
|
|
36
|
+
}
|
|
30
37
|
}
|
|
31
38
|
else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
39
|
+
verbs = found.verbs;
|
|
40
|
+
}
|
|
41
|
+
if (verbs.includes('*') ||
|
|
42
|
+
VerbsMap[verb].every((v) => verbs.includes(v))) {
|
|
43
|
+
hasPermission = true;
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
return (_jsx(X.td, { style: TEXT_CENTER_STYLE, children: hasPermission ? '✓' : '✕' }, name));
|