UNPKG

bfend

Version:

Admin template base on ng-zorro-antd

50 lines (49 loc) 1.03 kB
import { Observable } from 'rxjs'; export interface ACLType { /** * 角色 */ roles?: string[]; /** * 权限点 */ abilities?: string[]; /** * 是否超级用户 */ super?: boolean; } /** * 访问控制服务 */ export declare class BfACLService { rules$: Observable<ACLType>; private rules; private updateSubject; private setSubject; private cleanSubject; private addSubject; constructor(); /** * 设置当前用户角色或权限能力(会先清除所有) */ set(value: ACLType): void; /** * 清除所有权限 */ clean(): void; /** * 为当前用户增加角色或权限能力 */ add(value: ACLType): void; /** * 当前用户是否有对应权限 * 支持 ability.* 通配符 */ can(abilityOrAcl: string | string[] | ACLType): boolean; /** * 当前用户是否拥有某个角色 */ is(role: string | string[]): boolean; private addMutation; }