[Provider] Add access checks for tabs (#1095)

This commit is contained in:
Oscar Hinton 2021-07-23 20:01:47 +02:00 committed by GitHub
parent 218259fc7e
commit d31150c7a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -22,13 +22,13 @@
{{'clients' | i18n}}
</a>
</li>
<li class="nav-item">
<li class="nav-item" *ngIf="showManageTab">
<a class="nav-link" [routerLink]="manageRoute" routerLinkActive="active">
<i class="fa fa-sliders" aria-hidden="true"></i>
{{'manage' | i18n}}
</a>
</li>
<li class="nav-item">
<li class="nav-item" *ngIf="showSettingsTab">
<a class="nav-link" routerLink="settings" routerLinkActive="active">
<i class="fa fa-cogs" aria-hidden="true"></i>
{{'settings' | i18n}}

View File

@ -1,8 +1,4 @@
import {
Component,
NgZone,
} from '@angular/core';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { UserService } from 'jslib-common/abstractions/user.service';
@ -33,7 +29,15 @@ export class ProvidersLayoutComponent {
}
get showMenuBar() {
return true; // TODO: Replace with permissions
return this.showManageTab || this.showSettingsTab;
}
get showManageTab() {
return this.provider.canManageUsers || this.provider.canAccessEventLogs;
}
get showSettingsTab() {
return this.provider.isProviderAdmin;
}
get manageRoute(): string {