Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
826 B
3
Indexable
Never
filterNodesByRole() {
    this.navigationBarList = this.navigationBarList.filter(
      node => {
          if (!AppUtils.getCurrentStore().navigationTabsAccess[node.url]){
            return true;
          }

          const navigationTabsAccessProperty = AppUtils.getCurrentStore().navigationTabsAccess[node.url].blocked ? 
            'blocked' : (AppUtils.getCurrentStore().navigationTabsAccess[node.url].enabled ? 'enabled' : null);
          if (!navigationTabsAccessProperty){
            return;
          }
          for (let role of AppUtils.getCurrentStore().navigationTabsAccess[node.url][navigationTabsAccessProperty]) {
            if (this.companyRoles.includes(<EUserRoles>role)){
              return navigationTabsAccessProperty !== blocked;
            }
          }
        }
    );
  }