fix for issue #2152

pull/2197/head
Anojh 7 years ago
parent e8acf79dc8
commit 680c0abd05

@ -1,4 +1,4 @@
<div class="{{ user.name && (hasRole('Admin') || hasRole('PowerUser')) ? 'adminUser' : 'user'}}"> <div [ngClass]="user.name && roleClass()">
<p-growl [value]="notificationService.messages" [life]="3000"></p-growl> <p-growl [value]="notificationService.messages" [life]="3000"></p-growl>
<nav *ngIf="showNav" class="navbar navbar-default navbar-fixed-top"> <nav *ngIf="showNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid"> <div class="container-fluid">

@ -73,6 +73,15 @@ export class AppComponent implements OnInit {
}); });
} }
public roleClass() {
if (this.user.roles.some(r => r === 'Admin')) {
return "adminUser";
} else if (this.user.roles.some(r => r === 'PowerUser')) {
return "powerUser";
}
return "user";
}
public hasRole(role: string): boolean { public hasRole(role: string): boolean {
return this.user.roles.some(r => r === role); return this.user.roles.some(r => r === role);
} }

Loading…
Cancel
Save