created new service and removed unused back route
This commit is contained in:
parent
9ababe7e67
commit
93de49eb98
|
@ -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;
|
||||
};
|
||||
};
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
Loading…
Reference in New Issue