@nocobase/plugin-acl 1.7.8 → 1.7.10
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": "1.7.
|
|
11
|
+
"@nocobase/client": "1.7.10",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-i18next": "11.18.6",
|
|
@@ -17,14 +17,14 @@ module.exports = {
|
|
|
17
17
|
"@formily/react": "2.3.0",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"@nocobase/utils": "1.7.
|
|
21
|
-
"@nocobase/actions": "1.7.
|
|
22
|
-
"@nocobase/cache": "1.7.
|
|
23
|
-
"@nocobase/database": "1.7.
|
|
24
|
-
"@nocobase/server": "1.7.
|
|
25
|
-
"@nocobase/test": "1.7.
|
|
20
|
+
"@nocobase/utils": "1.7.10",
|
|
21
|
+
"@nocobase/actions": "1.7.10",
|
|
22
|
+
"@nocobase/cache": "1.7.10",
|
|
23
|
+
"@nocobase/database": "1.7.10",
|
|
24
|
+
"@nocobase/server": "1.7.10",
|
|
25
|
+
"@nocobase/test": "1.7.10",
|
|
26
26
|
"@formily/core": "2.3.0",
|
|
27
27
|
"@formily/antd-v5": "1.2.3",
|
|
28
28
|
"antd-style": "3.7.1",
|
|
29
|
-
"@nocobase/acl": "1.7.
|
|
29
|
+
"@nocobase/acl": "1.7.10"
|
|
30
30
|
};
|
|
@@ -44,7 +44,7 @@ var import_database = require("@nocobase/database");
|
|
|
44
44
|
var import_acl = require("@nocobase/acl");
|
|
45
45
|
function createWithACLMetaMiddleware() {
|
|
46
46
|
return async (ctx, next) => {
|
|
47
|
-
var _a, _b, _c, _d
|
|
47
|
+
var _a, _b, _c, _d;
|
|
48
48
|
await next();
|
|
49
49
|
const dataSourceKey = ctx.get("x-data-source");
|
|
50
50
|
const dataSource = ctx.app.dataSourceManager.dataSources.get(dataSourceKey);
|
|
@@ -64,11 +64,11 @@ function createWithACLMetaMiddleware() {
|
|
|
64
64
|
if (!collection) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const Model = collection.model;
|
|
68
68
|
if (collection.isMultiFilterTargetKey()) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const primaryKeyField =
|
|
71
|
+
const primaryKeyField = Model.primaryKeyField || Model.primaryKeyAttribute;
|
|
72
72
|
let listData;
|
|
73
73
|
if ((_a = ctx.body) == null ? void 0 : _a.data) {
|
|
74
74
|
listData = ctx.data;
|
|
@@ -164,15 +164,8 @@ function createWithACLMetaMiddleware() {
|
|
|
164
164
|
...params,
|
|
165
165
|
context: actionCtx
|
|
166
166
|
});
|
|
167
|
-
if (((_f = (_e = ctx.action) == null ? void 0 : _e.params) == null ? void 0 : _f.appends) || (queryParams == null ? void 0 : queryParams.appends)) {
|
|
168
|
-
const queryParamsWithAppends = (queryParams == null ? void 0 : queryParams.appends) || [];
|
|
169
|
-
const ctxActionParamsWithAppends = ((_h = (_g = ctx.action) == null ? void 0 : _g.params) == null ? void 0 : _h.appends) || [];
|
|
170
|
-
const appends = queryParamsWithAppends.filter((x) => ctxActionParamsWithAppends.includes(x));
|
|
171
|
-
queryParams.include = appends;
|
|
172
|
-
queryParams.appends = appends;
|
|
173
|
-
}
|
|
174
167
|
const actionSql = ctx.db.sequelize.queryInterface.queryGenerator.selectQuery(
|
|
175
|
-
|
|
168
|
+
Model.getTableName(),
|
|
176
169
|
{
|
|
177
170
|
where: (() => {
|
|
178
171
|
const filterObj = queryParams.where;
|
|
@@ -221,7 +214,7 @@ function createWithACLMetaMiddleware() {
|
|
|
221
214
|
attributes: [primaryKeyField],
|
|
222
215
|
includeIgnoreAttributes: false
|
|
223
216
|
},
|
|
224
|
-
|
|
217
|
+
Model
|
|
225
218
|
);
|
|
226
219
|
const whereCaseMatch = actionSql.match(/WHERE (.*?);/);
|
|
227
220
|
if (!whereCaseMatch) {
|
|
@@ -239,7 +232,6 @@ function createWithACLMetaMiddleware() {
|
|
|
239
232
|
});
|
|
240
233
|
}
|
|
241
234
|
}
|
|
242
|
-
const includes = conditions.map((c) => c.include).flat().map((x) => processIncludes(collection.model, x || []));
|
|
243
235
|
const results = await collection.model.findAll({
|
|
244
236
|
where: {
|
|
245
237
|
[primaryKeyField]: ids
|
|
@@ -250,7 +242,7 @@ function createWithACLMetaMiddleware() {
|
|
|
250
242
|
return [ctx.db.sequelize.literal(`CASE WHEN ${condition.whereCase} THEN 1 ELSE 0 END`), condition.action];
|
|
251
243
|
})
|
|
252
244
|
],
|
|
253
|
-
include:
|
|
245
|
+
include: conditions.map((condition) => condition.include).flat(),
|
|
254
246
|
raw: true
|
|
255
247
|
});
|
|
256
248
|
const allowedActions = inspectActions.map((action) => {
|
|
@@ -275,19 +267,6 @@ function createWithACLMetaMiddleware() {
|
|
|
275
267
|
}
|
|
276
268
|
};
|
|
277
269
|
}
|
|
278
|
-
function processIncludes(model, include) {
|
|
279
|
-
const association = model.associations[include];
|
|
280
|
-
if (association == null ? void 0 : association["generateInclude"]) {
|
|
281
|
-
const newInclude = {
|
|
282
|
-
association: include,
|
|
283
|
-
attributes: [],
|
|
284
|
-
// out put empty fields by default
|
|
285
|
-
...association["generateInclude"]()
|
|
286
|
-
};
|
|
287
|
-
return newInclude;
|
|
288
|
-
}
|
|
289
|
-
return include;
|
|
290
|
-
}
|
|
291
270
|
// Annotate the CommonJS export names for ESM import in node:
|
|
292
271
|
0 && (module.exports = {
|
|
293
272
|
createWithACLMetaMiddleware
|
package/dist/server/server.js
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "权限控制",
|
|
5
5
|
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
6
6
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
7
|
-
"version": "1.7.
|
|
7
|
+
"version": "1.7.10",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
34
34
|
"directory": "packages/plugins/acl"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "762643285b5a1176aeea3b16b917ee7c1fcef23a"
|
|
37
37
|
}
|