Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class AppComponent extends Whitelabelled implements OnInit {
this.toastService.loaderSubject.subscribe(visible => {
this.blockingLoaderVisible = visible
})
this.validateRoles()
}

ngOnInit(): void {
Expand Down Expand Up @@ -75,4 +76,10 @@ export class AppComponent extends Whitelabelled implements OnInit {
}

}

validateRoles(): void {
if (this.authService.getRole() === null && this.authService.currentAuthToken()) {
this.router.navigate(["/logout"])
}
}
}
2 changes: 1 addition & 1 deletion ui/src/app/auth/auth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AuthService extends Whitelabelled implements IAuthService {
if (ENABLE_ROLES) {
const allowedRoles = ActionByRoles.get(buttonAction) ?? [];
const userRoles = this.getRole()?.split(",");
return this.hasRole(allowedRoles, userRoles);
return this.hasRole(allowedRoles, userRoles ?? []);
}
return true;
}
Expand Down