[ADF-5009] close all the dialogs after false canActivate event (#5312)

* close all the dialogs after false canActivate event

* Update auth-guard-bpm.service.spec.ts

* sso fix

* fix lint
This commit is contained in:
Eugenio Romano
2020-01-02 11:21:10 +01:00
committed by Denys Vuika
parent d7e56b641e
commit 9c83c35e61
8 changed files with 86 additions and 11 deletions

View File

@@ -18,12 +18,16 @@
import { Injectable } from '@angular/core';
import { JwtHelperService } from './jwt-helper.service';
import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
import { MatDialog } from '@angular/material';
@Injectable({
providedIn: 'root'
})
export class AuthGuardSsoRoleService implements CanActivate {
constructor(private jwtHelperService: JwtHelperService, private router: Router, private dialog: MatDialog) {
}
canActivate(route: ActivatedRouteSnapshot): boolean {
let hasRole;
let hasRealmRole = false;
@@ -48,9 +52,10 @@ export class AuthGuardSsoRoleService implements CanActivate {
this.router.navigate(['/' + route.data['redirectUrl']]);
}
if (!hasRole) {
this.dialog.closeAll();
}
return hasRole;
}
constructor(private jwtHelperService: JwtHelperService, private router: Router) {
}
}