提交 77933783 编写于 作者: KK's avatar KK

权限基类

上级 f436bb66
import { Store } from 'vuex';
/** /**
* 权限服务基类 * 实体权限服务
* *
* @export * @export
* @class CounterService * @class AuthService
*/ */
export class AuthService { export class AuthService {
/**
* Vue 状态管理器
*
* @public
* @type {(any | null)}
* @memberof AuthService
*/
public $store: Store<any> | null = null;
/**
* 默认操作符
*
* @public
* @type {(any)}
* @memberof AuthService
*/
public defaultOPPrivs: any = { UPDATE: 1, CREATE: 1, READ: 1, DELETE: 1, WFSTART:1,DENY:1,NONE:1 };
/** /**
* Creates an instance of AuthService. * Creates an instance of AuthService.
* *
...@@ -13,20 +33,61 @@ export class AuthService { ...@@ -13,20 +33,61 @@ export class AuthService {
* @memberof AuthService * @memberof AuthService
*/ */
constructor(opts: any = {}) { constructor(opts: any = {}) {
this.$store = opts.$store;
}
/**
* 获取状态管理器
*
* @returns {(any | null)}
* @memberof AuthService
*/
public getStore(): Store<any> | null {
return this.$store;
} }
/** /**
* 获取计数器服务 * 获取实体权限服务
* *
* @protected
* @param {string} name 实体名称 * @param {string} name 实体名称
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof AuthService * @memberof AuthService
*/ */
public getService(name: string): Promise<any> { public getService(name: string): Promise<any> {
return window.authServiceConstructor.getService(name); return (window as any)['authServiceRegister'].getService(name);
}
/**
* 根据当前数据获取实体操作标识
*
* @param {string} name 实体名称
* @returns {any}
* @memberof AuthService
*/
public getOPPrivs(data: any): any {
return null;
} }
/**
* 根据菜单项获取菜单权限
*
* @param {*} item 菜单标识
* @returns {boolean}
* @memberof AuthService
*/
public getMenusPermission(item: any): boolean {
return true;
}
/**
* 根据统一资源标识获取统一资源权限
*
* @param {*} tag 统一资源标识
* @returns {boolean}
* @memberof AuthService
*/
public getResourcePermission(tag: any): boolean {
return true;
}
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册