fixup! manual fixes

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
This commit is contained in:
Miroslav Bajtoš 2019-10-07 11:47:12 +02:00
parent 397d141036
commit 82cd6681f6
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
5 changed files with 8 additions and 10 deletions

View File

@ -617,7 +617,7 @@ module.exports = function(ACL) {
break; break;
default: default:
// try resolving a user model with a name matching the principalType // try resolving a user model with a name matching the principalType
var userModel = this.registry.findModel(type); const userModel = this.registry.findModel(type);
if (userModel) { if (userModel) {
userModel.findOne( userModel.findOne(
{where: {or: [{username: id}, {email: id}, {id: id}]}}, {where: {or: [{username: id}, {email: id}, {id: id}]}},

View File

@ -133,11 +133,10 @@ module.exports = function(Role) {
roleModel.roleMappingModel.find({ roleModel.roleMappingModel.find({
where: {roleId: context.id, principalType: principalType}, where: {roleId: context.id, principalType: principalType},
}, function(err, mappings) { }, function(err, mappings) {
let ids;
if (err) { if (err) {
return callback(err); return callback(err);
} }
ids = mappings.map(function(m) { const ids = mappings.map(function(m) {
return m.principalId; return m.principalId;
}); });
query.where = query.where || {}; query.where = query.where || {};

View File

@ -137,7 +137,7 @@ describe('access control - integration', function() {
return '/api/users/' + this.randomUser.id; return '/api/users/' + this.randomUser.id;
} }
let userCounter; var userCounter; // eslint-disable-line no-var
function newUserData() { function newUserData() {
userCounter = userCounter ? ++userCounter : 1; userCounter = userCounter ? ++userCounter : 1;

View File

@ -121,7 +121,7 @@ describe('DataSource', function() {
}); });
}); });
var assertValidDataSource = function(dataSource) { function assertValidDataSource(dataSource) {
// has methods // has methods
assert.isFunc(dataSource, 'createModel'); assert.isFunc(dataSource, 'createModel');
assert.isFunc(dataSource, 'discoverModelDefinitions'); assert.isFunc(dataSource, 'discoverModelDefinitions');
@ -130,7 +130,7 @@ var assertValidDataSource = function(dataSource) {
assert.isFunc(dataSource, 'disableRemote'); assert.isFunc(dataSource, 'disableRemote');
assert.isFunc(dataSource, 'defineOperation'); assert.isFunc(dataSource, 'defineOperation');
assert.isFunc(dataSource, 'operations'); assert.isFunc(dataSource, 'operations');
}; }
assert.isFunc = function(obj, name) { assert.isFunc = function(obj, name) {
assert(obj, 'cannot assert function ' + name + ' on object that doesnt exist'); assert(obj, 'cannot assert function ' + name + ' on object that doesnt exist');

View File

@ -1012,13 +1012,12 @@ describe('role model', function() {
it('should fetch all models assigned to the role', function(done) { it('should fetch all models assigned to the role', function(done) {
const principalTypesToModels = {}; const principalTypesToModels = {};
let runs = 0; let runs = 0;
let mappings;
principalTypesToModels[RoleMapping.USER] = User; principalTypesToModels[RoleMapping.USER] = User;
principalTypesToModels[RoleMapping.APPLICATION] = Application; principalTypesToModels[RoleMapping.APPLICATION] = Application;
principalTypesToModels[RoleMapping.ROLE] = Role; principalTypesToModels[RoleMapping.ROLE] = Role;
mappings = Object.keys(principalTypesToModels); const mappings = Object.keys(principalTypesToModels);
mappings.forEach(function(principalType) { mappings.forEach(function(principalType) {
const Model = principalTypesToModels[principalType]; const Model = principalTypesToModels[principalType];
@ -1047,12 +1046,12 @@ describe('role model', function() {
it('should fetch all models only assigned to the role', function(done) { it('should fetch all models only assigned to the role', function(done) {
const principalTypesToModels = {}; const principalTypesToModels = {};
let mappings;
principalTypesToModels[RoleMapping.USER] = User; principalTypesToModels[RoleMapping.USER] = User;
principalTypesToModels[RoleMapping.APPLICATION] = Application; principalTypesToModels[RoleMapping.APPLICATION] = Application;
principalTypesToModels[RoleMapping.ROLE] = Role; principalTypesToModels[RoleMapping.ROLE] = Role;
mappings = Object.keys(principalTypesToModels);
const mappings = Object.keys(principalTypesToModels);
async.each(mappings, function(principalType, eachCallback) { async.each(mappings, function(principalType, eachCallback) {
const Model = principalTypesToModels[principalType]; const Model = principalTypesToModels[principalType];