Untitled

mail@pastecode.io avatar
unknown
typescript
a year ago
906 B
2
Indexable
Never
filterNodesByRole() {
    this.navigationBarList = this.navigationBarList.filter(
      node => {
        if (AppUtils.getCurrentStore().navigationTabsAccess[node.url]) {
          if (AppUtils.getCurrentStore().navigationTabsAccess[node.url].blocked) {
            for (let role of AppUtils.getCurrentStore().navigationTabsAccess[node.url].blocked) {
              if (this.companyRoles.includes(<EUserRoles>role)) {
                return false;
              }
            }
          }
          if (AppUtils.getCurrentStore().navigationTabsAccess[node.url].enabled) {
            for (let role of AppUtils.getCurrentStore().navigationTabsAccess[node.url].enabled) {
              if (this.companyRoles.includes(<EUserRoles>role)) {
                return true;
              }
            }
            return false;
          }
        }
        return true;
      }
    );
  }