Refactored menus.client.service.js

This commit is contained in:
David Baldwynn 2017-04-22 19:38:37 -07:00 committed by GitHub
parent 8122044a51
commit b494b50ed5

View file

@ -15,22 +15,18 @@ angular.module('core').service('Menus', [
if (user) {
if (~this.roles.indexOf('*')) {
return true;
} else {
for (var userRoleIndex in user.roles) {
for (var roleIndex in this.roles) {
console.log(this.roles[roleIndex]);
console.log( this.roles[roleIndex] === user.roles[userRoleIndex]);
if (this.roles[roleIndex] === user.roles[userRoleIndex]) {
return true;
}
}
for (var userRoleIndex in user.roles) {
for (var roleIndex in this.roles) {
if (this.roles[roleIndex] === user.roles[userRoleIndex]) {
return true;
}
}
}
} else {
return this.isPublic;
}
return false;
return false;
}
return this.isPublic;
};
// Validate menu existance