@yelon/acl 19.2.0 → 20.0.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/fesm2022/acl.mjs +22 -21
- package/fesm2022/acl.mjs.map +1 -1
- package/index.d.ts +209 -7
- package/package.json +2 -2
- package/src/acl-guard.d.ts +0 -48
- package/src/acl-if.directive.d.ts +0 -25
- package/src/acl.config.d.ts +0 -2
- package/src/acl.directive.d.ts +0 -17
- package/src/acl.module.d.ts +0 -9
- package/src/acl.service.d.ts +0 -76
- package/src/acl.type.d.ts +0 -36
package/fesm2022/acl.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { inject, Injectable, ViewContainerRef, TemplateRef, Input, Directive, ElementRef, Renderer2, Injector, NgModule } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, filter, of, Observable, map, tap } from 'rxjs';
|
|
4
|
-
import
|
|
4
|
+
import { YunzaiConfigService } from '@yelon/util/config';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { Router } from '@angular/router';
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
|
@@ -19,6 +19,7 @@ class ACLService {
|
|
|
19
19
|
abilities = [];
|
|
20
20
|
full = false;
|
|
21
21
|
aclChange = new BehaviorSubject(null);
|
|
22
|
+
cogSrv = inject(YunzaiConfigService);
|
|
22
23
|
/** ACL变更通知 */
|
|
23
24
|
get change() {
|
|
24
25
|
return this.aclChange.asObservable();
|
|
@@ -34,8 +35,8 @@ class ACLService {
|
|
|
34
35
|
get guard_url() {
|
|
35
36
|
return this.options.guard_url;
|
|
36
37
|
}
|
|
37
|
-
constructor(
|
|
38
|
-
this.options =
|
|
38
|
+
constructor() {
|
|
39
|
+
this.options = this.cogSrv.merge('acl', ACL_DEFAULT_CONFIG);
|
|
39
40
|
}
|
|
40
41
|
parseACLType(val) {
|
|
41
42
|
let t;
|
|
@@ -192,13 +193,13 @@ class ACLService {
|
|
|
192
193
|
canAbility(value) {
|
|
193
194
|
return this.can(this.parseAbility(value));
|
|
194
195
|
}
|
|
195
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
196
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
196
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
197
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLService, providedIn: 'root' });
|
|
197
198
|
}
|
|
198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLService, decorators: [{
|
|
199
200
|
type: Injectable,
|
|
200
201
|
args: [{ providedIn: 'root' }]
|
|
201
|
-
}], ctorParameters: () => [
|
|
202
|
+
}], ctorParameters: () => [] });
|
|
202
203
|
|
|
203
204
|
class ACLIfDirective {
|
|
204
205
|
srv = inject(ACLService);
|
|
@@ -260,10 +261,10 @@ class ACLIfDirective {
|
|
|
260
261
|
ngOnDestroy() {
|
|
261
262
|
this._change$.unsubscribe();
|
|
262
263
|
}
|
|
263
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
264
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
264
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLIfDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
265
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: ACLIfDirective, isStandalone: true, selector: "[aclIf]", inputs: { aclIf: "aclIf", aclIfThen: "aclIfThen", aclIfElse: "aclIfElse", except: "except" }, exportAs: ["aclIf"], ngImport: i0 });
|
|
265
266
|
}
|
|
266
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLIfDirective, decorators: [{
|
|
267
268
|
type: Directive,
|
|
268
269
|
args: [{
|
|
269
270
|
selector: '[aclIf]',
|
|
@@ -310,10 +311,10 @@ class ACLDirective {
|
|
|
310
311
|
ngOnDestroy() {
|
|
311
312
|
this.change$.unsubscribe();
|
|
312
313
|
}
|
|
313
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
314
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
314
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
315
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: ACLDirective, isStandalone: true, selector: "[acl]", inputs: { acl: "acl", ability: ["acl-ability", "ability"] }, exportAs: ["acl"], ngImport: i0 });
|
|
315
316
|
}
|
|
316
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLDirective, decorators: [{
|
|
317
318
|
type: Directive,
|
|
318
319
|
args: [{
|
|
319
320
|
selector: '[acl]',
|
|
@@ -352,10 +353,10 @@ class ACLGuardService {
|
|
|
352
353
|
this.router.navigateByUrl(data.guard_url);
|
|
353
354
|
}));
|
|
354
355
|
}
|
|
355
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
356
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
356
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLGuardService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
357
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLGuardService, providedIn: 'root' });
|
|
357
358
|
}
|
|
358
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
359
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: ACLGuardService, decorators: [{
|
|
359
360
|
type: Injectable,
|
|
360
361
|
args: [{ providedIn: 'root' }]
|
|
361
362
|
}] });
|
|
@@ -398,11 +399,11 @@ const aclCanMatch = route => inject(ACLGuardService).process(route.data);
|
|
|
398
399
|
|
|
399
400
|
const COMPONENTS = [ACLDirective, ACLIfDirective];
|
|
400
401
|
class YelonACLModule {
|
|
401
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
402
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
403
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
402
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: YelonACLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
403
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: YelonACLModule, imports: [CommonModule, ACLDirective, ACLIfDirective], exports: [ACLDirective, ACLIfDirective] });
|
|
404
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: YelonACLModule, imports: [CommonModule] });
|
|
404
405
|
}
|
|
405
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: YelonACLModule, decorators: [{
|
|
406
407
|
type: NgModule,
|
|
407
408
|
args: [{
|
|
408
409
|
imports: [CommonModule, ...COMPONENTS],
|
package/fesm2022/acl.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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.type.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@Injectable({ providedIn: 'root' })\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, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 private readonly srv = inject(ACLService);\n private readonly _viewContainer = inject(ViewContainerRef);\n static ngAcceptInputType_except: boolean | string | undefined | null;\n\n private _value!: ACLCanType;\n private _change$: Subscription;\n private _thenTemplateRef: TemplateRef<void> | null = inject(TemplateRef<void>);\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() {\n this._change$ = this.srv.change\n .pipe(\n takeUntilDestroyed(),\n filter(r => r != null)\n )\n .subscribe(() => this._updateView());\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, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 readonly el: HTMLElement = inject(ElementRef).nativeElement;\n private readonly renderer = inject(Renderer2);\n private readonly srv = inject(ACLService);\n\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;\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() {\n this.change$ = this.srv.change\n .pipe(\n takeUntilDestroyed(),\n filter(r => r != null)\n )\n .subscribe(() => this.set(this._value));\n }\n\n ngOnDestroy(): void {\n this.change$.unsubscribe();\n }\n}\n","/**\n * NOTE:`ACLType` 类型可能会被其他类库所引用,为了减少类库间彼此的依赖性,其他类库会以复制的形式存在\n * 当这里有变化时,请务必同步更新,涉及:`MenuService.acl`、`util.YunzaiACLType`\n * TODO: 尝试增加 `@yelon/core` 类库用于处理这种通用型\n */\n\nimport { Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport type { ACLService } from './acl.service';\n\nexport interface ACLType {\n /**\n * 角色\n */\n role?: string[];\n /**\n * 权限点\n */\n ability?: number[] | string[];\n\n /**\n * Validated against, default: `oneOf`\n * - `allOf` the value validates against all the roles or abilities\n * - `oneOf` the value validates against exactly one of the roles or abilities\n */\n mode?: 'allOf' | 'oneOf';\n\n /**\n * 是否取反,即结果为 `true` 时表示未授权\n */\n except?: boolean;\n\n [key: string]: any;\n}\n\nexport type ACLCanType = number | number[] | string | string[] | ACLType;\n\nexport type ACLGuardFunctionType = (srv: ACLService, injector: Injector) => Observable<ACLCanType>;\nexport type ACLGuardType = ACLCanType | Observable<ACLCanType> | ACLGuardFunctionType;\n\nexport interface ACLGuardData {\n guard?: ACLGuardType | null;\n guard_url?: string | null;\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport { CanActivateChildFn, CanActivateFn, CanMatchFn, Router } from '@angular/router';\nimport { Observable, of, map, tap } from 'rxjs';\n\nimport { ACLService } from './acl.service';\nimport type { ACLCanType, ACLGuardData } from './acl.type';\n\n@Injectable({ providedIn: 'root' })\nexport class ACLGuardService {\n private readonly srv = inject(ACLService);\n private readonly router = inject(Router);\n private readonly injector = inject(Injector);\n\n process(data?: ACLGuardData): Observable<boolean> {\n data = {\n guard: null,\n guard_url: this.srv.guard_url,\n ...data\n };\n let guard = 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\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: [ aclCanActivate ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\nexport const aclCanActivate: CanActivateFn = route => inject(ACLGuardService).process(route.data);\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 * canActivateChild: [ aclCanActivateChild ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\nexport const aclCanActivateChild: CanActivateChildFn = route => inject(ACLGuardService).process(route.data);\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 * canMatch: [ aclCanMatch ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\nexport const aclCanMatch: CanMatchFn = route => inject(ACLGuardService).process(route.data);\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ACLIfDirective } from './acl-if.directive';\nimport { ACLDirective } from './acl.directive';\n\nconst COMPONENTS = [ACLDirective, ACLIfDirective];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENTS],\n exports: COMPONENTS\n})\nexport class YelonACLModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAEa,MAAA,kBAAkB,GAAoB;AACjD,IAAA,SAAS,EAAE,CAAM,IAAA;;;ACKnB;;AAEG;MAEU,UAAU,CAAA;AACb,IAAA,OAAO;IACP,KAAK,GAAa,EAAE;IACpB,SAAS,GAA2B,EAAE;IACtC,IAAI,GAAG,KAAK;AACZ,IAAA,SAAS,GAAG,IAAI,eAAe,CAA2B,IAAI,CAAC;;AAGvE,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE;;;AAItC,IAAA,IAAI,IAAI,GAAA;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC;SACjB;;AAGH,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAU;;AAGhC,IAAA,WAAA,CAAY,SAA8B,EAAA;QACxC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,CAAE;;AAGpD,IAAA,YAAY,CAAC,GAA2D,EAAA;AAC9E,QAAA,IAAI,CAAU;AACd,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE;;aACjB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;AAC7E,YAAA,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE;;AACf,aAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,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AA,CAAA,QAAA,EAAA,CAAA;wGAAd,cAAc,EAAA,OAAA,EAAA,CAHf,YAAY,EAHJ,YAAY,EAAE,cAAc,CAAA,EAAA,OAAA,EAAA,CAA5B,YAAY,EAAE,cAAc,CAAA,EAAA,CAAA;AAMnC,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,YAHf,YAAY,CAAA,EAAA,CAAA;;2FAGX,cAAc,EAAA,UAAA,EAAA,CAAA;kBAJ1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC;AACtC,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
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.type.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 { inject, 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@Injectable({ providedIn: 'root' })\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 private readonly cogSrv = inject(YunzaiConfigService);\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() {\n this.options = this.cogSrv.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, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 private readonly srv = inject(ACLService);\n private readonly _viewContainer = inject(ViewContainerRef);\n static ngAcceptInputType_except: boolean | string | undefined | null;\n\n private _value!: ACLCanType;\n private _change$: Subscription;\n private _thenTemplateRef: TemplateRef<void> | null = inject(TemplateRef<void>);\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() {\n this._change$ = this.srv.change\n .pipe(\n takeUntilDestroyed(),\n filter(r => r != null)\n )\n .subscribe(() => this._updateView());\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, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\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 readonly el: HTMLElement = inject(ElementRef).nativeElement;\n private readonly renderer = inject(Renderer2);\n private readonly srv = inject(ACLService);\n\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;\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() {\n this.change$ = this.srv.change\n .pipe(\n takeUntilDestroyed(),\n filter(r => r != null)\n )\n .subscribe(() => this.set(this._value));\n }\n\n ngOnDestroy(): void {\n this.change$.unsubscribe();\n }\n}\n","/**\n * NOTE:`ACLType` 类型可能会被其他类库所引用,为了减少类库间彼此的依赖性,其他类库会以复制的形式存在\n * 当这里有变化时,请务必同步更新,涉及:`MenuService.acl`、`util.YunzaiACLType`\n * TODO: 尝试增加 `@yelon/core` 类库用于处理这种通用型\n */\n\nimport { Injector } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport type { ACLService } from './acl.service';\n\nexport interface ACLType {\n /**\n * 角色\n */\n role?: string[];\n /**\n * 权限点\n */\n ability?: number[] | string[];\n\n /**\n * Validated against, default: `oneOf`\n * - `allOf` the value validates against all the roles or abilities\n * - `oneOf` the value validates against exactly one of the roles or abilities\n */\n mode?: 'allOf' | 'oneOf';\n\n /**\n * 是否取反,即结果为 `true` 时表示未授权\n */\n except?: boolean;\n\n [key: string]: any;\n}\n\nexport type ACLCanType = number | number[] | string | string[] | ACLType;\n\nexport type ACLGuardFunctionType = (srv: ACLService, injector: Injector) => Observable<ACLCanType>;\nexport type ACLGuardType = ACLCanType | Observable<ACLCanType> | ACLGuardFunctionType;\n\nexport interface ACLGuardData {\n guard?: ACLGuardType | null;\n guard_url?: string | null;\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport { CanActivateChildFn, CanActivateFn, CanMatchFn, Router } from '@angular/router';\nimport { Observable, of, map, tap } from 'rxjs';\n\nimport { ACLService } from './acl.service';\nimport type { ACLCanType, ACLGuardData } from './acl.type';\n\n@Injectable({ providedIn: 'root' })\nexport class ACLGuardService {\n private readonly srv = inject(ACLService);\n private readonly router = inject(Router);\n private readonly injector = inject(Injector);\n\n process(data?: ACLGuardData): Observable<boolean> {\n data = {\n guard: null,\n guard_url: this.srv.guard_url,\n ...data\n };\n let guard = 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\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: [ aclCanActivate ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\nexport const aclCanActivate: CanActivateFn = route => inject(ACLGuardService).process(route.data);\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 * canActivateChild: [ aclCanActivateChild ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\nexport const aclCanActivateChild: CanActivateChildFn = route => inject(ACLGuardService).process(route.data);\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 * canMatch: [ aclCanMatch ],\n * data: { guard: 'user1' }\n * }\n * ```\n */\nexport const aclCanMatch: CanMatchFn = route => inject(ACLGuardService).process(route.data);\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ACLIfDirective } from './acl-if.directive';\nimport { ACLDirective } from './acl.directive';\n\nconst COMPONENTS = [ACLDirective, ACLIfDirective];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENTS],\n exports: COMPONENTS\n})\nexport class YelonACLModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAEO,MAAM,kBAAkB,GAAoB;AACjD,IAAA,SAAS,EAAE,CAAA,IAAA;;;ACKb;;AAEG;MAEU,UAAU,CAAA;AACb,IAAA,OAAO;IACP,KAAK,GAAa,EAAE;IACpB,SAAS,GAA2B,EAAE;IACtC,IAAI,GAAG,KAAK;AACZ,IAAA,SAAS,GAAG,IAAI,eAAe,CAA2B,IAAI,CAAC;AAEtD,IAAA,MAAM,GAAG,MAAM,CAAC,mBAAmB,CAAC;;AAGrD,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE;IACtC;;AAGA,IAAA,IAAI,IAAI,GAAA;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC;SACjB;IACH;AAEA,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAU;IAChC;AAEA,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,CAAE;IAC9D;AAEQ,IAAA,YAAY,CAAC,GAA2D,EAAA;AAC9E,QAAA,IAAI,CAAU;AACd,QAAA,IAAI,OAA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1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injector, OnDestroy, TemplateRef } from '@angular/core';
|
|
4
|
+
import { YunzaiACLConfig } from '@yelon/util/config';
|
|
5
|
+
import { CanActivateFn, CanActivateChildFn, CanMatchFn } from '@angular/router';
|
|
6
|
+
import * as i1 from '@angular/common';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* NOTE:`ACLType` 类型可能会被其他类库所引用,为了减少类库间彼此的依赖性,其他类库会以复制的形式存在
|
|
10
|
+
* 当这里有变化时,请务必同步更新,涉及:`MenuService.acl`、`util.YunzaiACLType`
|
|
11
|
+
* TODO: 尝试增加 `@yelon/core` 类库用于处理这种通用型
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface ACLType {
|
|
15
|
+
/**
|
|
16
|
+
* 角色
|
|
17
|
+
*/
|
|
18
|
+
role?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* 权限点
|
|
21
|
+
*/
|
|
22
|
+
ability?: number[] | string[];
|
|
23
|
+
/**
|
|
24
|
+
* Validated against, default: `oneOf`
|
|
25
|
+
* - `allOf` the value validates against all the roles or abilities
|
|
26
|
+
* - `oneOf` the value validates against exactly one of the roles or abilities
|
|
27
|
+
*/
|
|
28
|
+
mode?: 'allOf' | 'oneOf';
|
|
29
|
+
/**
|
|
30
|
+
* 是否取反,即结果为 `true` 时表示未授权
|
|
31
|
+
*/
|
|
32
|
+
except?: boolean;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
type ACLCanType = number | number[] | string | string[] | ACLType;
|
|
36
|
+
type ACLGuardFunctionType = (srv: ACLService, injector: Injector) => Observable<ACLCanType>;
|
|
37
|
+
type ACLGuardType = ACLCanType | Observable<ACLCanType> | ACLGuardFunctionType;
|
|
38
|
+
interface ACLGuardData {
|
|
39
|
+
guard?: ACLGuardType | null;
|
|
40
|
+
guard_url?: string | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)
|
|
45
|
+
*/
|
|
46
|
+
declare class ACLService {
|
|
47
|
+
private options;
|
|
48
|
+
private roles;
|
|
49
|
+
private abilities;
|
|
50
|
+
private full;
|
|
51
|
+
private aclChange;
|
|
52
|
+
private readonly cogSrv;
|
|
53
|
+
/** ACL变更通知 */
|
|
54
|
+
get change(): Observable<ACLType | boolean | null>;
|
|
55
|
+
/** 获取所有数据 */
|
|
56
|
+
get data(): {
|
|
57
|
+
full: boolean;
|
|
58
|
+
roles: string[];
|
|
59
|
+
abilities: Array<string | number>;
|
|
60
|
+
};
|
|
61
|
+
get guard_url(): string;
|
|
62
|
+
constructor();
|
|
63
|
+
private parseACLType;
|
|
64
|
+
/**
|
|
65
|
+
* 设置当前用户角色或权限能力(会先清除所有)
|
|
66
|
+
*/
|
|
67
|
+
set(value: ACLType): void;
|
|
68
|
+
/**
|
|
69
|
+
* 标识当前用户为全量,即不受限
|
|
70
|
+
*/
|
|
71
|
+
setFull(val: boolean): void;
|
|
72
|
+
/**
|
|
73
|
+
* 设置当前用户权限能力(会先清除所有)
|
|
74
|
+
*/
|
|
75
|
+
setAbility(abilities: Array<number | string>): void;
|
|
76
|
+
/**
|
|
77
|
+
* 设置当前用户角色(会先清除所有)
|
|
78
|
+
*/
|
|
79
|
+
setRole(roles: string[]): void;
|
|
80
|
+
/**
|
|
81
|
+
* 为当前用户增加角色或权限能力
|
|
82
|
+
*/
|
|
83
|
+
add(value: ACLType): void;
|
|
84
|
+
/**
|
|
85
|
+
* 为当前用户附加角色
|
|
86
|
+
*/
|
|
87
|
+
attachRole(roles: string[]): void;
|
|
88
|
+
/**
|
|
89
|
+
* 为当前用户附加权限
|
|
90
|
+
*/
|
|
91
|
+
attachAbility(abilities: Array<number | string>): void;
|
|
92
|
+
/**
|
|
93
|
+
* 为当前用户移除角色
|
|
94
|
+
*/
|
|
95
|
+
removeRole(roles: string[]): void;
|
|
96
|
+
/**
|
|
97
|
+
* 为当前用户移除权限
|
|
98
|
+
*/
|
|
99
|
+
removeAbility(abilities: Array<number | string>): void;
|
|
100
|
+
/**
|
|
101
|
+
* 当前用户是否有对应角色,其实 `number` 表示Ability
|
|
102
|
+
*
|
|
103
|
+
* - 当 `full: true` 或参数 `null` 时返回 `true`
|
|
104
|
+
* - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式
|
|
105
|
+
*/
|
|
106
|
+
can(roleOrAbility: ACLCanType | null): boolean;
|
|
107
|
+
/** @inner */
|
|
108
|
+
parseAbility(value: ACLCanType): ACLCanType;
|
|
109
|
+
/**
|
|
110
|
+
* 当前用户是否有对应权限点
|
|
111
|
+
*/
|
|
112
|
+
canAbility(value: ACLCanType): boolean;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ACLService, never>;
|
|
114
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ACLService>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare class ACLIfDirective implements OnDestroy {
|
|
118
|
+
private readonly srv;
|
|
119
|
+
private readonly _viewContainer;
|
|
120
|
+
static ngAcceptInputType_except: boolean | string | undefined | null;
|
|
121
|
+
private _value;
|
|
122
|
+
private _change$;
|
|
123
|
+
private _thenTemplateRef;
|
|
124
|
+
private _elseTemplateRef;
|
|
125
|
+
private _thenViewRef;
|
|
126
|
+
private _elseViewRef;
|
|
127
|
+
private _except;
|
|
128
|
+
constructor();
|
|
129
|
+
set aclIf(value: ACLCanType);
|
|
130
|
+
set aclIfThen(templateRef: TemplateRef<void> | null);
|
|
131
|
+
set aclIfElse(templateRef: TemplateRef<void> | null);
|
|
132
|
+
set except(value: boolean);
|
|
133
|
+
get except(): boolean;
|
|
134
|
+
protected _updateView(): void;
|
|
135
|
+
ngOnDestroy(): void;
|
|
136
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ACLIfDirective, never>;
|
|
137
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ACLIfDirective, "[aclIf]", ["aclIf"], { "aclIf": { "alias": "aclIf"; "required": false; }; "aclIfThen": { "alias": "aclIfThen"; "required": false; }; "aclIfElse": { "alias": "aclIfElse"; "required": false; }; "except": { "alias": "except"; "required": false; }; }, {}, never, never, true, never>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare class ACLDirective implements OnDestroy {
|
|
141
|
+
private readonly el;
|
|
142
|
+
private readonly renderer;
|
|
143
|
+
private readonly srv;
|
|
144
|
+
private _value;
|
|
145
|
+
private change$;
|
|
146
|
+
set acl(value: ACLCanType);
|
|
147
|
+
set ability(value: ACLCanType);
|
|
148
|
+
private set;
|
|
149
|
+
constructor();
|
|
150
|
+
ngOnDestroy(): void;
|
|
151
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ACLDirective, never>;
|
|
152
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ACLDirective, "[acl]", ["acl"], { "acl": { "alias": "acl"; "required": false; }; "ability": { "alias": "acl-ability"; "required": false; }; }, {}, never, never, true, never>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare const ACL_DEFAULT_CONFIG: YunzaiACLConfig;
|
|
156
|
+
|
|
157
|
+
declare class ACLGuardService {
|
|
158
|
+
private readonly srv;
|
|
159
|
+
private readonly router;
|
|
160
|
+
private readonly injector;
|
|
161
|
+
process(data?: ACLGuardData): Observable<boolean>;
|
|
162
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ACLGuardService, never>;
|
|
163
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ACLGuardService>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
167
|
+
*
|
|
168
|
+
* ```ts
|
|
169
|
+
* data: {
|
|
170
|
+
* path: 'home',
|
|
171
|
+
* canActivate: [ aclCanActivate ],
|
|
172
|
+
* data: { guard: 'user1' }
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
declare const aclCanActivate: CanActivateFn;
|
|
177
|
+
/**
|
|
178
|
+
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
179
|
+
*
|
|
180
|
+
* ```ts
|
|
181
|
+
* data: {
|
|
182
|
+
* path: 'home',
|
|
183
|
+
* canActivateChild: [ aclCanActivateChild ],
|
|
184
|
+
* data: { guard: 'user1' }
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare const aclCanActivateChild: CanActivateChildFn;
|
|
189
|
+
/**
|
|
190
|
+
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
191
|
+
*
|
|
192
|
+
* ```ts
|
|
193
|
+
* data: {
|
|
194
|
+
* path: 'home',
|
|
195
|
+
* canMatch: [ aclCanMatch ],
|
|
196
|
+
* data: { guard: 'user1' }
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare const aclCanMatch: CanMatchFn;
|
|
201
|
+
|
|
202
|
+
declare class YelonACLModule {
|
|
203
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<YelonACLModule, never>;
|
|
204
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<YelonACLModule, never, [typeof i1.CommonModule, typeof ACLDirective, typeof ACLIfDirective], [typeof ACLDirective, typeof ACLIfDirective]>;
|
|
205
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<YelonACLModule>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export { ACLDirective, ACLGuardService, ACLIfDirective, ACLService, ACL_DEFAULT_CONFIG, YelonACLModule, aclCanActivate, aclCanActivateChild, aclCanMatch };
|
|
209
|
+
export type { ACLCanType, ACLGuardData, ACLGuardFunctionType, ACLGuardType, ACLType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yelon/acl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"author": "yunzai-bot<yunzai-bot@outlook.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"component"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@yelon/util": "^
|
|
29
|
+
"@yelon/util": "^20.0.0",
|
|
30
30
|
"tslib": "^2.3.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "fesm2022/acl.mjs",
|
package/src/acl-guard.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CanActivateChildFn, CanActivateFn, CanMatchFn } from '@angular/router';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import type { ACLGuardData } from './acl.type';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class ACLGuardService {
|
|
6
|
-
private readonly srv;
|
|
7
|
-
private readonly router;
|
|
8
|
-
private readonly injector;
|
|
9
|
-
process(data?: ACLGuardData): Observable<boolean>;
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ACLGuardService, never>;
|
|
11
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ACLGuardService>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* data: {
|
|
18
|
-
* path: 'home',
|
|
19
|
-
* canActivate: [ aclCanActivate ],
|
|
20
|
-
* data: { guard: 'user1' }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare const aclCanActivate: CanActivateFn;
|
|
25
|
-
/**
|
|
26
|
-
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
27
|
-
*
|
|
28
|
-
* ```ts
|
|
29
|
-
* data: {
|
|
30
|
-
* path: 'home',
|
|
31
|
-
* canActivateChild: [ aclCanActivateChild ],
|
|
32
|
-
* data: { guard: 'user1' }
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare const aclCanActivateChild: CanActivateChildFn;
|
|
37
|
-
/**
|
|
38
|
-
* Routing guard prevent unauthorized users visit the page, [ACL Document](https://ng.yunzainfo.com/acl).
|
|
39
|
-
*
|
|
40
|
-
* ```ts
|
|
41
|
-
* data: {
|
|
42
|
-
* path: 'home',
|
|
43
|
-
* canMatch: [ aclCanMatch ],
|
|
44
|
-
* data: { guard: 'user1' }
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare const aclCanMatch: CanMatchFn;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { OnDestroy, TemplateRef } from '@angular/core';
|
|
2
|
-
import { ACLCanType } from './acl.type';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class ACLIfDirective implements OnDestroy {
|
|
5
|
-
private readonly srv;
|
|
6
|
-
private readonly _viewContainer;
|
|
7
|
-
static ngAcceptInputType_except: boolean | string | undefined | null;
|
|
8
|
-
private _value;
|
|
9
|
-
private _change$;
|
|
10
|
-
private _thenTemplateRef;
|
|
11
|
-
private _elseTemplateRef;
|
|
12
|
-
private _thenViewRef;
|
|
13
|
-
private _elseViewRef;
|
|
14
|
-
private _except;
|
|
15
|
-
constructor();
|
|
16
|
-
set aclIf(value: ACLCanType);
|
|
17
|
-
set aclIfThen(templateRef: TemplateRef<void> | null);
|
|
18
|
-
set aclIfElse(templateRef: TemplateRef<void> | null);
|
|
19
|
-
set except(value: boolean);
|
|
20
|
-
get except(): boolean;
|
|
21
|
-
protected _updateView(): void;
|
|
22
|
-
ngOnDestroy(): void;
|
|
23
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ACLIfDirective, never>;
|
|
24
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ACLIfDirective, "[aclIf]", ["aclIf"], { "aclIf": { "alias": "aclIf"; "required": false; }; "aclIfThen": { "alias": "aclIfThen"; "required": false; }; "aclIfElse": { "alias": "aclIfElse"; "required": false; }; "except": { "alias": "except"; "required": false; }; }, {}, never, never, true, never>;
|
|
25
|
-
}
|
package/src/acl.config.d.ts
DELETED
package/src/acl.directive.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import { ACLCanType } from './acl.type';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class ACLDirective implements OnDestroy {
|
|
5
|
-
private readonly el;
|
|
6
|
-
private readonly renderer;
|
|
7
|
-
private readonly srv;
|
|
8
|
-
private _value;
|
|
9
|
-
private change$;
|
|
10
|
-
set acl(value: ACLCanType);
|
|
11
|
-
set ability(value: ACLCanType);
|
|
12
|
-
private set;
|
|
13
|
-
constructor();
|
|
14
|
-
ngOnDestroy(): void;
|
|
15
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ACLDirective, never>;
|
|
16
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ACLDirective, "[acl]", ["acl"], { "acl": { "alias": "acl"; "required": false; }; "ability": { "alias": "acl-ability"; "required": false; }; }, {}, never, never, true, never>;
|
|
17
|
-
}
|
package/src/acl.module.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
import * as i1 from "@angular/common";
|
|
3
|
-
import * as i2 from "./acl.directive";
|
|
4
|
-
import * as i3 from "./acl-if.directive";
|
|
5
|
-
export declare class YelonACLModule {
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<YelonACLModule, never>;
|
|
7
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<YelonACLModule, never, [typeof i1.CommonModule, typeof i2.ACLDirective, typeof i3.ACLIfDirective], [typeof i2.ACLDirective, typeof i3.ACLIfDirective]>;
|
|
8
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<YelonACLModule>;
|
|
9
|
-
}
|
package/src/acl.service.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { YunzaiConfigService } from '@yelon/util/config';
|
|
3
|
-
import { ACLCanType, ACLType } from './acl.type';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
/**
|
|
6
|
-
* ACL 控制服务,[在线文档](https://ng.yunzainfo.com/acl)
|
|
7
|
-
*/
|
|
8
|
-
export declare class ACLService {
|
|
9
|
-
private options;
|
|
10
|
-
private roles;
|
|
11
|
-
private abilities;
|
|
12
|
-
private full;
|
|
13
|
-
private aclChange;
|
|
14
|
-
/** ACL变更通知 */
|
|
15
|
-
get change(): Observable<ACLType | boolean | null>;
|
|
16
|
-
/** 获取所有数据 */
|
|
17
|
-
get data(): {
|
|
18
|
-
full: boolean;
|
|
19
|
-
roles: string[];
|
|
20
|
-
abilities: Array<string | number>;
|
|
21
|
-
};
|
|
22
|
-
get guard_url(): string;
|
|
23
|
-
constructor(configSrv: YunzaiConfigService);
|
|
24
|
-
private parseACLType;
|
|
25
|
-
/**
|
|
26
|
-
* 设置当前用户角色或权限能力(会先清除所有)
|
|
27
|
-
*/
|
|
28
|
-
set(value: ACLType): void;
|
|
29
|
-
/**
|
|
30
|
-
* 标识当前用户为全量,即不受限
|
|
31
|
-
*/
|
|
32
|
-
setFull(val: boolean): void;
|
|
33
|
-
/**
|
|
34
|
-
* 设置当前用户权限能力(会先清除所有)
|
|
35
|
-
*/
|
|
36
|
-
setAbility(abilities: Array<number | string>): void;
|
|
37
|
-
/**
|
|
38
|
-
* 设置当前用户角色(会先清除所有)
|
|
39
|
-
*/
|
|
40
|
-
setRole(roles: string[]): void;
|
|
41
|
-
/**
|
|
42
|
-
* 为当前用户增加角色或权限能力
|
|
43
|
-
*/
|
|
44
|
-
add(value: ACLType): void;
|
|
45
|
-
/**
|
|
46
|
-
* 为当前用户附加角色
|
|
47
|
-
*/
|
|
48
|
-
attachRole(roles: string[]): void;
|
|
49
|
-
/**
|
|
50
|
-
* 为当前用户附加权限
|
|
51
|
-
*/
|
|
52
|
-
attachAbility(abilities: Array<number | string>): void;
|
|
53
|
-
/**
|
|
54
|
-
* 为当前用户移除角色
|
|
55
|
-
*/
|
|
56
|
-
removeRole(roles: string[]): void;
|
|
57
|
-
/**
|
|
58
|
-
* 为当前用户移除权限
|
|
59
|
-
*/
|
|
60
|
-
removeAbility(abilities: Array<number | string>): void;
|
|
61
|
-
/**
|
|
62
|
-
* 当前用户是否有对应角色,其实 `number` 表示Ability
|
|
63
|
-
*
|
|
64
|
-
* - 当 `full: true` 或参数 `null` 时返回 `true`
|
|
65
|
-
* - 若使用 `ACLType` 参数,可以指定 `mode` 校验模式
|
|
66
|
-
*/
|
|
67
|
-
can(roleOrAbility: ACLCanType | null): boolean;
|
|
68
|
-
/** @inner */
|
|
69
|
-
parseAbility(value: ACLCanType): ACLCanType;
|
|
70
|
-
/**
|
|
71
|
-
* 当前用户是否有对应权限点
|
|
72
|
-
*/
|
|
73
|
-
canAbility(value: ACLCanType): boolean;
|
|
74
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ACLService, never>;
|
|
75
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ACLService>;
|
|
76
|
-
}
|
package/src/acl.type.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NOTE:`ACLType` 类型可能会被其他类库所引用,为了减少类库间彼此的依赖性,其他类库会以复制的形式存在
|
|
3
|
-
* 当这里有变化时,请务必同步更新,涉及:`MenuService.acl`、`util.YunzaiACLType`
|
|
4
|
-
* TODO: 尝试增加 `@yelon/core` 类库用于处理这种通用型
|
|
5
|
-
*/
|
|
6
|
-
import { Injector } from '@angular/core';
|
|
7
|
-
import { Observable } from 'rxjs';
|
|
8
|
-
import type { ACLService } from './acl.service';
|
|
9
|
-
export interface ACLType {
|
|
10
|
-
/**
|
|
11
|
-
* 角色
|
|
12
|
-
*/
|
|
13
|
-
role?: string[];
|
|
14
|
-
/**
|
|
15
|
-
* 权限点
|
|
16
|
-
*/
|
|
17
|
-
ability?: number[] | string[];
|
|
18
|
-
/**
|
|
19
|
-
* Validated against, default: `oneOf`
|
|
20
|
-
* - `allOf` the value validates against all the roles or abilities
|
|
21
|
-
* - `oneOf` the value validates against exactly one of the roles or abilities
|
|
22
|
-
*/
|
|
23
|
-
mode?: 'allOf' | 'oneOf';
|
|
24
|
-
/**
|
|
25
|
-
* 是否取反,即结果为 `true` 时表示未授权
|
|
26
|
-
*/
|
|
27
|
-
except?: boolean;
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}
|
|
30
|
-
export type ACLCanType = number | number[] | string | string[] | ACLType;
|
|
31
|
-
export type ACLGuardFunctionType = (srv: ACLService, injector: Injector) => Observable<ACLCanType>;
|
|
32
|
-
export type ACLGuardType = ACLCanType | Observable<ACLCanType> | ACLGuardFunctionType;
|
|
33
|
-
export interface ACLGuardData {
|
|
34
|
-
guard?: ACLGuardType | null;
|
|
35
|
-
guard_url?: string | null;
|
|
36
|
-
}
|