24 lines
1014 B
TypeScript
24 lines
1014 B
TypeScript
import { AccessControl, IQueryInfo, Permission } from 'role-acl';
|
|
import { Query } from 'role-acl/lib/src/core/Query';
|
|
import { Request, RequestHandler } from 'express';
|
|
export declare class PermissionManager extends AccessControl {
|
|
can(roleOrRequest: Request | string | string[] | IQueryInfo): PermQuery;
|
|
getRouter(resource: string, opts?: Partial<RermRouterOpts>): RequestHandler;
|
|
}
|
|
export declare type RermRouterOpts = {
|
|
context: unknown;
|
|
action: string;
|
|
skipConditions: boolean;
|
|
};
|
|
export declare class PermQuery extends Query {
|
|
protected resolveRequest: Request | undefined;
|
|
constructor(grants: unknown, roleOrRequest: Request | string | string[] | IQueryInfo);
|
|
on(resource: string, skipConditions?: boolean): Promise<Permission>;
|
|
context(context: unknown): PermQuery;
|
|
skipConditions(value: boolean): PermQuery;
|
|
with(context: unknown): PermQuery;
|
|
execute(action: string): PermQuery;
|
|
sync(): PermQuery;
|
|
}
|
|
export declare const PermManager: PermissionManager;
|