import {AnalyticalScope, Behavior, Source, 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(@Source("roles") role: string): boolean {
    return this.authService.hasRole(role);
  }
}
