@tachybase/acl 1.3.52 → 1.3.54-alpha.0
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.d.ts +2 -1
- package/lib/acl.js +5 -6
- package/package.json +5 -3
package/lib/acl.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'node:events';
|
|
2
|
+
import { Context } from '@tachybase/actions';
|
|
2
3
|
import { Toposort, ToposortOptions } from '@tachybase/utils';
|
|
3
4
|
import { ACLAvailableAction, AvailableActionOptions } from './acl-available-action';
|
|
4
5
|
import { ACLAvailableStrategy, AvailableStrategyOptions } from './acl-available-strategy';
|
|
@@ -105,7 +106,7 @@ export declare class ACL extends EventEmitter {
|
|
|
105
106
|
/**
|
|
106
107
|
* @internal
|
|
107
108
|
*/
|
|
108
|
-
parseJsonTemplate(json: any, ctx:
|
|
109
|
+
parseJsonTemplate(json: any, ctx: Context): Promise<any>;
|
|
109
110
|
middleware(): (ctx: any, next: any) => Promise<any>;
|
|
110
111
|
/**
|
|
111
112
|
* @internal
|
package/lib/acl.js
CHANGED
|
@@ -280,7 +280,7 @@ const _ACL = class _ACL extends import_node_events.default {
|
|
|
280
280
|
const roleName = ctx.state.currentRole || "anonymous";
|
|
281
281
|
const { resourceName: rawResourceName, actionName } = ctx.action;
|
|
282
282
|
let resourceName = rawResourceName;
|
|
283
|
-
if (rawResourceName.includes(".")) {
|
|
283
|
+
if (rawResourceName == null ? void 0 : rawResourceName.includes(".")) {
|
|
284
284
|
resourceName = rawResourceName.split(".").pop();
|
|
285
285
|
}
|
|
286
286
|
if (ctx.getCurrentRepository) {
|
|
@@ -308,7 +308,7 @@ const _ACL = class _ACL extends import_node_events.default {
|
|
|
308
308
|
const roleName = ctx.state.currentRole || "anonymous";
|
|
309
309
|
const { resourceName: rawResourceName, actionName } = ctx.action;
|
|
310
310
|
let resourceName = rawResourceName;
|
|
311
|
-
if (rawResourceName.includes(".")) {
|
|
311
|
+
if (rawResourceName == null ? void 0 : rawResourceName.includes(".")) {
|
|
312
312
|
resourceName = rawResourceName.split(".").pop();
|
|
313
313
|
}
|
|
314
314
|
if (ctx.getCurrentRepository) {
|
|
@@ -357,18 +357,17 @@ const _ACL = class _ACL extends import_node_events.default {
|
|
|
357
357
|
const resourcerAction = ctx.action;
|
|
358
358
|
const { resourceName, actionName } = ctx.permission;
|
|
359
359
|
const permission = ctx.permission;
|
|
360
|
-
(
|
|
360
|
+
(_a = ctx.logger) == null ? void 0 : _a.info("ctx permission", permission);
|
|
361
361
|
if ((!permission.can || typeof permission.can !== "object") && !permission.skip) {
|
|
362
362
|
ctx.throw(403, "No permissions");
|
|
363
|
-
return;
|
|
364
363
|
}
|
|
365
364
|
const params = ((_b = permission.can) == null ? void 0 : _b.params) || acl.fixedParamsManager.getParams(resourceName, actionName);
|
|
366
|
-
(
|
|
365
|
+
(_c = ctx.logger) == null ? void 0 : _c.info("acl params", params);
|
|
367
366
|
if (params && resourcerAction.mergeParams) {
|
|
368
367
|
const filteredParams = acl.filterParams(ctx, resourceName, params);
|
|
369
368
|
const parsedParams = await acl.parseJsonTemplate(filteredParams, ctx);
|
|
370
369
|
ctx.permission.parsedParams = parsedParams;
|
|
371
|
-
(
|
|
370
|
+
(_d = ctx.logger) == null ? void 0 : _d.info("acl parsedParams", parsedParams);
|
|
372
371
|
ctx.permission.rawParams = import_lodash.default.cloneDeep(resourcerAction.params);
|
|
373
372
|
resourcerAction.mergeParams(parsedParams, {
|
|
374
373
|
appends: /* @__PURE__ */ __name((x, y) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/acl",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.54-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,11 +9,13 @@
|
|
|
9
9
|
"koa-compose": "^4.1.0",
|
|
10
10
|
"lodash": "4.17.21",
|
|
11
11
|
"minimatch": "^5.1.6",
|
|
12
|
-
"@tachybase/
|
|
13
|
-
"@tachybase/utils": "1.3.
|
|
12
|
+
"@tachybase/actions": "1.3.54-alpha.0",
|
|
13
|
+
"@tachybase/utils": "1.3.54-alpha.0",
|
|
14
|
+
"@tachybase/resourcer": "1.3.54-alpha.0"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
17
|
"@types/lodash": "4.17.20",
|
|
18
|
+
"@types/minimatch": "^6.0.0",
|
|
17
19
|
"@types/node": "20.17.10"
|
|
18
20
|
}
|
|
19
21
|
}
|