created new service and removed unused back route

This commit is contained in:
Pau 2022-12-26 12:36:02 +01:00
parent 9ababe7e67
commit 93de49eb98
4 changed files with 15 additions and 33 deletions

View File

@ -1,31 +0,0 @@
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

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

View File

@ -14,7 +14,6 @@ class AclService {
return this.$http.get('Accounts/acl').then(res => {
this.user = res.data.user;
this.roles = {};
for (let role of res.data.roles) {
if (role.role)
this.roles[role.role.name] = true;

View File

@ -0,0 +1,15 @@
import ngModule from '../module';
class UserAclService {
constructor($http) {
this.$http = $http;
this.roles = [];
}
load() {
}
}
UserAclService.$inject = ['$http'];
ngModule.service('userAclService', UserAclService);