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) { const ACLs = []; for (let key in aclList) { const acl = await Self.app.models.ACL.findOne({where: {principalId: key}}); if (acl) ACLs.push(acl); } return ACLs; }; };