@nocobase/plugin-acl 2.1.0-beta.47 → 2.1.0-beta.48
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/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.48",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-i18next": "11.18.6",
|
|
@@ -17,15 +17,15 @@ module.exports = {
|
|
|
17
17
|
"@formily/react": "2.3.7",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
19
|
"lodash": "4.18.1",
|
|
20
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
21
|
-
"@nocobase/flow-engine": "2.1.0-beta.
|
|
22
|
-
"@nocobase/client-v2": "2.1.0-beta.
|
|
23
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
24
|
-
"@nocobase/cache": "2.1.0-beta.
|
|
25
|
-
"@nocobase/database": "2.1.0-beta.
|
|
26
|
-
"@nocobase/server": "2.1.0-beta.
|
|
27
|
-
"@nocobase/acl": "2.1.0-beta.
|
|
28
|
-
"@nocobase/test": "2.1.0-beta.
|
|
20
|
+
"@nocobase/utils": "2.1.0-beta.48",
|
|
21
|
+
"@nocobase/flow-engine": "2.1.0-beta.48",
|
|
22
|
+
"@nocobase/client-v2": "2.1.0-beta.48",
|
|
23
|
+
"@nocobase/actions": "2.1.0-beta.48",
|
|
24
|
+
"@nocobase/cache": "2.1.0-beta.48",
|
|
25
|
+
"@nocobase/database": "2.1.0-beta.48",
|
|
26
|
+
"@nocobase/server": "2.1.0-beta.48",
|
|
27
|
+
"@nocobase/acl": "2.1.0-beta.48",
|
|
28
|
+
"@nocobase/test": "2.1.0-beta.48",
|
|
29
29
|
"@formily/core": "2.3.7",
|
|
30
30
|
"@formily/antd-v5": "1.2.3",
|
|
31
31
|
"antd-style": "3.7.1",
|
package/dist/server/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export * from './middlewares/setCurrentRole';
|
|
10
10
|
export * from './middlewares/with-acl-meta';
|
|
11
|
+
export * from './middlewares/check-association-operate';
|
|
12
|
+
export * from './middlewares/check-change-with-association';
|
|
11
13
|
export * from './query/apply-query-permission';
|
|
12
14
|
export { RoleResourceActionModel } from './model/RoleResourceActionModel';
|
|
13
15
|
export { RoleResourceModel } from './model/RoleResourceModel';
|
package/dist/server/index.js
CHANGED
|
@@ -44,6 +44,8 @@ __export(server_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(server_exports);
|
|
45
45
|
__reExport(server_exports, require("./middlewares/setCurrentRole"), module.exports);
|
|
46
46
|
__reExport(server_exports, require("./middlewares/with-acl-meta"), module.exports);
|
|
47
|
+
__reExport(server_exports, require("./middlewares/check-association-operate"), module.exports);
|
|
48
|
+
__reExport(server_exports, require("./middlewares/check-change-with-association"), module.exports);
|
|
47
49
|
__reExport(server_exports, require("./query/apply-query-permission"), module.exports);
|
|
48
50
|
var import_RoleResourceActionModel = require("./model/RoleResourceActionModel");
|
|
49
51
|
var import_RoleResourceModel = require("./model/RoleResourceModel");
|
|
@@ -56,6 +58,8 @@ var import_server = __toESM(require("./server"));
|
|
|
56
58
|
RoleResourceModel,
|
|
57
59
|
...require("./middlewares/setCurrentRole"),
|
|
58
60
|
...require("./middlewares/with-acl-meta"),
|
|
61
|
+
...require("./middlewares/check-association-operate"),
|
|
62
|
+
...require("./middlewares/check-change-with-association"),
|
|
59
63
|
...require("./query/apply-query-permission"),
|
|
60
64
|
...require("./constants"),
|
|
61
65
|
...require("./enum")
|
|
@@ -31,16 +31,19 @@ __export(check_association_operate_exports, {
|
|
|
31
31
|
module.exports = __toCommonJS(check_association_operate_exports);
|
|
32
32
|
var import_acl = require("@nocobase/acl");
|
|
33
33
|
async function checkAssociationOperate(ctx, next) {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
35
35
|
const { actionName, resourceName, sourceId } = ctx.action;
|
|
36
36
|
if (!(resourceName.includes(".") && ["add", "set", "remove", "toggle"].includes(actionName))) {
|
|
37
37
|
return next();
|
|
38
38
|
}
|
|
39
|
+
if ((_a = ctx.permission) == null ? void 0 : _a.skip) {
|
|
40
|
+
return next();
|
|
41
|
+
}
|
|
39
42
|
const acl = ctx.acl;
|
|
40
43
|
const roles = ctx.state.currentRoles;
|
|
41
44
|
for (const role of roles) {
|
|
42
45
|
const aclRole = acl.getRole(role);
|
|
43
|
-
if (aclRole.snippetAllowed(`${resourceName}:${actionName}`)) {
|
|
46
|
+
if (aclRole == null ? void 0 : aclRole.snippetAllowed(`${resourceName}:${actionName}`)) {
|
|
44
47
|
return next();
|
|
45
48
|
}
|
|
46
49
|
}
|
|
@@ -54,20 +57,20 @@ async function checkAssociationOperate(ctx, next) {
|
|
|
54
57
|
ctx.throw(403, "No permissions");
|
|
55
58
|
}
|
|
56
59
|
const params = result.params || ctx.acl.fixedParamsManager.getParams(resourceName, actionName);
|
|
57
|
-
if (params.whitelist && !((
|
|
60
|
+
if (params.whitelist && !((_b = params.whitelist) == null ? void 0 : _b.includes(association))) {
|
|
58
61
|
ctx.throw(403, "No permissions");
|
|
59
62
|
}
|
|
60
63
|
if (params.filter) {
|
|
61
64
|
try {
|
|
62
|
-
const timezone = ((
|
|
63
|
-
const collection = (
|
|
65
|
+
const timezone = ((_d = (_c = ctx.request) == null ? void 0 : _c.get) == null ? void 0 : _d.call(_c, "x-timezone")) ?? ((_f = (_e = ctx.request) == null ? void 0 : _e.header) == null ? void 0 : _f["x-timezone"]) ?? ((_h = (_g = ctx.req) == null ? void 0 : _g.headers) == null ? void 0 : _h["x-timezone"]);
|
|
66
|
+
const collection = (_j = (_i = ctx.database) == null ? void 0 : _i.getCollection) == null ? void 0 : _j.call(_i, resource);
|
|
64
67
|
(0, import_acl.checkFilterParams)(collection, params.filter);
|
|
65
68
|
const parsedFilter = await (0, import_acl.parseJsonTemplate)(params.filter, {
|
|
66
69
|
state: ctx.state,
|
|
67
70
|
timezone,
|
|
68
71
|
userProvider: (0, import_acl.createUserProvider)({
|
|
69
72
|
db: ctx.db,
|
|
70
|
-
currentUser: (
|
|
73
|
+
currentUser: (_k = ctx.state) == null ? void 0 : _k.currentUser
|
|
71
74
|
})
|
|
72
75
|
});
|
|
73
76
|
const repo = ctx.database.getRepository(resource);
|
|
@@ -52,7 +52,7 @@ function createWithACLMetaMiddleware() {
|
|
|
52
52
|
const dataSourceKey = ctx.get("x-data-source");
|
|
53
53
|
const dataSource = ctx.app.dataSourceManager.dataSources.get(dataSourceKey);
|
|
54
54
|
const db = dataSource ? dataSource.collectionManager.db : ctx.db;
|
|
55
|
-
if (!db) {
|
|
55
|
+
if (!db || db.isDBInstance === false) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
const acl = dataSource ? dataSource.acl : ctx.app.acl;
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
7
7
|
"description.ru-RU": "На основе ролей, ресурсов и действий система контроля доступа может точно управлять разрешениями на изменение интерфейса, работу с данными, доступ к меню и разрешениями для подключаемых модулей.",
|
|
8
8
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
9
|
-
"version": "2.1.0-beta.
|
|
9
|
+
"version": "2.1.0-beta.48",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
47
47
|
"directory": "packages/plugins/acl"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "f8c27a286db015c5e433b48241f14c0412e50530"
|
|
50
50
|
}
|