Handling owner being a relation/function

This commit is contained in:
Benjamin Boudreau 2015-03-11 10:25:11 -04:00
parent b08861a1b1
commit 2d08e656b8
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 {