[ADF-2904] Search - redirect breaks application (#3268)

* set navigation commands over plain string

* fix test

* lint
This commit is contained in:
Cilibiu Bogdan
2018-05-08 16:46:35 +03:00
committed by Eugenio Romano
parent c90ad3f875
commit d456b3cba1
12 changed files with 205 additions and 105 deletions

View File

@@ -33,7 +33,7 @@ const REMEMBER_ME_UNTIL = 1000 * 60 * 60 * 24 * 30 ;
@Injectable()
export class AuthenticationService {
private redirectUrl: RedirectionModel = null;
private redirect: RedirectionModel = null;
onLogin: Subject<any> = new Subject<any>();
onLogout: Subject<any> = new Subject<any>();
@@ -246,24 +246,24 @@ export class AuthenticationService {
/** Sets the URL to redirect to after login.
* @param url URL to redirect to
*/
setRedirectUrl(url: RedirectionModel) {
this.redirectUrl = url;
setRedirect(url: RedirectionModel) {
this.redirect = url;
}
/** Gets the URL to redirect to after login.
* @param provider Service provider. Can be "ECM", "BPM" or "ALL".
* @returns The redirect URL
*/
getRedirectUrl(provider: string): string {
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
getRedirect(provider: string): any[] {
return this.hasValidRedirection(provider) ? this.redirect.navigation : null;
}
private hasValidRedirection(provider: string): boolean {
return this.redirectUrl && (this.redirectUrl.provider === provider || this.hasSelectedProviderAll(provider));
return this.redirect && (this.redirect.provider === provider || this.hasSelectedProviderAll(provider));
}
private hasSelectedProviderAll(provider: string): boolean {
return this.redirectUrl && (this.redirectUrl.provider === 'ALL' || provider === 'ALL');
return this.redirect && (this.redirect.provider === 'ALL' || provider === 'ALL');
}
/**