@yelon/acl 15.2.6 → 16.0.1-be448b0
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 -21
- package/README.md +23 -23
- package/{esm2020 → esm2022}/acl.mjs +4 -4
- package/{esm2020 → esm2022}/index.mjs +7 -7
- package/esm2022/src/acl-guard.mjs +58 -0
- package/esm2022/src/acl-if.directive.mjs +80 -0
- package/{esm2020 → esm2022}/src/acl.config.mjs +3 -3
- package/esm2022/src/acl.directive.mjs +49 -0
- package/esm2022/src/acl.module.mjs +28 -0
- package/esm2022/src/acl.service.mjs +196 -0
- package/{esm2020 → esm2022}/src/acl.type.mjs +6 -6
- package/{fesm2020 → fesm2022}/acl.mjs +405 -405
- package/{fesm2020 → fesm2022}/acl.mjs.map +1 -1
- package/index.d.ts +7 -7
- package/package.json +45 -51
- package/src/acl-guard.d.ts +28 -28
- package/src/acl-if.directive.d.ts +26 -26
- package/src/acl.config.d.ts +2 -2
- package/src/acl.directive.d.ts +18 -18
- package/src/acl.module.d.ts +11 -11
- package/src/acl.service.d.ts +78 -78
- package/src/acl.type.d.ts +32 -32
- package/src/style/index.less +7 -7
- package/esm2020/src/acl-guard.mjs +0 -57
- package/esm2020/src/acl-if.directive.mjs +0 -79
- package/esm2020/src/acl.directive.mjs +0 -48
- package/esm2020/src/acl.module.mjs +0 -27
- package/esm2020/src/acl.service.mjs +0 -195
- package/fesm2015/acl.mjs +0 -395
- package/fesm2015/acl.mjs.map +0 -1
package/fesm2015/acl.mjs
DELETED
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Directive, Input, NgModule } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject, filter, Observable, of, map, tap } from 'rxjs';
|
|
4
|
-
import * as i1 from '@yelon/util/config';
|
|
5
|
-
import * as i2 from '@angular/router';
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
7
|
-
|
|
8
|
-
const ACL_DEFAULT_CONFIG = {
|
|
9
|
-
guard_url: `/403`
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)
|
|
14
|
-
*
|
|
15
|
-
* 务必在根目录注册 `YelonACLModule.forRoot()` 才能使用服务
|
|
16
|
-
*/
|
|
17
|
-
class ACLService {
|
|
18
|
-
/** ACL变更通知 */
|
|
19
|
-
get change() {
|
|
20
|
-
return this.aclChange.asObservable();
|
|
21
|
-
}
|
|
22
|
-
/** 获取所有数据 */
|
|
23
|
-
get data() {
|
|
24
|
-
return {
|
|
25
|
-
full: this.full,
|
|
26
|
-
roles: this.roles,
|
|
27
|
-
abilities: this.abilities
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
get guard_url() {
|
|
31
|
-
return this.options.guard_url;
|
|
32
|
-
}
|
|
33
|
-
constructor(configSrv) {
|
|
34
|
-
this.roles = [];
|
|
35
|
-
this.abilities = [];
|
|
36
|
-
this.full = false;
|
|
37
|
-
this.aclChange = new BehaviorSubject(null);
|
|
38
|
-
this.options = configSrv.merge('acl', ACL_DEFAULT_CONFIG);
|
|
39
|
-
}
|
|
40
|
-
parseACLType(val) {
|
|
41
|
-
let t;
|
|
42
|
-
if (typeof val === 'number') {
|
|
43
|
-
t = { ability: [val] };
|
|
44
|
-
}
|
|
45
|
-
else if (Array.isArray(val) && val.length > 0 && typeof val[0] === 'number') {
|
|
46
|
-
t = { ability: val };
|
|
47
|
-
}
|
|
48
|
-
else if (typeof val === 'object' && !Array.isArray(val)) {
|
|
49
|
-
t = Object.assign({}, val);
|
|
50
|
-
}
|
|
51
|
-
else if (Array.isArray(val)) {
|
|
52
|
-
t = { role: val };
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
t = { role: val == null ? [] : [val] };
|
|
56
|
-
}
|
|
57
|
-
return Object.assign({ except: false }, t);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 设置当前用户角色或权限能力(会先清除所有)
|
|
61
|
-
*/
|
|
62
|
-
set(value) {
|
|
63
|
-
this.full = false;
|
|
64
|
-
this.abilities = [];
|
|
65
|
-
this.roles = [];
|
|
66
|
-
this.add(value);
|
|
67
|
-
this.aclChange.next(value);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* 标识当前用户为全量,即不受限
|
|
71
|
-
*/
|
|
72
|
-
setFull(val) {
|
|
73
|
-
this.full = val;
|
|
74
|
-
this.aclChange.next(val);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* 设置当前用户权限能力(会先清除所有)
|
|
78
|
-
*/
|
|
79
|
-
setAbility(abilities) {
|
|
80
|
-
this.set({ ability: abilities });
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* 设置当前用户角色(会先清除所有)
|
|
84
|
-
*/
|
|
85
|
-
setRole(roles) {
|
|
86
|
-
this.set({ role: roles });
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 为当前用户增加角色或权限能力
|
|
90
|
-
*/
|
|
91
|
-
add(value) {
|
|
92
|
-
if (value.role && value.role.length > 0) {
|
|
93
|
-
this.roles.push(...value.role);
|
|
94
|
-
}
|
|
95
|
-
if (value.ability && value.ability.length > 0) {
|
|
96
|
-
this.abilities.push(...value.ability);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* 为当前用户附加角色
|
|
101
|
-
*/
|
|
102
|
-
attachRole(roles) {
|
|
103
|
-
for (const val of roles) {
|
|
104
|
-
if (!this.roles.includes(val)) {
|
|
105
|
-
this.roles.push(val);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
this.aclChange.next(this.data);
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* 为当前用户附加权限
|
|
112
|
-
*/
|
|
113
|
-
attachAbility(abilities) {
|
|
114
|
-
for (const val of abilities) {
|
|
115
|
-
if (!this.abilities.includes(val)) {
|
|
116
|
-
this.abilities.push(val);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
this.aclChange.next(this.data);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* 为当前用户移除角色
|
|
123
|
-
*/
|
|
124
|
-
removeRole(roles) {
|
|
125
|
-
for (const val of roles) {
|
|
126
|
-
const idx = this.roles.indexOf(val);
|
|
127
|
-
if (idx !== -1) {
|
|
128
|
-
this.roles.splice(idx, 1);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
this.aclChange.next(this.data);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* 为当前用户移除权限
|
|
135
|
-
*/
|
|
136
|
-
removeAbility(abilities) {
|
|
137
|
-
for (const val of abilities) {
|
|
138
|
-
const idx = this.abilities.indexOf(val);
|
|
139
|
-
if (idx !== -1) {
|
|
140
|
-
this.abilities.splice(idx, 1);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
this.aclChange.next(this.data);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* 当前用户是否有对应角色,其实 `number` 表示Ability
|
|
147
|
-
*
|
|
148
|
-
* - 当 `full: true` 或参数 `null` 时返回 `true`
|
|
149
|
-
* - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式
|
|
150
|
-
*/
|
|
151
|
-
can(roleOrAbility) {
|
|
152
|
-
const { preCan } = this.options;
|
|
153
|
-
if (preCan) {
|
|
154
|
-
roleOrAbility = preCan(roleOrAbility);
|
|
155
|
-
}
|
|
156
|
-
const t = this.parseACLType(roleOrAbility);
|
|
157
|
-
let result = false;
|
|
158
|
-
if (this.full === true || !roleOrAbility) {
|
|
159
|
-
result = true;
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
if (t.role && t.role.length > 0) {
|
|
163
|
-
if (t.mode === 'allOf') {
|
|
164
|
-
result = t.role.every(v => this.roles.includes(v));
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
result = t.role.some(v => this.roles.includes(v));
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (t.ability && t.ability.length > 0) {
|
|
171
|
-
if (t.mode === 'allOf') {
|
|
172
|
-
result = t.ability.every(v => this.abilities.includes(v));
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
result = t.ability.some(v => this.abilities.includes(v));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return t.except === true ? !result : result;
|
|
180
|
-
}
|
|
181
|
-
/** @inner */
|
|
182
|
-
parseAbility(value) {
|
|
183
|
-
if (typeof value === 'number' || typeof value === 'string' || Array.isArray(value)) {
|
|
184
|
-
value = { ability: Array.isArray(value) ? value : [value] };
|
|
185
|
-
}
|
|
186
|
-
delete value.role;
|
|
187
|
-
return value;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* 当前用户是否有对应权限点
|
|
191
|
-
*/
|
|
192
|
-
canAbility(value) {
|
|
193
|
-
return this.can(this.parseAbility(value));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
ACLService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLService, deps: [{ token: i1.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
197
|
-
ACLService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLService });
|
|
198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLService, decorators: [{
|
|
199
|
-
type: Injectable
|
|
200
|
-
}], ctorParameters: function () { return [{ type: i1.YunzaiConfigService }]; } });
|
|
201
|
-
|
|
202
|
-
class ACLIfDirective {
|
|
203
|
-
constructor(templateRef, srv, _viewContainer) {
|
|
204
|
-
this.srv = srv;
|
|
205
|
-
this._viewContainer = _viewContainer;
|
|
206
|
-
this._thenTemplateRef = null;
|
|
207
|
-
this._elseTemplateRef = null;
|
|
208
|
-
this._thenViewRef = null;
|
|
209
|
-
this._elseViewRef = null;
|
|
210
|
-
this._except = false;
|
|
211
|
-
this._change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this._updateView());
|
|
212
|
-
this._thenTemplateRef = templateRef;
|
|
213
|
-
}
|
|
214
|
-
set aclIf(value) {
|
|
215
|
-
this._value = value;
|
|
216
|
-
this._updateView();
|
|
217
|
-
}
|
|
218
|
-
set aclIfThen(templateRef) {
|
|
219
|
-
this._thenTemplateRef = templateRef;
|
|
220
|
-
this._thenViewRef = null;
|
|
221
|
-
this._updateView();
|
|
222
|
-
}
|
|
223
|
-
set aclIfElse(templateRef) {
|
|
224
|
-
this._elseTemplateRef = templateRef;
|
|
225
|
-
this._elseViewRef = null;
|
|
226
|
-
this._updateView();
|
|
227
|
-
}
|
|
228
|
-
set except(value) {
|
|
229
|
-
this._except = value != null && `${value}` !== 'false';
|
|
230
|
-
}
|
|
231
|
-
get except() {
|
|
232
|
-
return this._except;
|
|
233
|
-
}
|
|
234
|
-
_updateView() {
|
|
235
|
-
const res = this.srv.can(this._value);
|
|
236
|
-
if ((res && !this.except) || (!res && this.except)) {
|
|
237
|
-
if (!this._thenViewRef) {
|
|
238
|
-
this._viewContainer.clear();
|
|
239
|
-
this._elseViewRef = null;
|
|
240
|
-
if (this._thenTemplateRef) {
|
|
241
|
-
this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
if (!this._elseViewRef) {
|
|
247
|
-
this._viewContainer.clear();
|
|
248
|
-
this._thenViewRef = null;
|
|
249
|
-
if (this._elseTemplateRef) {
|
|
250
|
-
this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
ngOnDestroy() {
|
|
256
|
-
this._change$.unsubscribe();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
ACLIfDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLIfDirective, deps: [{ token: i0.TemplateRef }, { token: ACLService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
260
|
-
ACLIfDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ACLIfDirective, selector: "[aclIf]", inputs: { aclIf: "aclIf", aclIfThen: "aclIfThen", aclIfElse: "aclIfElse", except: "except" }, exportAs: ["aclIf"], ngImport: i0 });
|
|
261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLIfDirective, decorators: [{
|
|
262
|
-
type: Directive,
|
|
263
|
-
args: [{
|
|
264
|
-
selector: '[aclIf]',
|
|
265
|
-
exportAs: 'aclIf'
|
|
266
|
-
}]
|
|
267
|
-
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: ACLService }, { type: i0.ViewContainerRef }]; }, propDecorators: { aclIf: [{
|
|
268
|
-
type: Input
|
|
269
|
-
}], aclIfThen: [{
|
|
270
|
-
type: Input
|
|
271
|
-
}], aclIfElse: [{
|
|
272
|
-
type: Input
|
|
273
|
-
}], except: [{
|
|
274
|
-
type: Input
|
|
275
|
-
}] } });
|
|
276
|
-
|
|
277
|
-
class ACLDirective {
|
|
278
|
-
set acl(value) {
|
|
279
|
-
this.set(value);
|
|
280
|
-
}
|
|
281
|
-
set ability(value) {
|
|
282
|
-
this.set(this.srv.parseAbility(value));
|
|
283
|
-
}
|
|
284
|
-
set(value) {
|
|
285
|
-
this._value = value;
|
|
286
|
-
const CLS = 'acl__hide';
|
|
287
|
-
const el = this.el.nativeElement;
|
|
288
|
-
if (this.srv.can(this._value)) {
|
|
289
|
-
this.renderer.removeClass(el, CLS);
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
this.renderer.addClass(el, CLS);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
constructor(el, renderer, srv) {
|
|
296
|
-
this.el = el;
|
|
297
|
-
this.renderer = renderer;
|
|
298
|
-
this.srv = srv;
|
|
299
|
-
this.change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this.set(this._value));
|
|
300
|
-
}
|
|
301
|
-
ngOnDestroy() {
|
|
302
|
-
this.change$.unsubscribe();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
ACLDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: ACLService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
306
|
-
ACLDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ACLDirective, selector: "[acl]", inputs: { acl: "acl", ability: ["acl-ability", "ability"] }, exportAs: ["acl"], ngImport: i0 });
|
|
307
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLDirective, decorators: [{
|
|
308
|
-
type: Directive,
|
|
309
|
-
args: [{
|
|
310
|
-
selector: '[acl]',
|
|
311
|
-
exportAs: 'acl'
|
|
312
|
-
}]
|
|
313
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: ACLService }]; }, propDecorators: { acl: [{
|
|
314
|
-
type: Input,
|
|
315
|
-
args: ['acl']
|
|
316
|
-
}], ability: [{
|
|
317
|
-
type: Input,
|
|
318
|
-
args: ['acl-ability']
|
|
319
|
-
}] } });
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
323
|
-
*
|
|
324
|
-
* ```ts
|
|
325
|
-
* data: {
|
|
326
|
-
* path: 'home',
|
|
327
|
-
* canActivate: [ ACLGuard ],
|
|
328
|
-
* data: { guard: 'user1' }
|
|
329
|
-
* }
|
|
330
|
-
* ```
|
|
331
|
-
*/
|
|
332
|
-
class ACLGuard {
|
|
333
|
-
constructor(srv, router, injector) {
|
|
334
|
-
this.srv = srv;
|
|
335
|
-
this.router = router;
|
|
336
|
-
this.injector = injector;
|
|
337
|
-
}
|
|
338
|
-
process(data) {
|
|
339
|
-
data = Object.assign({ guard: null, guard_url: this.srv.guard_url }, data);
|
|
340
|
-
let guard = data.guard;
|
|
341
|
-
if (typeof guard === 'function')
|
|
342
|
-
guard = guard(this.srv, this.injector);
|
|
343
|
-
return (guard && guard instanceof Observable ? guard : of(guard != null ? guard : null)).pipe(map(v => this.srv.can(v)), tap(v => {
|
|
344
|
-
if (v)
|
|
345
|
-
return;
|
|
346
|
-
this.router.navigateByUrl(data.guard_url);
|
|
347
|
-
}));
|
|
348
|
-
}
|
|
349
|
-
// lazy loading
|
|
350
|
-
canMatch(route) {
|
|
351
|
-
return this.process(route.data);
|
|
352
|
-
}
|
|
353
|
-
// all children route
|
|
354
|
-
canActivateChild(childRoute, state) {
|
|
355
|
-
return this.canActivate(childRoute, state);
|
|
356
|
-
}
|
|
357
|
-
// route
|
|
358
|
-
canActivate(route, _state) {
|
|
359
|
-
return this.process(route.data);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
ACLGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLGuard, deps: [{ token: ACLService }, { token: i2.Router }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
363
|
-
ACLGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLGuard, providedIn: 'root' });
|
|
364
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ACLGuard, decorators: [{
|
|
365
|
-
type: Injectable,
|
|
366
|
-
args: [{ providedIn: 'root' }]
|
|
367
|
-
}], ctorParameters: function () { return [{ type: ACLService }, { type: i2.Router }, { type: i0.Injector }]; } });
|
|
368
|
-
|
|
369
|
-
const COMPONENTS = [ACLDirective, ACLIfDirective];
|
|
370
|
-
class YelonACLModule {
|
|
371
|
-
static forRoot() {
|
|
372
|
-
return {
|
|
373
|
-
ngModule: YelonACLModule,
|
|
374
|
-
providers: [ACLService]
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
YelonACLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: YelonACLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
379
|
-
YelonACLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: YelonACLModule, declarations: [ACLDirective, ACLIfDirective], imports: [CommonModule], exports: [ACLDirective, ACLIfDirective] });
|
|
380
|
-
YelonACLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: YelonACLModule, imports: [CommonModule] });
|
|
381
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: YelonACLModule, decorators: [{
|
|
382
|
-
type: NgModule,
|
|
383
|
-
args: [{
|
|
384
|
-
imports: [CommonModule],
|
|
385
|
-
declarations: COMPONENTS,
|
|
386
|
-
exports: COMPONENTS
|
|
387
|
-
}]
|
|
388
|
-
}] });
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Generated bundle index. Do not edit.
|
|
392
|
-
*/
|
|
393
|
-
|
|
394
|
-
export { ACLDirective, ACLGuard, ACLIfDirective, ACLService, ACL_DEFAULT_CONFIG, YelonACLModule };
|
|
395
|
-
//# sourceMappingURL=acl.mjs.map
|
package/fesm2015/acl.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acl.mjs","sources":["../../../../packages/acl/src/acl.config.ts","../../../../packages/acl/src/acl.service.ts","../../../../packages/acl/src/acl-if.directive.ts","../../../../packages/acl/src/acl.directive.ts","../../../../packages/acl/src/acl-guard.ts","../../../../packages/acl/src/acl.module.ts","../../../../packages/acl/acl.ts"],"sourcesContent":["import type { YunzaiACLConfig } from '@yelon/util/config';\n\nexport const ACL_DEFAULT_CONFIG: YunzaiACLConfig = {\n guard_url: `/403`\n};\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { YunzaiACLConfig, YunzaiConfigService } from '@yelon/util/config';\n\nimport { ACL_DEFAULT_CONFIG } from './acl.config';\nimport { ACLCanType, ACLType } from './acl.type';\n\n/**\n * ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)\n *\n * 务必在根目录注册 `YelonACLModule.forRoot()` 才能使用服务\n */\n@Injectable()\nexport class ACLService {\n private options: YunzaiACLConfig;\n private roles: string[] = [];\n private abilities: Array<number | string> = [];\n private full = false;\n private aclChange = new BehaviorSubject<ACLType | boolean | null>(null);\n\n /** ACL变更通知 */\n get change(): Observable<ACLType | boolean | null> {\n return this.aclChange.asObservable();\n }\n\n /** 获取所有数据 */\n get data(): { full: boolean; roles: string[]; abilities: Array<string | number> } {\n return {\n full: this.full,\n roles: this.roles,\n abilities: this.abilities\n };\n }\n\n get guard_url(): string {\n return this.options.guard_url!;\n }\n\n constructor(configSrv: YunzaiConfigService) {\n this.options = configSrv.merge('acl', ACL_DEFAULT_CONFIG)!;\n }\n\n private parseACLType(val: string | string[] | number | number[] | ACLType | null): ACLType {\n let t: ACLType;\n if (typeof val === 'number') {\n t = { ability: [val] };\n } else if (Array.isArray(val) && val.length > 0 && typeof val[0] === 'number') {\n t = { ability: val };\n } else if (typeof val === 'object' && !Array.isArray(val)) {\n t = { ...val };\n } else if (Array.isArray(val)) {\n t = { role: val as string[] };\n } else {\n t = { role: val == null ? [] : [val] };\n }\n\n return { except: false, ...t };\n }\n\n /**\n * 设置当前用户角色或权限能力(会先清除所有)\n */\n set(value: ACLType): void {\n this.full = false;\n this.abilities = [];\n this.roles = [];\n this.add(value);\n this.aclChange.next(value);\n }\n\n /**\n * 标识当前用户为全量,即不受限\n */\n setFull(val: boolean): void {\n this.full = val;\n this.aclChange.next(val);\n }\n\n /**\n * 设置当前用户权限能力(会先清除所有)\n */\n setAbility(abilities: Array<number | string>): void {\n this.set({ ability: abilities } as ACLType);\n }\n\n /**\n * 设置当前用户角色(会先清除所有)\n */\n setRole(roles: string[]): void {\n this.set({ role: roles } as ACLType);\n }\n\n /**\n * 为当前用户增加角色或权限能力\n */\n add(value: ACLType): void {\n if (value.role && value.role.length > 0) {\n this.roles.push(...value.role);\n }\n if (value.ability && value.ability.length > 0) {\n this.abilities.push(...value.ability);\n }\n }\n\n /**\n * 为当前用户附加角色\n */\n attachRole(roles: string[]): void {\n for (const val of roles) {\n if (!this.roles.includes(val)) {\n this.roles.push(val);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户附加权限\n */\n attachAbility(abilities: Array<number | string>): void {\n for (const val of abilities) {\n if (!this.abilities.includes(val)) {\n this.abilities.push(val);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户移除角色\n */\n removeRole(roles: string[]): void {\n for (const val of roles) {\n const idx = this.roles.indexOf(val);\n if (idx !== -1) {\n this.roles.splice(idx, 1);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 为当前用户移除权限\n */\n removeAbility(abilities: Array<number | string>): void {\n for (const val of abilities) {\n const idx = this.abilities.indexOf(val);\n if (idx !== -1) {\n this.abilities.splice(idx, 1);\n }\n }\n this.aclChange.next(this.data);\n }\n\n /**\n * 当前用户是否有对应角色,其实 `number` 表示Ability\n *\n * - 当 `full: true` 或参数 `null` 时返回 `true`\n * - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式\n */\n can(roleOrAbility: ACLCanType | null): boolean {\n const { preCan } = this.options;\n if (preCan) {\n roleOrAbility = preCan(roleOrAbility!);\n }\n\n const t = this.parseACLType(roleOrAbility);\n let result = false;\n if (this.full === true || !roleOrAbility) {\n result = true;\n } else {\n if (t.role && t.role.length > 0) {\n if (t.mode === 'allOf') {\n result = t.role.every(v => this.roles.includes(v));\n } else {\n result = t.role.some(v => this.roles.includes(v));\n }\n }\n if (t.ability && t.ability.length > 0) {\n if (t.mode === 'allOf') {\n result = (t.ability as Array<number | string>).every(v => this.abilities.includes(v));\n } else {\n result = (t.ability as Array<number | string>).some(v => this.abilities.includes(v));\n }\n }\n }\n\n return t.except === true ? !result : result;\n }\n\n /** @inner */\n parseAbility(value: ACLCanType): ACLCanType {\n if (typeof value === 'number' || typeof value === 'string' || Array.isArray(value)) {\n value = { ability: Array.isArray(value) ? value : [value] } as ACLType;\n }\n delete value.role;\n return value;\n }\n\n /**\n * 当前用户是否有对应权限点\n */\n canAbility(value: ACLCanType): boolean {\n return this.can(this.parseAbility(value));\n }\n}\n","import { Directive, EmbeddedViewRef, Input, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { Subscription, filter } from 'rxjs';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType } from './acl.type';\n\n@Directive({\n selector: '[aclIf]',\n exportAs: 'aclIf'\n})\nexport class ACLIfDirective implements OnDestroy {\n static ngAcceptInputType_except: boolean | string | undefined | null;\n\n private _value!: ACLCanType;\n private _change$: Subscription;\n private _thenTemplateRef: TemplateRef<void> | null = null;\n private _elseTemplateRef: TemplateRef<void> | null = null;\n private _thenViewRef: EmbeddedViewRef<void> | null = null;\n private _elseViewRef: EmbeddedViewRef<void> | null = null;\n private _except = false;\n\n constructor(templateRef: TemplateRef<void>, private srv: ACLService, private _viewContainer: ViewContainerRef) {\n this._change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this._updateView());\n this._thenTemplateRef = templateRef;\n }\n\n @Input()\n set aclIf(value: ACLCanType) {\n this._value = value;\n this._updateView();\n }\n\n @Input()\n set aclIfThen(templateRef: TemplateRef<void> | null) {\n this._thenTemplateRef = templateRef;\n this._thenViewRef = null;\n this._updateView();\n }\n\n @Input()\n set aclIfElse(templateRef: TemplateRef<void> | null) {\n this._elseTemplateRef = templateRef;\n this._elseViewRef = null;\n this._updateView();\n }\n\n @Input()\n set except(value: boolean) {\n this._except = value != null && `${value}` !== 'false';\n }\n get except(): boolean {\n return this._except;\n }\n\n protected _updateView(): void {\n const res = this.srv.can(this._value);\n if ((res && !this.except) || (!res && this.except)) {\n if (!this._thenViewRef) {\n this._viewContainer.clear();\n this._elseViewRef = null;\n if (this._thenTemplateRef) {\n this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef);\n }\n }\n } else {\n if (!this._elseViewRef) {\n this._viewContainer.clear();\n this._thenViewRef = null;\n if (this._elseTemplateRef) {\n this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef);\n }\n }\n }\n }\n\n ngOnDestroy(): void {\n this._change$.unsubscribe();\n }\n}\n","import { Directive, ElementRef, Input, OnDestroy, Renderer2 } from '@angular/core';\nimport { Subscription, filter } from 'rxjs';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType } from './acl.type';\n\n@Directive({\n selector: '[acl]',\n exportAs: 'acl'\n})\nexport class ACLDirective implements OnDestroy {\n private _value!: ACLCanType;\n private change$: Subscription;\n\n @Input('acl')\n set acl(value: ACLCanType) {\n this.set(value);\n }\n\n @Input('acl-ability')\n set ability(value: ACLCanType) {\n this.set(this.srv.parseAbility(value));\n }\n\n private set(value: ACLCanType): void {\n this._value = value;\n const CLS = 'acl__hide';\n const el = this.el.nativeElement;\n if (this.srv.can(this._value)) {\n this.renderer.removeClass(el, CLS);\n } else {\n this.renderer.addClass(el, CLS);\n }\n }\n\n constructor(private el: ElementRef, private renderer: Renderer2, protected srv: ACLService) {\n this.change$ = this.srv.change.pipe(filter(r => r != null)).subscribe(() => this.set(this._value));\n }\n\n ngOnDestroy(): void {\n this.change$.unsubscribe();\n }\n}\n","import { Injectable, Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n CanMatch,\n Data,\n Route,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\nimport { Observable, of, map, tap } from 'rxjs';\n\nimport { ACLService } from './acl.service';\nimport { ACLCanType, ACLGuardType } from './acl.type';\n\n/**\n * Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).\n *\n * ```ts\n * data: {\n * path: 'home',\n * canActivate: [ ACLGuard ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ACLGuard implements CanActivate, CanActivateChild, CanMatch {\n constructor(private srv: ACLService, private router: Router, private injector: Injector) {}\n\n private process(data: Data): Observable<boolean> {\n data = {\n guard: null,\n guard_url: this.srv.guard_url,\n ...data\n };\n let guard: ACLGuardType = data.guard;\n if (typeof guard === 'function') guard = guard(this.srv, this.injector);\n return (guard && guard instanceof Observable ? guard : of(guard != null ? (guard as ACLCanType) : null)).pipe(\n map(v => this.srv.can(v)),\n tap(v => {\n if (v) return;\n this.router.navigateByUrl(data.guard_url);\n })\n );\n }\n\n // lazy loading\n canMatch(route: Route): Observable<boolean> {\n return this.process(route.data!);\n }\n // all children route\n canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {\n return this.canActivate(childRoute, state);\n }\n // route\n canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {\n return this.process(route.data);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { ACLIfDirective } from './acl-if.directive';\nimport { ACLDirective } from './acl.directive';\nimport { ACLService } from './acl.service';\n\nconst COMPONENTS = [ACLDirective, ACLIfDirective];\n\n@NgModule({\n imports: [CommonModule],\n declarations: COMPONENTS,\n exports: COMPONENTS\n})\nexport class YelonACLModule {\n static forRoot(): ModuleWithProviders<YelonACLModule> {\n return {\n ngModule: YelonACLModule,\n providers: [ACLService]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.ACLService"],"mappings":";;;;;;;AAEa,MAAA,kBAAkB,GAAoB;AACjD,IAAA,SAAS,EAAE,CAAM,IAAA,CAAA;;;ACKnB;;;;AAIG;MAEU,UAAU,CAAA;;AAQrB,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;KACtC;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;KACH;AAED,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAU,CAAC;KAChC;AAED,IAAA,WAAA,CAAY,SAA8B,EAAA;AAvBlC,QAAA,IAAK,CAAA,KAAA,GAAa,EAAE,CAAC;AACrB,QAAA,IAAS,CAAA,SAAA,GAA2B,EAAE,CAAC;AACvC,QAAA,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;QACb,IAAA,CAAA,SAAS,GAAG,IAAI,eAAe,CAA2B,IAAI,CAAC,CAAC;QAqBtE,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,CAAE,CAAC;KAC5D;AAEO,IAAA,YAAY,CAAC,GAA2D,EAAA;AAC9E,QAAA,IAAI,CAAU,CAAC;AACf,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;AACxB,SAAA;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC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