vona-module-a-rbac 5.0.1
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/LICENSE +21 -0
- package/dist/.metadata/index.d.ts +110 -0
- package/dist/.metadata/index.d.ts.map +1 -0
- package/dist/.metadata/this.d.ts +3 -0
- package/dist/.metadata/this.d.ts.map +1 -0
- package/dist/bean/bean.rbacCatalog.d.ts +13 -0
- package/dist/bean/bean.rbacCatalog.d.ts.map +1 -0
- package/dist/bean/bean.rbacScope.d.ts +19 -0
- package/dist/bean/bean.rbacScope.d.ts.map +1 -0
- package/dist/bean/event.policyInvalidated.d.ts +11 -0
- package/dist/bean/event.policyInvalidated.d.ts.map +1 -0
- package/dist/bean/event.resolvePolicy.d.ts +7 -0
- package/dist/bean/event.resolvePolicy.d.ts.map +1 -0
- package/dist/bean/guard.rbac.d.ts +17 -0
- package/dist/bean/guard.rbac.d.ts.map +1 -0
- package/dist/bean/index.d.ts +6 -0
- package/dist/bean/index.d.ts.map +1 -0
- package/dist/config/config.d.ts +8 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +365 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/rbac.d.ts +12 -0
- package/dist/lib/rbac.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/rbac.d.ts +37 -0
- package/dist/types/rbac.d.ts.map +1 -0
- package/dist/types/scope.d.ts +21 -0
- package/dist/types/scope.d.ts.map +1 -0
- package/package.json +46 -0
- package/src/.metadata/index.ts +147 -0
- package/src/.metadata/this.ts +2 -0
- package/src/bean/bean.rbacCatalog.ts +95 -0
- package/src/bean/bean.rbacScope.ts +218 -0
- package/src/bean/event.policyInvalidated.ts +17 -0
- package/src/bean/event.resolvePolicy.ts +13 -0
- package/src/bean/guard.rbac.ts +102 -0
- package/src/bean/index.ts +5 -0
- package/src/config/config.ts +10 -0
- package/src/index.ts +3 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/rbac.ts +46 -0
- package/src/types/index.ts +2 -0
- package/src/types/rbac.ts +46 -0
- package/src/types/scope.ts +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-present Cabloy/Vona/Zova
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** guard: begin */
|
|
2
|
+
export * from '../bean/guard.rbac.ts';
|
|
3
|
+
import type { IGuardOptionsRbac } from '../bean/guard.rbac.ts';
|
|
4
|
+
import 'vona-module-a-aspect';
|
|
5
|
+
declare module 'vona-module-a-aspect' {
|
|
6
|
+
interface IGuardRecordLocal {
|
|
7
|
+
'a-rbac:rbac': IGuardOptionsRbac;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
declare module 'vona-module-a-rbac' {
|
|
11
|
+
interface GuardRbac {
|
|
12
|
+
}
|
|
13
|
+
interface GuardRbac {
|
|
14
|
+
get $beanFullName(): 'a-rbac.guard.rbac';
|
|
15
|
+
get $onionName(): 'a-rbac:rbac';
|
|
16
|
+
get $onionOptions(): IGuardOptionsRbac;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** guard: end */
|
|
20
|
+
/** bean: begin */
|
|
21
|
+
export * from '../bean/bean.rbacCatalog.ts';
|
|
22
|
+
export * from '../bean/bean.rbacScope.ts';
|
|
23
|
+
import 'vona';
|
|
24
|
+
declare module 'vona' {
|
|
25
|
+
}
|
|
26
|
+
declare module 'vona-module-a-rbac' {
|
|
27
|
+
interface BeanRbacCatalog {
|
|
28
|
+
}
|
|
29
|
+
interface BeanRbacScope {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** bean: end */
|
|
33
|
+
/** bean: begin */
|
|
34
|
+
import type { BeanRbacCatalog } from '../bean/bean.rbacCatalog.ts';
|
|
35
|
+
import type { BeanRbacScope } from '../bean/bean.rbacScope.ts';
|
|
36
|
+
import 'vona';
|
|
37
|
+
declare module 'vona' {
|
|
38
|
+
interface IBeanRecordGlobal {
|
|
39
|
+
'rbacCatalog': BeanRbacCatalog;
|
|
40
|
+
'rbacScope': BeanRbacScope;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** bean: end */
|
|
44
|
+
/** event: begin */
|
|
45
|
+
export * from '../bean/event.policyInvalidated.ts';
|
|
46
|
+
export * from '../bean/event.resolvePolicy.ts';
|
|
47
|
+
import 'vona';
|
|
48
|
+
declare module 'vona' {
|
|
49
|
+
}
|
|
50
|
+
declare module 'vona-module-a-rbac' {
|
|
51
|
+
interface EventPolicyInvalidated {
|
|
52
|
+
}
|
|
53
|
+
interface EventPolicyInvalidated {
|
|
54
|
+
get $beanFullName(): 'a-rbac.event.policyInvalidated';
|
|
55
|
+
get $onionName(): 'a-rbac:policyInvalidated';
|
|
56
|
+
}
|
|
57
|
+
interface EventResolvePolicy {
|
|
58
|
+
}
|
|
59
|
+
interface EventResolvePolicy {
|
|
60
|
+
get $beanFullName(): 'a-rbac.event.resolvePolicy';
|
|
61
|
+
get $onionName(): 'a-rbac:resolvePolicy';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** event: end */
|
|
65
|
+
/** event: begin */
|
|
66
|
+
import type { EventPolicyInvalidated } from '../bean/event.policyInvalidated.ts';
|
|
67
|
+
import type { EventResolvePolicy } from '../bean/event.resolvePolicy.ts';
|
|
68
|
+
export interface IModuleEvent {
|
|
69
|
+
'policyInvalidated': EventPolicyInvalidated;
|
|
70
|
+
'resolvePolicy': EventResolvePolicy;
|
|
71
|
+
}
|
|
72
|
+
/** event: end */
|
|
73
|
+
/** event: begin */
|
|
74
|
+
import type { TypeEventPolicyInvalidatedData, TypeEventPolicyInvalidatedResult } from '../bean/event.policyInvalidated.ts';
|
|
75
|
+
import type { TypeEventResolvePolicyData, TypeEventResolvePolicyResult } from '../bean/event.resolvePolicy.ts';
|
|
76
|
+
import type { EventOn } from 'vona-module-a-event';
|
|
77
|
+
declare module 'vona-module-a-event' {
|
|
78
|
+
interface IEventRecord {
|
|
79
|
+
'a-rbac:policyInvalidated': EventOn<TypeEventPolicyInvalidatedData, TypeEventPolicyInvalidatedResult>;
|
|
80
|
+
'a-rbac:resolvePolicy': EventOn<TypeEventResolvePolicyData, TypeEventResolvePolicyResult>;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** event: end */
|
|
84
|
+
/** config: begin */
|
|
85
|
+
export * from '../config/config.ts';
|
|
86
|
+
import type { config } from '../config/config.ts';
|
|
87
|
+
/** config: end */
|
|
88
|
+
/** scope: begin */
|
|
89
|
+
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig } from 'vona';
|
|
90
|
+
export declare class ScopeModuleARbac extends BeanScopeBase {
|
|
91
|
+
}
|
|
92
|
+
export interface ScopeModuleARbac {
|
|
93
|
+
util: BeanScopeUtil;
|
|
94
|
+
config: TypeModuleConfig<typeof config>;
|
|
95
|
+
event: IModuleEvent;
|
|
96
|
+
}
|
|
97
|
+
import 'vona';
|
|
98
|
+
declare module 'vona' {
|
|
99
|
+
interface IBeanScopeRecord {
|
|
100
|
+
'a-rbac': ScopeModuleARbac;
|
|
101
|
+
}
|
|
102
|
+
interface IBeanScopeContainer {
|
|
103
|
+
rbac: ScopeModuleARbac;
|
|
104
|
+
}
|
|
105
|
+
interface IBeanScopeConfig {
|
|
106
|
+
'a-rbac': ReturnType<typeof config>;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** scope: end */
|
|
110
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/.metadata/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"this.d.ts","sourceRoot":"","sources":["../../src/.metadata/this.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,OAAO,EAAE,gBAAgB,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContextRoute } from 'vona-module-a-web';
|
|
2
|
+
import { BeanBase } from 'vona';
|
|
3
|
+
import type { IRbacActionDescriptor } from '../types/rbac.ts';
|
|
4
|
+
export declare class BeanRbacCatalog extends BeanBase {
|
|
5
|
+
private _catalog;
|
|
6
|
+
getAction(route: ContextRoute): IRbacActionDescriptor | undefined;
|
|
7
|
+
getCatalog(): ReadonlyMap<string, IRbacActionDescriptor>;
|
|
8
|
+
clear(): void;
|
|
9
|
+
private createCatalog;
|
|
10
|
+
private resolveActionInherit;
|
|
11
|
+
private resolveActionInheritKey;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=bean.rbacCatalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bean.rbacCatalog.d.ts","sourceRoot":"","sources":["../../src/bean/bean.rbacCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAA6B,QAAQ,EAAE,MAAM,MAAM,CAAC;AAI3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAO9D,qBACa,eAAgB,SAAQ,QAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAiD;IAEjE,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,qBAAqB,GAAG,SAAS;IAIjE,UAAU,IAAI,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC;IAKxD,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,uBAAuB;CA2BhC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BeanBase } from 'vona';
|
|
2
|
+
import type { IRbacScopeAccess } from '../types/scope.ts';
|
|
3
|
+
export declare class BeanRbacScope extends BeanBase {
|
|
4
|
+
private _scopeAdapter;
|
|
5
|
+
isUnrestricted(): Promise<boolean>;
|
|
6
|
+
current(actionKey?: string): Promise<IRbacScopeAccess>;
|
|
7
|
+
private get scopeAdapter();
|
|
8
|
+
private prepareOwnerValues;
|
|
9
|
+
private createAccess;
|
|
10
|
+
private permissionProjection;
|
|
11
|
+
private where;
|
|
12
|
+
private scopeWhere;
|
|
13
|
+
private matches;
|
|
14
|
+
private resolveAction;
|
|
15
|
+
private isDecisionForAction;
|
|
16
|
+
private isValidTerms;
|
|
17
|
+
private termPredicates;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=bean.rbacScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bean.rbacScope.d.ts","sourceRoot":"","sources":["../../src/bean/bean.rbacScope.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAA6B,MAAM,MAAM,CAAC;AAI3D,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,mBAAmB,CAAC;AAI7E,qBACa,aAAc,SAAQ,QAAQ;IACzC,OAAO,CAAC,aAAa,CAAgC;IAE/C,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAe5D,OAAO,KAAK,YAAY,GASvB;YAEa,kBAAkB;IAgBhC,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,oBAAoB;IAgC5B,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,mBAAmB;IAe3B,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,cAAc;CAYvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BeanEventBase } from 'vona-module-a-event';
|
|
2
|
+
export type TypeRbacPolicyInvalidationKind = 'policy' | 'role' | 'scopeTopology';
|
|
3
|
+
export interface TypeEventPolicyInvalidatedData {
|
|
4
|
+
kind: TypeRbacPolicyInvalidationKind;
|
|
5
|
+
removedRoleIds?: string[];
|
|
6
|
+
removedScopeIds?: string[];
|
|
7
|
+
}
|
|
8
|
+
export type TypeEventPolicyInvalidatedResult = void;
|
|
9
|
+
export declare class EventPolicyInvalidated extends BeanEventBase<TypeEventPolicyInvalidatedData, TypeEventPolicyInvalidatedResult> {
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=event.policyInvalidated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.policyInvalidated.d.ts","sourceRoot":"","sources":["../../src/bean/event.policyInvalidated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,qBAAqB,CAAC;AAE3D,MAAM,MAAM,8BAA8B,GAAG,QAAQ,GAAG,MAAM,GAAG,eAAe,CAAC;AAEjF,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,8BAA8B,CAAC;IACrC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAEpD,qBACa,sBAAuB,SAAQ,aAAa,CACvD,8BAA8B,EAC9B,gCAAgC,CACjC;CAAG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BeanEventBase } from 'vona-module-a-event';
|
|
2
|
+
import type { IRbacPolicyDecision, IRbacPolicyRequest } from '../types/rbac.ts';
|
|
3
|
+
export type TypeEventResolvePolicyData = IRbacPolicyRequest;
|
|
4
|
+
export type TypeEventResolvePolicyResult = IRbacPolicyDecision | undefined;
|
|
5
|
+
export declare class EventResolvePolicy extends BeanEventBase<TypeEventResolvePolicyData, TypeEventResolvePolicyResult> {
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=event.resolvePolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.resolvePolicy.d.ts","sourceRoot":"","sources":["../../src/bean/event.resolvePolicy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEhF,MAAM,MAAM,0BAA0B,GAAG,kBAAkB,CAAC;AAE5D,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,GAAG,SAAS,CAAC;AAE3E,qBACa,kBAAmB,SAAQ,aAAa,CACnD,0BAA0B,EAC1B,4BAA4B,CAC7B;CAAG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IDecoratorGuardOptions } from 'vona-module-a-aspect';
|
|
2
|
+
import { GuardBase } from 'vona-module-a-aspect';
|
|
3
|
+
export interface IGuardOptionsRbac extends IDecoratorGuardOptions {
|
|
4
|
+
dataScope?: boolean;
|
|
5
|
+
dataScopeField?: string;
|
|
6
|
+
dataScopeMineField?: string;
|
|
7
|
+
actionInherit?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class GuardRbac extends GuardBase {
|
|
10
|
+
check(options: IGuardOptionsRbac): Promise<boolean>;
|
|
11
|
+
private isValidDecision;
|
|
12
|
+
private isValidAction;
|
|
13
|
+
private isValidTerms;
|
|
14
|
+
private isValidTerm;
|
|
15
|
+
private isDepartmentDataScope;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=guard.rbac.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard.rbac.d.ts","sourceRoot":"","sources":["../../src/bean/guard.rbac.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAS,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAWxD,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAIa,SAAU,SAAQ,SAAS;IAChC,KAAK,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAsBzD,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,qBAAqB;CAO9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bean/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAgB,MAAM,CAAC,IAAI,EAAE,eAAe;;mBAGM,MAAM,cAAc;;EAGrE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { BeanInfo, beanFullNameFromOnionName, BeanBase, BeanScopeBase } from 'vona';
|
|
2
|
+
import { __decorate } from 'tslib';
|
|
3
|
+
import { Guard, GuardBase } from 'vona-module-a-aspect';
|
|
4
|
+
import { Bean, Scope } from 'vona-module-a-bean';
|
|
5
|
+
import { getCacheControllerRoutes } from 'vona-module-a-web';
|
|
6
|
+
import { Event, BeanEventBase } from 'vona-module-a-event';
|
|
7
|
+
|
|
8
|
+
const SymbolRbacDecision = Symbol('SymbolRbacDecision');
|
|
9
|
+
function createRbacAllScopeDecision(action) {
|
|
10
|
+
return {
|
|
11
|
+
allowed: true,
|
|
12
|
+
actionKey: action.actionKey,
|
|
13
|
+
action,
|
|
14
|
+
terms: [{
|
|
15
|
+
dataScope: 'all'
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function createRbacCapability(key, allowed) {
|
|
20
|
+
return {
|
|
21
|
+
key,
|
|
22
|
+
allowed
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function isRbacCapability(value) {
|
|
26
|
+
if (!value || typeof value !== 'object') return false;
|
|
27
|
+
const capability = value;
|
|
28
|
+
return Object.keys(capability).every(key => key === 'key' || key === 'allowed') && typeof capability.key === 'string' && capability.key.length > 0 && typeof capability.allowed === 'boolean';
|
|
29
|
+
}
|
|
30
|
+
function hasRbacAllScope(decision) {
|
|
31
|
+
return decision.terms?.some(term => term.dataScope === 'all') === true;
|
|
32
|
+
}
|
|
33
|
+
function rbacActionKey(controllerBeanFullName, action) {
|
|
34
|
+
return `${controllerBeanFullName}#${action}`;
|
|
35
|
+
}
|
|
36
|
+
function getRbacDecision(ctx) {
|
|
37
|
+
return ctx[SymbolRbacDecision];
|
|
38
|
+
}
|
|
39
|
+
function setRbacDecision(ctx, decision) {
|
|
40
|
+
ctx[SymbolRbacDecision] = decision;
|
|
41
|
+
}
|
|
42
|
+
function clearRbacDecision(ctx) {
|
|
43
|
+
delete ctx[SymbolRbacDecision];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let GuardRbac = class GuardRbac extends GuardBase {
|
|
47
|
+
async check(options) {
|
|
48
|
+
clearRbacDecision(this.ctx);
|
|
49
|
+
const action = this.bean.rbacCatalog.getAction(this.ctx.route);
|
|
50
|
+
if (!action) return false;
|
|
51
|
+
const effectiveAction = {
|
|
52
|
+
...action,
|
|
53
|
+
options: {
|
|
54
|
+
...action.options,
|
|
55
|
+
...options
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (await this.bean.rbacScope.isUnrestricted()) {
|
|
59
|
+
setRbacDecision(this.ctx, createRbacAllScopeDecision(effectiveAction));
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
const decision = await this.scope.event.resolvePolicy.emit({
|
|
63
|
+
action: effectiveAction,
|
|
64
|
+
policyActionKey: action.actionInheritKey ?? action.actionKey
|
|
65
|
+
}, async () => undefined);
|
|
66
|
+
if (!this.isValidDecision(decision, effectiveAction) || !decision.allowed) return false;
|
|
67
|
+
setRbacDecision(this.ctx, {
|
|
68
|
+
...decision,
|
|
69
|
+
action: effectiveAction
|
|
70
|
+
});
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
isValidDecision(decision, action) {
|
|
74
|
+
if (!decision || typeof decision !== 'object') return false;
|
|
75
|
+
const value = decision;
|
|
76
|
+
if (typeof value.allowed !== 'boolean' || value.actionKey !== action.actionKey) return false;
|
|
77
|
+
if (!this.isValidAction(value.action, action)) return false;
|
|
78
|
+
if (value.revision !== undefined && typeof value.revision !== 'string') return false;
|
|
79
|
+
if (value.terms !== undefined && !this.isValidTerms(value.terms)) return false;
|
|
80
|
+
return !value.allowed || !action.options.dataScope || this.isValidTerms(value.terms);
|
|
81
|
+
}
|
|
82
|
+
isValidAction(value, action) {
|
|
83
|
+
if (!value || typeof value !== 'object') return false;
|
|
84
|
+
const descriptor = value;
|
|
85
|
+
return descriptor.actionKey === action.actionKey && descriptor.actionInheritKey === action.actionInheritKey && descriptor.controllerBeanFullName === action.controllerBeanFullName && descriptor.action === action.action;
|
|
86
|
+
}
|
|
87
|
+
isValidTerms(value) {
|
|
88
|
+
return Array.isArray(value) && value.length > 0 && value.every(term => this.isValidTerm(term));
|
|
89
|
+
}
|
|
90
|
+
isValidTerm(value) {
|
|
91
|
+
if (!value || typeof value !== 'object') return false;
|
|
92
|
+
const term = value;
|
|
93
|
+
if (term.dataScope === 'all') return true;
|
|
94
|
+
if (term.dataScope === 'mine') {
|
|
95
|
+
return typeof term.ownerId === 'string' && term.ownerId.length > 0;
|
|
96
|
+
}
|
|
97
|
+
if (!this.isDepartmentDataScope(term.dataScope)) return false;
|
|
98
|
+
return Array.isArray(term.departmentIds) && term.departmentIds.length > 0 && term.departmentIds.every(id => typeof id === 'string' && id.length > 0);
|
|
99
|
+
}
|
|
100
|
+
isDepartmentDataScope(value) {
|
|
101
|
+
return ['customDepartments', 'ownDepartment', 'ownDepartmentAndDescendants'].includes(value);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
GuardRbac = __decorate([Guard({
|
|
105
|
+
dataScopeField: 'departmentId',
|
|
106
|
+
dataScopeMineField: 'userIdOwner'
|
|
107
|
+
}), BeanInfo({
|
|
108
|
+
module: "a-rbac"
|
|
109
|
+
})], GuardRbac);
|
|
110
|
+
|
|
111
|
+
const BeanFullNameGuardRbac = beanFullNameFromOnionName('a-rbac:rbac', 'guard');
|
|
112
|
+
let BeanRbacCatalog = class BeanRbacCatalog extends BeanBase {
|
|
113
|
+
constructor(...args) {
|
|
114
|
+
super(...args);
|
|
115
|
+
this._catalog = void 0;
|
|
116
|
+
}
|
|
117
|
+
getAction(route) {
|
|
118
|
+
return this.getCatalog().get(rbacActionKey(route.controllerBeanFullName, route.action));
|
|
119
|
+
}
|
|
120
|
+
getCatalog() {
|
|
121
|
+
if (!this._catalog) this._catalog = this.createCatalog();
|
|
122
|
+
return this._catalog;
|
|
123
|
+
}
|
|
124
|
+
clear() {
|
|
125
|
+
this._catalog = undefined;
|
|
126
|
+
}
|
|
127
|
+
createCatalog() {
|
|
128
|
+
const catalog = new Map();
|
|
129
|
+
const routesByController = getCacheControllerRoutes(this.app);
|
|
130
|
+
for (const routes of Object.values(routesByController)) {
|
|
131
|
+
for (const route of routes) {
|
|
132
|
+
const options = route.route.meta?.[BeanFullNameGuardRbac];
|
|
133
|
+
if (!options) continue;
|
|
134
|
+
const actionKey = rbacActionKey(route.controllerBeanFullName, route.action);
|
|
135
|
+
catalog.set(actionKey, {
|
|
136
|
+
actionKey,
|
|
137
|
+
controllerBeanFullName: route.controllerBeanFullName,
|
|
138
|
+
action: route.action,
|
|
139
|
+
route,
|
|
140
|
+
options: Object.freeze({
|
|
141
|
+
...options
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
this.resolveActionInherit(catalog, routesByController);
|
|
147
|
+
return catalog;
|
|
148
|
+
}
|
|
149
|
+
resolveActionInherit(catalog, routesByController) {
|
|
150
|
+
for (const descriptor of catalog.values()) {
|
|
151
|
+
if (!descriptor.options.actionInherit) continue;
|
|
152
|
+
const routes = routesByController[descriptor.controllerBeanFullName] ?? [];
|
|
153
|
+
const routesByAction = new Map(routes.map(route => [route.action, route]));
|
|
154
|
+
descriptor.actionInheritKey = this.resolveActionInheritKey(descriptor, catalog, routesByAction);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
resolveActionInheritKey(descriptor, catalog, routesByAction) {
|
|
158
|
+
const seen = new Set([descriptor.actionKey]);
|
|
159
|
+
let current = descriptor;
|
|
160
|
+
while (current.options.actionInherit) {
|
|
161
|
+
const action = current.options.actionInherit;
|
|
162
|
+
if (action === current.action) {
|
|
163
|
+
throw new Error(`RBAC actionInherit cannot reference itself: ${current.actionKey}`);
|
|
164
|
+
}
|
|
165
|
+
const route = routesByAction.get(action);
|
|
166
|
+
if (!route) {
|
|
167
|
+
throw new Error(`RBAC actionInherit target not found: ${current.actionKey} -> ${action}`);
|
|
168
|
+
}
|
|
169
|
+
const targetKey = rbacActionKey(current.controllerBeanFullName, action);
|
|
170
|
+
if (seen.has(targetKey)) {
|
|
171
|
+
throw new Error(`RBAC actionInherit cycle: ${descriptor.actionKey}`);
|
|
172
|
+
}
|
|
173
|
+
seen.add(targetKey);
|
|
174
|
+
const target = catalog.get(targetKey);
|
|
175
|
+
if (!target) return targetKey;
|
|
176
|
+
current = target;
|
|
177
|
+
}
|
|
178
|
+
return current.actionKey;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
BeanRbacCatalog = __decorate([Bean(), BeanInfo({
|
|
182
|
+
module: "a-rbac"
|
|
183
|
+
})], BeanRbacCatalog);
|
|
184
|
+
|
|
185
|
+
let BeanRbacScope = class BeanRbacScope extends BeanBase {
|
|
186
|
+
constructor(...args) {
|
|
187
|
+
super(...args);
|
|
188
|
+
this._scopeAdapter = void 0;
|
|
189
|
+
}
|
|
190
|
+
async isUnrestricted() {
|
|
191
|
+
return await this.scopeAdapter.isUnrestricted();
|
|
192
|
+
}
|
|
193
|
+
async current(actionKey) {
|
|
194
|
+
const action = this.resolveAction(actionKey);
|
|
195
|
+
if (!action) this.app.throw(403);
|
|
196
|
+
const decision = getRbacDecision(this.ctx);
|
|
197
|
+
if (!this.isDecisionForAction(decision, action)) this.app.throw(403);
|
|
198
|
+
const unrestricted = hasRbacAllScope(decision);
|
|
199
|
+
const ownerValues = action.action === 'create' ? await this.prepareOwnerValues(action, decision, unrestricted) : undefined;
|
|
200
|
+
return this.createAccess(action, decision, unrestricted, ownerValues);
|
|
201
|
+
}
|
|
202
|
+
get scopeAdapter() {
|
|
203
|
+
if (!this._scopeAdapter) {
|
|
204
|
+
const beanFullName = beanFullNameFromOnionName(this.scope.config.adapter.rbacScope, 'service');
|
|
205
|
+
this._scopeAdapter = this.bean._getBean(beanFullName);
|
|
206
|
+
}
|
|
207
|
+
return this._scopeAdapter;
|
|
208
|
+
}
|
|
209
|
+
async prepareOwnerValues(action, decision, unrestricted) {
|
|
210
|
+
const values = await this.scopeAdapter.ownerValues(action, decision);
|
|
211
|
+
const departmentField = action.options.dataScopeField ?? 'departmentId';
|
|
212
|
+
const ownerField = action.options.dataScopeMineField ?? 'userIdOwner';
|
|
213
|
+
const ownerValues = {
|
|
214
|
+
[departmentField]: values.departmentId,
|
|
215
|
+
[ownerField]: values.userIdOwner
|
|
216
|
+
};
|
|
217
|
+
if (!this.matches(action, decision, unrestricted, ownerValues)) this.app.throw(403);
|
|
218
|
+
return ownerValues;
|
|
219
|
+
}
|
|
220
|
+
createAccess(action, decision, unrestricted, ownerValues) {
|
|
221
|
+
return {
|
|
222
|
+
action,
|
|
223
|
+
decision,
|
|
224
|
+
unrestricted,
|
|
225
|
+
ownerValues: () => {
|
|
226
|
+
if (!ownerValues) this.app.throw(500, 'RBAC scope owner values are not initialized');
|
|
227
|
+
return {
|
|
228
|
+
...ownerValues
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
where: callerWhere => this.where(action, decision, unrestricted, callerWhere),
|
|
232
|
+
checkEntry: entry => {
|
|
233
|
+
if (entry !== undefined && !this.matches(action, decision, unrestricted, entry)) {
|
|
234
|
+
this.app.throw(403);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
checkEntries: entries => {
|
|
238
|
+
for (const entry of entries) {
|
|
239
|
+
if (!this.matches(action, decision, unrestricted, entry)) this.app.throw(403);
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
permissionProjection: () => this.permissionProjection(action, decision, unrestricted)
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
permissionProjection(action, decision, unrestricted) {
|
|
246
|
+
const matcher = unrestricted || !action.options.dataScope ? {
|
|
247
|
+
mode: 'all'
|
|
248
|
+
} : {
|
|
249
|
+
mode: 'any',
|
|
250
|
+
rules: (decision.terms ?? []).flatMap(term => {
|
|
251
|
+
if (term.dataScope === 'all') return [];
|
|
252
|
+
if (term.dataScope === 'mine') {
|
|
253
|
+
return [{
|
|
254
|
+
field: action.options.dataScopeMineField ?? 'userIdOwner',
|
|
255
|
+
values: [term.ownerId]
|
|
256
|
+
}];
|
|
257
|
+
}
|
|
258
|
+
return [{
|
|
259
|
+
field: action.options.dataScopeField ?? 'departmentId',
|
|
260
|
+
values: [...term.departmentIds]
|
|
261
|
+
}];
|
|
262
|
+
})
|
|
263
|
+
};
|
|
264
|
+
if (matcher.mode === 'any' && matcher.rules.length === 0) this.app.throw(403);
|
|
265
|
+
return {
|
|
266
|
+
key: action.actionKey,
|
|
267
|
+
allowed: decision.allowed,
|
|
268
|
+
matcher
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
where(action, decision, unrestricted, callerWhere) {
|
|
272
|
+
if (unrestricted) return callerWhere;
|
|
273
|
+
const scopeWhere = this.scopeWhere(action, decision);
|
|
274
|
+
if (!scopeWhere) this.app.throw(403);
|
|
275
|
+
if (!callerWhere) return scopeWhere;
|
|
276
|
+
return {
|
|
277
|
+
_and_: {
|
|
278
|
+
_and_: callerWhere,
|
|
279
|
+
_and_0: scopeWhere
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
scopeWhere(action, decision) {
|
|
284
|
+
const predicates = (decision.terms ?? []).flatMap(term => this.termPredicates(action, term));
|
|
285
|
+
if (!predicates.length) return undefined;
|
|
286
|
+
return predicates.length === 1 ? predicates[0] : {
|
|
287
|
+
_or_: predicates
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
matches(action, decision, unrestricted, row) {
|
|
291
|
+
const values = row;
|
|
292
|
+
if (unrestricted) return true;
|
|
293
|
+
return (decision.terms ?? []).some(term => {
|
|
294
|
+
if (term.dataScope === 'all') return true;
|
|
295
|
+
if (term.dataScope === 'mine') {
|
|
296
|
+
const field = action.options.dataScopeMineField ?? 'userIdOwner';
|
|
297
|
+
return String(values[field] ?? '') === term.ownerId;
|
|
298
|
+
}
|
|
299
|
+
const field = action.options.dataScopeField ?? 'departmentId';
|
|
300
|
+
return term.departmentIds.includes(String(values[field] ?? ''));
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
resolveAction(actionKey) {
|
|
304
|
+
const catalog = this.bean.rbacCatalog.getCatalog();
|
|
305
|
+
if (actionKey) return catalog.get(actionKey);
|
|
306
|
+
const route = this.ctx.route;
|
|
307
|
+
return route ? catalog.get(rbacActionKey(route.controllerBeanFullName, route.action)) : undefined;
|
|
308
|
+
}
|
|
309
|
+
isDecisionForAction(decision, action) {
|
|
310
|
+
return Boolean(decision?.allowed && decision.actionKey === action.actionKey && decision.action.actionKey === action.actionKey && decision.action.actionInheritKey === action.actionInheritKey && decision.action.controllerBeanFullName === action.controllerBeanFullName && decision.action.action === action.action && this.isValidTerms(decision.terms));
|
|
311
|
+
}
|
|
312
|
+
isValidTerms(terms) {
|
|
313
|
+
if (!terms?.length) return false;
|
|
314
|
+
return terms.every(term => {
|
|
315
|
+
if (term.dataScope === 'all') return true;
|
|
316
|
+
if (term.dataScope === 'mine') return typeof term.ownerId === 'string' && term.ownerId.length > 0;
|
|
317
|
+
return ['customDepartments', 'ownDepartment', 'ownDepartmentAndDescendants'].includes(term.dataScope) && Array.isArray(term.departmentIds) && term.departmentIds.length > 0 && term.departmentIds.every(id => typeof id === 'string' && id.length > 0);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
termPredicates(action, term) {
|
|
321
|
+
if (term.dataScope === 'all') return [{}];
|
|
322
|
+
if (term.dataScope === 'mine') {
|
|
323
|
+
const field = action.options.dataScopeMineField ?? 'userIdOwner';
|
|
324
|
+
return [{
|
|
325
|
+
[field]: term.ownerId
|
|
326
|
+
}];
|
|
327
|
+
}
|
|
328
|
+
const field = action.options.dataScopeField ?? 'departmentId';
|
|
329
|
+
return [{
|
|
330
|
+
[field]: {
|
|
331
|
+
_in_: term.departmentIds
|
|
332
|
+
}
|
|
333
|
+
}];
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
BeanRbacScope = __decorate([Bean(), BeanInfo({
|
|
337
|
+
module: "a-rbac"
|
|
338
|
+
})], BeanRbacScope);
|
|
339
|
+
|
|
340
|
+
let EventPolicyInvalidated = class EventPolicyInvalidated extends BeanEventBase {};
|
|
341
|
+
EventPolicyInvalidated = __decorate([Event(), BeanInfo({
|
|
342
|
+
module: "a-rbac"
|
|
343
|
+
})], EventPolicyInvalidated);
|
|
344
|
+
|
|
345
|
+
let EventResolvePolicy = class EventResolvePolicy extends BeanEventBase {};
|
|
346
|
+
EventResolvePolicy = __decorate([Event(), BeanInfo({
|
|
347
|
+
module: "a-rbac"
|
|
348
|
+
})], EventResolvePolicy);
|
|
349
|
+
|
|
350
|
+
function config(_app) {
|
|
351
|
+
return {
|
|
352
|
+
adapter: {
|
|
353
|
+
rbacScope: 'admin-rbac:rbacScopeAdapter'
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
let ScopeModuleARbac = class ScopeModuleARbac extends BeanScopeBase {};
|
|
359
|
+
ScopeModuleARbac = __decorate([Scope(), BeanInfo({
|
|
360
|
+
module: "a-rbac"
|
|
361
|
+
})], ScopeModuleARbac);
|
|
362
|
+
/** scope: end */
|
|
363
|
+
|
|
364
|
+
export { BeanRbacCatalog, BeanRbacScope, EventPolicyInvalidated, EventResolvePolicy, GuardRbac, ScopeModuleARbac, SymbolRbacDecision, clearRbacDecision, config, createRbacAllScopeDecision, createRbacCapability, getRbacDecision, hasRbacAllScope, isRbacCapability, rbacActionKey, setRbacDecision };
|
|
365
|
+
//# sourceMappingURL=index.js.map
|