Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
814 B
1
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){
            for (let role of AppUtils.getCurrentStore().navigationTabsAccess[node.url][navigationTabsAccessProperty]) {
              if (this.companyRoles.includes(<EUserRoles>role)){
                return navigationTabsAccessProperty !== blocked;
              }
            }
          }
        }
    );
  }