Download User ACL #1128

Closed
pau wants to merge 2 commits from 4074-download-user-ACL into dev
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,31 @@
module.exports = Self => {
Self.remoteMethodCtx('getUserRoles', {
description: 'Gets the user roles',
accepts:
{
arg: 'ctx',
type: 'Object',
http: {source: 'context'}
},
returns: {
type: 'object',
root: true
},
http: {
path: `/getUserRoles`,
verb: 'POST'
}
});
Self.getUserRoles = async ctx => {
// Get the user from the accesstoken
const userId = ctx.req.accessToken.userId;
// Get the user roles
const roles = await Self.getRoles(userId, {
ctx: ctx
});
return roles;
};
};

View File

@ -8,6 +8,7 @@ module.exports = Self => {
require('../methods/account/set-password')(Self);
require('../methods/account/validate-token')(Self);
require('../methods/account/privileges')(Self);
require('../methods/account/getRoles')(Self);
// Validations