@dnax/core 0.13.0 → 0.13.3
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.
- package/lib/permissions.ts +9 -4
- package/package.json +1 -1
package/lib/permissions.ts
CHANGED
|
@@ -15,7 +15,7 @@ async function loadPermissions() {
|
|
|
15
15
|
let permissions: permissionSchema[] = [];
|
|
16
16
|
if (Cfg.tenants) {
|
|
17
17
|
for await (let t of Cfg.tenants) {
|
|
18
|
-
let tenantPath = `${t.dir}/permissions/**/**.
|
|
18
|
+
let tenantPath = `${t.dir}/permissions/**/**.rabc.{ts,js}`;
|
|
19
19
|
const glob = new Glob(tenantPath);
|
|
20
20
|
for await (let file of glob.scan({
|
|
21
21
|
cwd: Cfg.cwd,
|
|
@@ -61,16 +61,21 @@ function checkPermission(
|
|
|
61
61
|
|
|
62
62
|
// 1- Check if all connection
|
|
63
63
|
let findAsterixCollection = perm?.access?.find((c) =>
|
|
64
|
-
c
|
|
64
|
+
c?.collections?.includes("*")
|
|
65
65
|
);
|
|
66
|
+
|
|
66
67
|
if (findAsterixCollection) {
|
|
67
|
-
|
|
68
|
+
// super root actions all All
|
|
69
|
+
let actionsOnAll = findAsterixCollection.actions.find(
|
|
70
|
+
(a) => a === action || a === "allAction" || a === "*"
|
|
71
|
+
);
|
|
68
72
|
actionsOnAll ? (approved = true) : (approved = false);
|
|
73
|
+
if (approved) return true;
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
// 2- Check if collection and action
|
|
72
77
|
let findCollection = perm?.access?.find((c) =>
|
|
73
|
-
c
|
|
78
|
+
c?.collections?.includes(collection)
|
|
74
79
|
);
|
|
75
80
|
if (findCollection) {
|
|
76
81
|
let actionsOnCollection = findCollection.actions.find((a) => a === action);
|