@nocobase/acl 2.0.0-alpha.52 → 2.0.0-alpha.54
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/acl.js +7 -0
- package/lib/snippet-manager.js +6 -1
- package/package.json +4 -4
package/lib/acl.js
CHANGED
|
@@ -196,6 +196,13 @@ const _ACL = class _ACL extends import_events.default {
|
|
|
196
196
|
if (!aclRole) {
|
|
197
197
|
return null;
|
|
198
198
|
}
|
|
199
|
+
if (role === "root") {
|
|
200
|
+
return {
|
|
201
|
+
resource,
|
|
202
|
+
action,
|
|
203
|
+
role
|
|
204
|
+
};
|
|
205
|
+
}
|
|
199
206
|
const actionPath = `${rawResourceName ? rawResourceName : resource}:${action}`;
|
|
200
207
|
const snippetAllowed = aclRole.snippetAllowed(actionPath);
|
|
201
208
|
const fixedParams = this.fixedParamsManager.getParams(rawResourceName ? rawResourceName : resource, action);
|
package/lib/snippet-manager.js
CHANGED
|
@@ -56,7 +56,12 @@ const _SnippetManager = class _SnippetManager {
|
|
|
56
56
|
if (snippet.name.includes("*") || snippet.name.endsWith(".")) {
|
|
57
57
|
throw new Error(`Invalid snippet name: ${snippet.name}, name should not include * or end with dot.`);
|
|
58
58
|
}
|
|
59
|
-
this.snippets.
|
|
59
|
+
const existed = this.snippets.get(snippet.name);
|
|
60
|
+
if (existed) {
|
|
61
|
+
existed.actions = Array.from(/* @__PURE__ */ new Set([...existed.actions, ...snippet.actions]));
|
|
62
|
+
} else {
|
|
63
|
+
this.snippets.set(snippet.name, snippet);
|
|
64
|
+
}
|
|
60
65
|
}
|
|
61
66
|
allow(actionPath, snippetName) {
|
|
62
67
|
const negated = snippetName.startsWith("!");
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/acl",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.54",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/resourcer": "2.0.0-alpha.
|
|
10
|
-
"@nocobase/utils": "2.0.0-alpha.
|
|
9
|
+
"@nocobase/resourcer": "2.0.0-alpha.54",
|
|
10
|
+
"@nocobase/utils": "2.0.0-alpha.54",
|
|
11
11
|
"minimatch": "^5.1.1"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
16
16
|
"directory": "packages/acl"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "68c84deaabba0ebec7407bf7245376b8d843449c"
|
|
19
19
|
}
|