Fix user not allowed to delete itself if user
**Note: the only code required for the fix is in role.js:203**. The other changes are to help organize debug output.
This commit is contained in:
parent
ad58a8ec13
commit
b62b8fa47d
|
@ -34,7 +34,7 @@
|
||||||
var loopback = require('../loopback');
|
var loopback = require('../loopback');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var debug = require('debug')('acl');
|
var debug = require('debug')('loopback:security:acl');
|
||||||
|
|
||||||
var ctx = require('./access-context');
|
var ctx = require('./access-context');
|
||||||
var AccessContext = ctx.AccessContext;
|
var AccessContext = ctx.AccessContext;
|
||||||
|
@ -242,7 +242,7 @@ ACL.getStaticACLs = function getStaticACLs(model, property) {
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
debug('getStaticACLs() returns: %s', staticACLs);
|
debug('getStaticACLs() returns: %j', staticACLs);
|
||||||
return staticACLs;
|
return staticACLs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var loopback = require('../loopback');
|
var loopback = require('../loopback');
|
||||||
var debug = require('debug')('role');
|
var debug = require('debug')('loopback:security:role');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ Role.isOwner = function isOwner(modelClass, modelId, userId, callback) {
|
||||||
// Is the modelClass User or a subclass of User?
|
// Is the modelClass User or a subclass of User?
|
||||||
if(isUserClass(modelClass)) {
|
if(isUserClass(modelClass)) {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
callback(null, modelId === userId);
|
callback(null, modelId == userId);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue