import {AnalyticalScope, Behavior, Visible} from "@webbpm/base-package";
import {AuthorizationService} from "../modules/app/service/authorization.service";

@AnalyticalScope(Behavior)
export class ErvuCheckUserPermission extends Behavior{
  private authService: AuthorizationService;

  public initialize(): void {
    super.initialize();
    this.authService = this.injector.get(AuthorizationService);
  }

  @Visible()
  public hasPermissions(roles: string[]): boolean {
    return this.authService.hasAnyPermission(roles);
  }
}
