module.exports = Self => { Self.remoteMethod('userAcl', { description: 'Get all of the current user permissions', accepts: [ { arg: 'ctx', type: 'Object', http: {source: 'context'} }, { arg: 'aclList', type: 'Object', required: true, } ], returns: { type: 'Object', root: true }, http: { path: '/user/acl', verb: 'POST' } }); Self.userAcl = async function(ctx, aclList) { let models = Self.app.models; let ACLs = []; for (let key in aclList) { let acl = await models.acls.findOne({ where: { principalId: key, } }); if (acl) ACLs.push(acl); } return ACLs; }; };