Merge pull request #1201 from seriousben/strengthen_owner_role_check

Handling owner being a relation/function
This commit is contained in:
Raymond Feng 2015-03-11 09:03:19 -07:00
commit 8bfa3ba8d7
1 changed files with 2 additions and 1 deletions

View File

@ -161,7 +161,8 @@ module.exports = function(Role) {
}
debug('Model found: %j', inst);
var ownerId = inst.userId || inst.owner;
if (ownerId) {
// Ensure ownerId exists and is not a function/relation
if (ownerId && 'function' !== typeof ownerId) {
if (callback) callback(null, matches(ownerId, userId));
return;
} else {