From 98bdf484279da664100ddfc5dd28dfe7f348ab5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ondrej=20Slint=C3=A1k?= Date: Thu, 24 Aug 2017 20:58:38 +0200 Subject: [PATCH] Add missing overload to whatResource method in acl --- types/acl/index.d.ts | 5 ++++- types/acl/test/index.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/types/acl/index.d.ts b/types/acl/index.d.ts index 3aa81de8e3..43de3f5369 100644 --- a/types/acl/index.d.ts +++ b/types/acl/index.d.ts @@ -50,7 +50,10 @@ interface Acl { allowedPermissions: (userId: Value, resources: strings, cb?: AnyCallback) => Promise; isAllowed: (userId: Value, resources: strings, permissions: strings, cb?: AllowedCallback) => Promise; areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise; - whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise; + whatResources: { + (roles: strings, cb?: AnyCallback): Promise; + (roles: strings, permissions: strings, cb?: AnyCallback): Promise; + } permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise; middleware: (numPathComponents?: number, userId?: Value | GetUserId, actions?: strings) => express.RequestHandler; } diff --git a/types/acl/test/index.ts b/types/acl/test/index.ts index c29574326d..bb3e6fa54e 100644 --- a/types/acl/test/index.ts +++ b/types/acl/test/index.ts @@ -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);