-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.d.ts
69 lines (68 loc) · 1.85 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { Enforcer } from 'casbin';
declare module 'egg' {
interface ZroleConfig {
/**
* If you need to use adapter instead of policy file
* Make it to true, then you also need to config adapterConfig method
*/
useAdapter?: boolean;
/**
* If you need Anonymous role
* that you can set some permission that all people can
* Make it to true
*/
useAnonymous?: boolean;
/**
* If you need init policy, before your project start
* Make it to true, then you also need to config initPolicy method
*/
usePolicyInit?: boolean;
/**
* If you need make the response that response someone has no permisson by yourself
* Make it to true, then you alse need to config customResponse method
*/
useCustomResponse?: boolean;
/**
* Casbin model config file path
*/
model: string;
/**
* Casbin policy config file path
*/
policy?: string;
/**
* If you don't want to zrole auto add the middleware, make it to false
*/
useAutoMiddleware?: boolean;
/**
* If you want to set a super manage role to jump role check
*/
useSuperManage?: string;
/**
* Config adapter instead of policy file
*/
adapterConfig(): object;
/**
* Use it to setting how to get user role
* If not set, it will use default method to get user
* @param {object} ctx Egg context
*/
getUser(ctx: object): string;
/**
* If you need init policy, before your project start
* @param {object} ctx Egg context
*/
initPolicy(ctx: object): void;
/**
* Config it to response someone has no permisson by yourself
* @param {object} ctx Egg context
*/
customResponse(ctx: object): void;
}
interface Application {
zrole: Enforcer;
}
interface EggAppConfig {
zrole: ZroleConfig;
}
}