mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-11 22:37:31 +08:00
Add missing overload to whatResource method in acl
This commit is contained in:
5
types/acl/index.d.ts
vendored
5
types/acl/index.d.ts
vendored
@@ -50,7 +50,10 @@ interface Acl {
|
||||
allowedPermissions: (userId: Value, resources: strings, cb?: AnyCallback) => Promise<void>;
|
||||
isAllowed: (userId: Value, resources: strings, permissions: strings, cb?: AllowedCallback) => Promise<boolean>;
|
||||
areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise<any>;
|
||||
whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise<any>;
|
||||
whatResources: {
|
||||
(roles: strings, cb?: AnyCallback): Promise<any>;
|
||||
(roles: strings, permissions: strings, cb?: AnyCallback): Promise<any>;
|
||||
}
|
||||
permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise<void>;
|
||||
middleware: (numPathComponents?: number, userId?: Value | GetUserId, actions?: strings) => express.RequestHandler;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,18 @@ acl.isAllowed('joed', 'blogs', 'view', (err, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
acl.whatResources('foo', (err, res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
|
||||
acl.whatResources('foo', 'view', (err, res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
|
||||
acl.isAllowed('jsmith', 'blogs', ['edit','view','delete'])
|
||||
.then((result) => {
|
||||
console.dir('jsmith is allowed blogs ' + result);
|
||||
|
||||
Reference in New Issue
Block a user