-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
27 lines (19 loc) · 842 Bytes
/
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
export = DecisionManager;
declare class DecisionManager {
static defaultConfig: {defaultDecision: boolean, voters: Array<DecisionManager.VoterInterface>};
constructor(config?: {
defaultDecision?: boolean,
voters?: Array<DecisionManager.VoterInterface>
});
registerVoter(voter: DecisionManager.VoterInterface);
unregisterVoter(voter: DecisionManager.VoterInterface);
isAllowed(user: any, resource: any, permission: any, callback: DecisionManager.VotingResult);
}
declare namespace DecisionManager {
export interface VoterInterface {
supportsResource(resource: any): boolean;
supportsPermission(resource: any): boolean;
vote(user: any, resource: any, permission: any, callback: VotingResult);
}
type VotingResult = (err: null|Error, result: boolean) => void;
}