-
Notifications
You must be signed in to change notification settings - Fork 19
/
typings.d.ts
53 lines (32 loc) · 1.3 KB
/
typings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
declare module "virgen-acl" {
export interface IResourceProp {
resource_id:string;
}
export interface IResourceGetter {
getResourceId():string;
}
export type IResource = IResourceGetter | IResourceProp | string
export interface IRoleProp {
role_id:string;
}
export interface IRoleGetter {
getRoleId(): string | Array<string>;
}
export type IRole = IRoleGetter | IRoleProp | string
export interface IQueryCallback {
(err?:Error, result?:boolean): void
}
export interface IAssertion<Ro extends IRole, Re extends IResource> {
(err:Error, role:Ro, resource:Re, action:string, result:IAssertionResult, next:Function): void
}
export interface IAssertionResult {
(error?:Error, result?:boolean): void
}
export class Acl {
addRole(role:string, parent?:string):void
addResource(resource:string, parent?:string):void
allow<Ro extends IRole, Re extends IResource> (role?:string | Array<string>, resource?:string, actions?:string | string[], assertion?:boolean|IAssertion<Ro, Re>):void
deny<Ro extends IRole, Re extends IResource> (role?:string | Array<string>, resource?:string, actions?:string[], assertion?:boolean|IAssertion<Ro, Re>):void
query(role:IRole | Array<IRole>, resource:IResource, action:string, done:IQueryCallback):void
}
}