|
|
|
@ -61,12 +61,10 @@ export class AppComponent implements OnInit {
|
|
|
|
|
public ngOnInit() {
|
|
|
|
|
const theme = localStorage.getItem("theme");
|
|
|
|
|
this.onSetTheme(theme);
|
|
|
|
|
this.user = this.authService.claims();
|
|
|
|
|
this.isAdmin = this.authService.hasRole("admin");
|
|
|
|
|
|
|
|
|
|
this.settingsService.getCustomization().subscribe(x => {
|
|
|
|
|
this.customizationSettings = x;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.customizationSettings && this.customizationSettings.applicationName) {
|
|
|
|
|
this.applicationName = this.customizationSettings.applicationName;
|
|
|
|
|
}
|
|
|
|
@ -88,10 +86,11 @@ export class AppComponent implements OnInit {
|
|
|
|
|
this.currentUrl = event.url;
|
|
|
|
|
if (event instanceof NavigationStart) {
|
|
|
|
|
this.user = this.authService.claims();
|
|
|
|
|
this.isAdmin = this.authService.hasRole("admin");
|
|
|
|
|
this.showNav = this.authService.loggedIn();
|
|
|
|
|
|
|
|
|
|
// tslint:disable-next-line:no-string-literal
|
|
|
|
|
if (this.user !== null && this.user.name && !this.checkedForUpdate && this.user.roles["Admin"]) {
|
|
|
|
|
if (this.user !== null && this.user.name && !this.checkedForUpdate && this.isAdmin) {
|
|
|
|
|
this.checkedForUpdate = true;
|
|
|
|
|
this.jobService.getCachedUpdate().subscribe(x => {
|
|
|
|
|
this.updateAvailable = x;
|
|
|
|
@ -103,18 +102,16 @@ 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";
|
|
|
|
|
if (this.user) {
|
|
|
|
|
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 {
|
|
|
|
|
return this.user.roles.some(r => r === role);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public openMobileApp(event: any) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
if (!this.customizationSettings.applicationUrl) {
|
|
|
|
|