diff --git a/lib/core/services/auth-guard-sso-role.service.ts b/lib/core/services/auth-guard-sso-role.service.ts index d3a496314b..06b94792cf 100644 --- a/lib/core/services/auth-guard-sso-role.service.ts +++ b/lib/core/services/auth-guard-sso-role.service.ts @@ -26,7 +26,7 @@ import { StorageService } from './storage.service'; export class AuthGuardSsoRoleService implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { - let hasRole = false; + let hasRole; let hasRealmRole = false; let hasClientRole = true; diff --git a/lib/core/services/auth-guard.service.spec.ts b/lib/core/services/auth-guard.service.spec.ts index 8d1edcbab8..0982890a4f 100644 --- a/lib/core/services/auth-guard.service.spec.ts +++ b/lib/core/services/auth-guard.service.spec.ts @@ -66,7 +66,7 @@ describe('AuthGuardService', () => { spyOn(authService, 'isBpmLoggedIn').and.returnValue(true); appConfigService.config.auth.withCredentials = true; - const route: RouterStateSnapshot = {url : 'some-url'}; + const route: RouterStateSnapshot = { url: 'some-url' }; expect(authGuard.canActivate(null, route)).toBeTruthy(); })); diff --git a/lib/core/services/auth-guard.service.ts b/lib/core/services/auth-guard.service.ts index f526d86c65..6e31997e4a 100644 --- a/lib/core/services/auth-guard.service.ts +++ b/lib/core/services/auth-guard.service.ts @@ -26,10 +26,40 @@ import { AuthGuardBase } from './auth-guard-base'; providedIn: 'root' }) export class AuthGuard extends AuthGuardBase { + + ticketChangeBind: any; + constructor(authenticationService: AuthenticationService, router: Router, appConfigService: AppConfigService) { super(authenticationService, router, appConfigService); + this.ticketChangeBind = this.ticketChange.bind(this); + + window.addEventListener('storage', this.ticketChangeBind); + } + + ticketChange(event: StorageEvent) { + if (event.key === 'ticket-ECM' && event.newValue !== event.oldValue) { + this.ticketChangeRedirect(event, 'ECM'); + } + + if (event.key === 'ticket-BPM' && event.newValue !== event.oldValue) { + this.ticketChangeRedirect(event, 'BPM'); + } + + if (event.key === 'access_token' && event.newValue !== event.oldValue) { + this.ticketChangeRedirect(event, 'ALL'); + } + } + + private ticketChangeRedirect(event: StorageEvent, provider: string) { + if (!event.newValue) { + this.redirectToUrl(provider, this.router.url); + } else { + window.location.reload(); + } + + window.removeEventListener('storage', this.ticketChangeBind); } checkLogin(activeRoute: ActivatedRouteSnapshot, redirectUrl: string): Observable | Promise | boolean { diff --git a/scripts/i18n/extract-langs.sh b/scripts/i18n/extract-langs.sh index 6eba7f61d4..35482b6b0d 100755 --- a/scripts/i18n/extract-langs.sh +++ b/scripts/i18n/extract-langs.sh @@ -25,11 +25,11 @@ while [[ $1 == -* ]]; do esac done -COMPONENTS_ROOT="$DIR/../lib" +COMPONENTS_ROOT="$DIR/../../lib" # Find all directories in $COMPONENTS_ROOT called i18n and add the demo-shell manually COMPONENTS=(`find $COMPONENTS_ROOT -type d -name i18n -not \( -name '*.*' -o -path '**/node_modules*' -o -path '**/bundles*' \)`) -COMPONENTS+=("$DIR/../demo-shell/resources/i18n") +COMPONENTS+=("$DIR/../../demo-shell/resources/i18n") # Loop the individual components for COMPONENT_DIR in "${COMPONENTS[@]}"