L'onglet catalogue ne s'affiche plus lorsque l'utilisateur n'a pas les permissions nécessaires.
This commit is contained in:
parent
d1ca6e7ad1
commit
e0a6dfffae
|
@ -3,13 +3,15 @@
|
|||
<div class="spacer"></div>
|
||||
<div mat-tab-nav-bar backgroundColor="primary">
|
||||
<ng-container *ngFor="let link of links">
|
||||
<a
|
||||
*ngIf="link.enabled"
|
||||
mat-tab-link
|
||||
[active]="activeLink.startsWith(link.route)"
|
||||
(click)="activeLink = link.route">
|
||||
{{ link.title }}
|
||||
</a>
|
||||
<ng-container *ngIf="link.route !== '/catalog' || catalogEnabled">
|
||||
<a
|
||||
*ngIf="link.enabled"
|
||||
mat-tab-link
|
||||
[active]="activeLink.startsWith(link.route)"
|
||||
(click)="activeLink = link.route">
|
||||
{{ link.title }}
|
||||
</a>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -12,6 +12,8 @@ import {ErrorService} from '../../service/error.service'
|
|||
styleUrls: ['./header.component.sass']
|
||||
})
|
||||
export class HeaderComponent extends SubscribingComponent {
|
||||
catalogEnabled = false
|
||||
|
||||
links: HeaderLink[] = [
|
||||
{route: '/color', title: 'Couleurs', requiredPermission: EmployeePermission.VIEW_RECIPE},
|
||||
{route: '/catalog', title: 'Catalogue', enabled: true},
|
||||
|
@ -81,6 +83,10 @@ export class HeaderComponent extends SubscribingComponent {
|
|||
l.enabled = employee && employee.permissions.indexOf(l.requiredPermission) >= 0
|
||||
}
|
||||
})
|
||||
|
||||
this.catalogEnabled = this.accountService.hasPermission(EmployeePermission.VIEW_MATERIAL_TYPE) ||
|
||||
this.accountService.hasPermission(EmployeePermission.VIEW_MATERIAL) ||
|
||||
this.accountService.hasPermission(EmployeePermission.VIEW_COMPANY)
|
||||
}
|
||||
|
||||
private link(route: string) {
|
||||
|
|
Loading…
Reference in New Issue