From f7a2c2d1651c2fb3b08eac6577c40aff282ed371 Mon Sep 17 00:00:00 2001 From: Asaduzzaman Pavel Date: Sat, 14 Jan 2017 02:50:45 +0600 Subject: [PATCH] Update utils.js --- lib/utils.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index 8a88956..38fc3dd 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -283,6 +283,16 @@ module.exports = class AccessUtils { const roleName = this.extractRoleName(role); const GroupAccess = this.app.models[this.options.groupAccessModel]; const scope = { }; + + + // No modelClass is present + if (!modelClass) { + process.nextTick(() => { + debug('Deny access for anonymous user'); + cb(null, false); + }); + return cb.promise; + } debug(`Role resolver for ${role}: evaluate ${modelClass.modelName} with id: ${modelId} for user: ${userId}`);