SUPPORT-8956: check role?

This commit is contained in:
adel.kalimullin 2025-02-27 14:54:30 +03:00
parent 6301122e84
commit 1a97931705
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,17 @@
import {AnalyticalScope, Behavior, Visible} from "@webbpm/base-package";
import {AuthorizationService} from "../modules/app/service/authorization.service";
@AnalyticalScope(Behavior)
export class ErvuCheckUserRole extends Behavior{
private authService: AuthorizationService;
public initialize(): void {
super.initialize();
this.authService = this.injector.get(AuthorizationService);
}
@Visible()
public hasRole(role: string): boolean {
return this.authService.hasRole(role);
}
}

View file

@ -37,6 +37,10 @@ export class AuthorizationService {
return this.isAuthorized() && roles.some(role => this.getRoles().includes(role));
}
hasRole(role: string): boolean {
return this.isAuthorized() && this.getRoles().includes(role);
}
getName(): string {
return this.isAuthorized() ? this.session.name : null;
}