refs #4074 @1h add method to retrieve a object containing all the roles
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2022-12-29 13:50:49 +01:00
parent 3c2981953d
commit db7fc594c8
1 changed files with 10 additions and 0 deletions

View File

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