@delon/acl
Version:
A simple role-based access control.
1 lines • 24.7 kB
Source Map (JSON)
{"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 { AlainACLConfig } from '@delon/util/config';\n\nexport const ACL_DEFAULT_CONFIG: AlainACLConfig = {\n guard_url: `/403`\n};\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { AlainACLConfig, AlainConfigService } from '@delon/util/config';\n\nimport { ACL_DEFAULT_CONFIG } from './acl.config';\nimport { ACLCanType, ACLType } from './acl.type';\n\n/**\n * ACL 控制服务,[在线文档](https://ng-alain.com/acl)\n */\n@Injectable({ providedIn: 'root' })\nexport class ACLService {\n private options: AlainACLConfig;\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: AlainConfigService) {\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.AlainACLType`\n * TODO: 尝试增加 `@delon/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-alain.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-alain.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-alain.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 DelonACLModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAEa,MAAA,kBAAkB,GAAmB;AAChD,IAAA,SAAS,EAAE,CAAM,IAAA;;;ACKnB;;AAEG;MAEU,UAAU,CAAA;AACb,IAAA,OAAO;IACP,KAAK,GAAa,EAAE;IACpB,SAAS,GAA2B,EAAE;IACtC,IAAI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