@nocobase/plugin-acl 1.9.0-beta.5 → 1.9.0-beta.7
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.9.0-beta.
|
|
11
|
+
"@nocobase/client": "1.9.0-beta.7",
|
|
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.9.0-beta.
|
|
21
|
-
"@nocobase/actions": "1.9.0-beta.
|
|
22
|
-
"@nocobase/cache": "1.9.0-beta.
|
|
23
|
-
"@nocobase/database": "1.9.0-beta.
|
|
24
|
-
"@nocobase/server": "1.9.0-beta.
|
|
25
|
-
"@nocobase/test": "1.9.0-beta.
|
|
20
|
+
"@nocobase/utils": "1.9.0-beta.7",
|
|
21
|
+
"@nocobase/actions": "1.9.0-beta.7",
|
|
22
|
+
"@nocobase/cache": "1.9.0-beta.7",
|
|
23
|
+
"@nocobase/database": "1.9.0-beta.7",
|
|
24
|
+
"@nocobase/server": "1.9.0-beta.7",
|
|
25
|
+
"@nocobase/test": "1.9.0-beta.7",
|
|
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.9.0-beta.
|
|
29
|
+
"@nocobase/acl": "1.9.0-beta.7"
|
|
30
30
|
};
|
|
@@ -39,13 +39,16 @@ __export(with_acl_meta_exports, {
|
|
|
39
39
|
createWithACLMetaMiddleware: () => createWithACLMetaMiddleware
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(with_acl_meta_exports);
|
|
42
|
-
var import_lodash = __toESM(require("lodash"));
|
|
43
|
-
var import_database = require("@nocobase/database");
|
|
44
42
|
var import_acl = require("@nocobase/acl");
|
|
43
|
+
var import_database = require("@nocobase/database");
|
|
44
|
+
var import_lodash = __toESM(require("lodash"));
|
|
45
45
|
function createWithACLMetaMiddleware() {
|
|
46
46
|
return async (ctx, next) => {
|
|
47
47
|
var _a, _b, _c, _d;
|
|
48
48
|
await next();
|
|
49
|
+
if (process.env.DISABLE_ACL_META === "true" || process.env.DISABLE_ACL_META === "1") {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
49
52
|
const dataSourceKey = ctx.get("x-data-source");
|
|
50
53
|
const dataSource = ctx.app.dataSourceManager.dataSources.get(dataSourceKey);
|
|
51
54
|
const db = dataSource ? dataSource.collectionManager.db : ctx.db;
|
|
@@ -164,6 +167,9 @@ function createWithACLMetaMiddleware() {
|
|
|
164
167
|
...params,
|
|
165
168
|
context: actionCtx
|
|
166
169
|
});
|
|
170
|
+
const include = (0, import_database.filterIncludes)(queryParams.where, queryParams.include || [], {
|
|
171
|
+
underscored: db.options.underscored
|
|
172
|
+
});
|
|
167
173
|
const actionSql = ctx.db.sequelize.queryInterface.queryGenerator.selectQuery(
|
|
168
174
|
Model.getTableName(),
|
|
169
175
|
{
|
|
@@ -221,17 +227,18 @@ function createWithACLMetaMiddleware() {
|
|
|
221
227
|
conditions.push({
|
|
222
228
|
whereCase: "1=1",
|
|
223
229
|
action,
|
|
224
|
-
include:
|
|
230
|
+
include: []
|
|
225
231
|
});
|
|
226
232
|
} else {
|
|
227
233
|
const whereCase = actionSql.match(/WHERE (.*?);/)[1];
|
|
228
234
|
conditions.push({
|
|
229
235
|
whereCase,
|
|
230
236
|
action,
|
|
231
|
-
include
|
|
237
|
+
include
|
|
232
238
|
});
|
|
233
239
|
}
|
|
234
240
|
}
|
|
241
|
+
const finalIncludes = (0, import_database.mergeIncludes)(conditions.map((condition) => condition.include || []).flat());
|
|
235
242
|
const results = await collection.model.findAll({
|
|
236
243
|
where: {
|
|
237
244
|
[primaryKeyField]: ids
|
|
@@ -242,7 +249,7 @@ function createWithACLMetaMiddleware() {
|
|
|
242
249
|
return [ctx.db.sequelize.literal(`CASE WHEN ${condition.whereCase} THEN 1 ELSE 0 END`), condition.action];
|
|
243
250
|
})
|
|
244
251
|
],
|
|
245
|
-
include:
|
|
252
|
+
include: finalIncludes,
|
|
246
253
|
raw: true
|
|
247
254
|
});
|
|
248
255
|
const allowedActions = inspectActions.map((action) => {
|
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.9.0-beta.
|
|
7
|
+
"version": "1.9.0-beta.7",
|
|
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": "4a5055c973b51611d5db1604aaaf6c1b73b4733c"
|
|
37
37
|
}
|