Added back route to be able to get user roles
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
4334907d91
commit
2b05cb9655
|
@ -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;
|
||||
};
|
||||
};
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue