Skip to content

Commit 34b5870

Browse files
committed
Check that unions exists before promisifying.
1 parent 354f6cc commit 34b5870

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/acl.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ var Acl = function (backend, logger, options){
6565
backend.getAsync = bluebird.promisify(backend.get);
6666
backend.cleanAsync = bluebird.promisify(backend.clean);
6767
backend.unionAsync = bluebird.promisify(backend.union);
68-
backend.unionsAsync = bluebird.promisify(backend.unions);
68+
if (backend.unions) {
69+
backend.unionsAsync = bluebird.promisify(backend.unions);
70+
}
6971
};
7072

7173
/**
@@ -432,7 +434,7 @@ Acl.prototype.allowedPermissions = function(userId, resources, cb){
432434
.params('string|number', 'string|array')
433435
.end();
434436

435-
if (this.backend.unions) {
437+
if (this.backend.unionsAsync) {
436438
return this.optimizedAllowedPermissions(userId, resources, cb);
437439
}
438440

0 commit comments

Comments
 (0)