[Trunk|Library]: CanLoad does not work in connect guards, maybe it works in angular 6

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54912 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-02-26 15:25:52 +00:00
parent 0bddc14435
commit 75533e17bf
9 changed files with 163 additions and 216 deletions

View File

@ -1,136 +1,78 @@
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http'; import {Http} from '@angular/http';
import {Headers, RequestOptions} from '@angular/http';
import {Observable} from 'rxjs/Rx';
import {CommunityInfo} from '../community/communityInfo'; import {CommunityInfo} from '../community/communityInfo';
import{EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
@Injectable() @Injectable()
export class CommunitiesService { export class CommunitiesService {
constructor(private http:Http) { constructor(private http: Http) {
} }
getCommunities(properties:EnvProperties, url: string) { getCommunities(properties: EnvProperties, url: string) {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)) : url) return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.map(res => <any> res.json()).map(res => this.parseCommunities(res)); .map(res => <any> res.json()).map(res => this.parseCommunities(res));
} }
parseCommunities(data: any): CommunityInfo[] { parseCommunities(data: any): CommunityInfo[] {
let communities: CommunityInfo[] = []; const communities: CommunityInfo[] = [];
let length = Array.isArray(data) ? data.length :1; const length = Array.isArray(data) ? data.length : 1;
for (let i=0; i<length; i++) { for (let i = 0; i < length; i++) {
let resData = Array.isArray(data) ? data[i] : data; const resData = Array.isArray(data) ? data[i] : data;
const result: CommunityInfo = new CommunityInfo();
var result: CommunityInfo = new CommunityInfo(); result['title'] = resData.name;
//TODO @Sofia remove this if/else result['shortTitle'] = resData.shortName;
// if there is case to be array do with resData what you do with data ( let resData = Array.isArray(data) ? data[i] : data;) result['communityId'] = resData.id;
//don;t repeat the same code result['queryId'] = resData.queryId;
if(Array.isArray(resData)) { result['logoUrl'] = resData.logoUrl;
result['title'] = resData[0].name; result['description'] = resData.description;
result['shortTitle'] = resData[0].shortName; result['date'] = resData.creationDate;
result['communityId'] = resData[0].id; result['status'] = 'all';
result['queryId'] = resData[0].queryId; if (resData.hasOwnProperty('status')) {
result['logoUrl'] = resData[0].logoUrl; result['status'] = resData.status;
result['description'] = resData[0].description; const status = ['all', 'hidden', 'manager'];
result['date'] = resData[0].creationDate; if (status.indexOf(result['status']) === -1) {
result['status'] = "all"; result['status'] = 'hidden';
if(resData[0].hasOwnProperty('status')){
result['status'] = resData[0].status;
var status = ["all","hidden","manager"];
if(status.indexOf(result['status']) ==-1){
result['status'] = "hidden";
}
}
if (resData[0].type != null) {
result['type'] = resData[0].type;
}
if(resData[0].managers != null) {
if(result['managers'] == undefined) {
result['managers'] = new Array<string>();
}
let managers = resData[0].managers;
let length = Array.isArray(managers) ? managers.length : 1;
for(let i=0; i<length; i++) {
let manager = Array.isArray(managers) ? managers[i] : managers;
result.managers[i] = manager;
}
}
if(resData[0].subjects != null) {
if(result['subjects'] == undefined) {
result['subjects'] = new Array<string>();
}
let subjects = resData[0].subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
result.subjects[i] = subject;
}
}
} else {
result['title'] = resData.name;
result['shortTitle'] = resData.shortName;
result['communityId'] = resData.id;
result['queryId'] = resData.queryId;
result['logoUrl'] = resData.logoUrl;
result['description'] = resData.description;
result['date'] = resData.creationDate;
result['status'] = "all";
if(resData.hasOwnProperty('status')){
result['status'] = resData.status;
var status = ["all","hidden","manager"];
if(status.indexOf(result['status']) ==-1){
result['status'] = "hidden";
}
}
if (resData.type != null) {
result['type'] = resData.type;
}
if(resData.managers != null) {
if(result['managers'] == undefined) {
result['managers'] = new Array<string>();
}
let managers = resData.managers;
let length = Array.isArray(managers) ? managers.length : 1;
for(let i=0; i<length; i++) {
let manager = Array.isArray(managers) ? managers[i] : managers;
result.managers[i] = manager;
}
}
if(resData.subjects != null) {
if(result['subjects'] == undefined) {
result['subjects'] = new Array<string>();
}
let subjects = resData.subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
result.subjects[i] = subject;
}
} }
} }
if (result['type'] == 'community' || result['type'] == "ri") { if (resData.type != null) {
communities.push(result); result['type'] = resData.type;
}
if (resData.managers != null) {
if (result['managers'] === undefined) {
result['managers'] = new Array<string>();
}
const managers = resData.managers;
const lengthManagers = Array.isArray(managers) ? managers.length : 1;
for (let j = 0; j < lengthManagers; j++) {
const manager = Array.isArray(managers) ? managers[j] : managers;
result.managers[j] = manager;
}
}
if (resData.subjects != null) {
if (result['subjects'] === undefined) {
result['subjects'] = new Array<string>();
}
const subjects = resData.subjects;
const lengthSubjects = Array.isArray(subjects) ? subjects.length : 1;
for (let j = 0; j < lengthSubjects; j++) {
const subject = Array.isArray(subjects) ? subjects[i] : subjects;
result.subjects[j] = subject;
}
}
if (result['type'] === 'community' || result['type'] === 'ri') {
communities.push(result);
} }
} }
return communities; return communities;
} }
} }

View File

@ -7,52 +7,50 @@ import {
ActivatedRoute, ActivatedRoute,
CanLoad, Route CanLoad, Route
} from '@angular/router'; } from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from '../../login/utils/helper.class'; import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {CommunityService} from '../community/community.service'; import {CommunityService} from '../community/community.service';
import { EnvironmentSpecificService} from '../../utils/properties/environment-specific.service'; import { EnvironmentSpecificService} from '../../utils/properties/environment-specific.service';
import { mergeMap } from 'rxjs/operators';
@Injectable() @Injectable()
export class ConnectAdminLoginGuard implements CanActivate, CanLoad{ export class ConnectAdminLoginGuard implements CanActivate, CanLoad{
constructor(private router: Router, constructor(private router: Router,
private communityService: CommunityService, private communityService: CommunityService,
private propertiesService:EnvironmentSpecificService, private propertiesService: EnvironmentSpecificService) {}
private route: ActivatedRoute) {}
check(path: string): Observable<boolean> | boolean { check(route: ActivatedRouteSnapshot, path: string): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_LOGIN; let errorCode = LoginErrorCodes.NOT_LOGIN;
let community = this.route.queryParams["communityId"]; const community = route.queryParams['communityId'];
if (Session.isLoggedIn()) { if (Session.isLoggedIn()) {
if (Session.isPortalAdministrator() || Session.isCommunityCurator()) { if (Session.isPortalAdministrator() || Session.isCommunityCurator()) {
return true; return true;
} else { } else {
let obs = this.propertiesService.subscribeEnvironment().map(res => res).mergeMap(properties => { const obs = this.propertiesService.subscribeEnvironment().map(res => res).mergeMap(properties => {
return this.communityService.iscommunityManager(properties, properties["communityAPI"] + community, Session.getUserEmail()) return this.communityService.iscommunityManager(properties, properties['communityAPI'] + community, Session.getUserEmail());
}); });
obs.filter(enabled => !enabled) obs.filter(enabled => !enabled)
.subscribe(() => this.router.navigate(['/user-info'], { .subscribe(() => this.router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": errorCode, 'errorCode': errorCode,
"redirectUrl": path 'redirectUrl': path
} }
})); }));
return obs; return obs;
} }
} else { } else {
errorCode = LoginErrorCodes.NOT_LOGIN; errorCode = LoginErrorCodes.NOT_LOGIN;
this.router.navigate(['/user-info'], {queryParams: {"errorCode": errorCode, "redirectUrl": path}}); this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path}});
return false; return false;
} }
} }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(state.url); return this.check(route, state.url);
} }
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean { canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
return this.check('/' + route.path); return this.check(null, '/' + route.path);
} }
} }

View File

@ -7,7 +7,7 @@ import {
CanLoad, CanLoad,
Route, ActivatedRoute Route, ActivatedRoute
} from '@angular/router'; } from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from '../../login/utils/helper.class'; import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {CommunityService} from '../community/community.service'; import {CommunityService} from '../community/community.service';
@ -16,41 +16,44 @@ import { EnvironmentSpecificService} from '../../utils/properties/environment-sp
@Injectable() @Injectable()
export class ConnectRIGuard implements CanActivate, CanLoad { export class ConnectRIGuard implements CanActivate, CanLoad {
constructor(private router: Router, private communityService: CommunityService, private propertiesService:EnvironmentSpecificService, private route:ActivatedRoute) {} constructor(private router: Router,
private communityService: CommunityService,
private propertiesService: EnvironmentSpecificService) {
}
check(path: string) : Observable<boolean> | boolean { check(route: ActivatedRouteSnapshot, path: string): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_LOGIN; let errorCode = LoginErrorCodes.NOT_LOGIN;
let community = (this.route.queryParams["communityId"]); const community = (route.queryParams['communityId']);
if(Session.isLoggedIn()) { if (Session.isLoggedIn()) {
if(Session.isPortalAdministrator()) { if (Session.isPortalAdministrator()) {
return true; return true;
} else { } else {
let obs = this.propertiesService.subscribeEnvironment().mergeMap(properties => { const obs = this.propertiesService.subscribeEnvironment().mergeMap(properties => {
return this.communityService.iscommunityRI(properties, properties["communityAPI"] + community) return this.communityService.iscommunityRI(properties, properties['communityAPI'] + community);
}); });
obs.filter(enabled => !enabled) obs.filter(enabled => !enabled)
.subscribe(() => this.router.navigate(['/user-info'], { .subscribe(() => this.router.navigate(['/user-info'], {
queryParams: { queryParams: {
"errorCode": errorCode, 'errorCode': errorCode,
"redirectUrl": path 'redirectUrl': path
} }
})); }));
return obs; return obs;
} }
} else{ } else {
errorCode = LoginErrorCodes.NOT_LOGIN; errorCode = LoginErrorCodes.NOT_LOGIN;
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl": path } }); this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path}});
return false; return false;
} }
} }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(state.url); return this.check(route, state.url);
} }
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean { canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
return this.check('/' + route.path); return this.check(null, '/' + route.path);
} }
} }

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, ActivatedRoute} from '@angular/router'; import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanLoad, Route} from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from '../../login/utils/helper.class'; import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {CommunityService} from '../community/community.service'; import {CommunityService} from '../community/community.service';
@ -8,36 +8,42 @@ import { EnvironmentSpecificService} from '../../utils/properties/environment-sp
import {ConnectHelper} from '../connectHelper'; import {ConnectHelper} from '../connectHelper';
@Injectable() @Injectable()
export class ConnectSubscriberGuard implements CanActivate { export class ConnectSubscriberGuard implements CanActivate, CanLoad{
constructor(private router: Router, constructor(private router: Router,
private communityService: CommunityService, private communityService: CommunityService,
private propertiesService:EnvironmentSpecificService, private propertiesService: EnvironmentSpecificService) {}
private route: ActivatedRoute) {}
check(route: ActivatedRouteSnapshot, path: string): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_SUBSCRIBER;
let community = route.queryParams['communityId'];
if (!community && (typeof document !== 'undefined')) {
community = ConnectHelper.getCommunityFromDomain(document.location.hostname);
}
if (!Session.isLoggedIn()) {
errorCode = LoginErrorCodes.NOT_LOGIN;
this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path}});
return false;
} else {
const obs = this.propertiesService.subscribeEnvironment().mergeMap(properties => {
return this.communityService.isSubscribedToCommunity(community, Session.getUserEmail(), properties['adminToolsAPIURL']);
});
obs.filter(enabled => !enabled)
.subscribe(() => this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': errorCode,
'redirectUrl': path
}
}));
return obs;
}
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
let errorCode = LoginErrorCodes.NOT_SUBSCRIBER; return this.check(route, state.url);
let community = this.route.queryParams["communityId"]; }
if(!community && (typeof document !== 'undefined')){
community = ConnectHelper.getCommunityFromDomain(document.location.hostname); canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
} return this.check(null, '/' + route.path);
if(!Session.isLoggedIn()){
errorCode = LoginErrorCodes.NOT_LOGIN;
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl": state.url } });
return false;
}
else {
let obs = this.propertiesService.subscribeEnvironment().mergeMap(properties => {
return this.communityService.isSubscribedToCommunity(community, Session.getUserEmail(), properties["adminToolsAPIURL"])
});
obs.filter(enabled => !enabled)
.subscribe(() => this.router.navigate(['/user-info'], {
queryParams: {
"errorCode": errorCode,
"redirectUrl": state.url
}
}));
return obs;
}
} }
} }

View File

@ -1,36 +1,36 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import {
ActivatedRoute,
Router, Router,
CanActivate, CanActivate,
ActivatedRouteSnapshot, ActivatedRouteSnapshot,
RouterStateSnapshot, RouterStateSnapshot,
CanLoad, Route CanLoad, Route
} from '@angular/router'; } from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/filter'; import 'rxjs/add/operator/filter';
@Injectable() @Injectable()
export class IsCommunity implements CanActivate, CanLoad { export class IsCommunity implements CanActivate, CanLoad {
constructor(private router: Router, constructor(private router: Router) {
private route: ActivatedRoute) {} }
check(): Observable<boolean> | boolean { check(route: ActivatedRouteSnapshot): Observable<boolean> | boolean {
let community = this.route.queryParams["communityId"]; const community = route.queryParams['communityId'];
if(community && community!="undefined"){ console.log(community);
if (community && community !== 'undefined') {
return true; return true;
}else{ } else {
this.router.navigate(['errorcommunity']); this.router.navigate(['errorcommunity']);
return false;
} }
return false;
} }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(); return this.check(route);
} }
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean { canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
return this.check(); return this.check(null);
} }
} }

View File

@ -1,27 +1,28 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanLoad, Route} from '@angular/router'; import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanLoad, Route} from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from './utils/helper.class'; import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class'; import {LoginErrorCodes} from './utils/guardHelper.class';
@Injectable() @Injectable()
export class AdminLoginGuard implements CanActivate, CanLoad { export class AdminLoginGuard implements CanActivate, CanLoad {
constructor(private router: Router) {} constructor(private router: Router) {
}
check(path: string) : boolean{ check(path: string): boolean {
let loggedIn = false; let loggedIn = false;
let isAdmin = false; let isAdmin = false;
let errorCode = LoginErrorCodes.NOT_LOGIN; let errorCode = LoginErrorCodes.NOT_LOGIN;
if(Session.isLoggedIn()){ if (Session.isLoggedIn()) {
loggedIn = true; loggedIn = true;
isAdmin = Session.isPortalAdministrator(); isAdmin = Session.isPortalAdministrator();
if(!isAdmin){ if (!isAdmin) {
errorCode = LoginErrorCodes.NOT_ADMIN; errorCode = LoginErrorCodes.NOT_ADMIN;
} }
} }
if(!loggedIn || !isAdmin) { if (!loggedIn || !isAdmin) {
this.router.navigate(['/user-info'], {queryParams: {"errorCode": errorCode, "redirectUrl": path}}); this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path}});
} }
return loggedIn && isAdmin; return loggedIn && isAdmin;
} }

View File

@ -1,31 +1,30 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanLoad, Route} from '@angular/router'; import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanLoad, Route} from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from './utils/helper.class'; import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class'; import {LoginErrorCodes} from './utils/guardHelper.class';
@Injectable() @Injectable()
export class ClaimsCuratorGuard implements CanActivate, CanLoad { export class ClaimsCuratorGuard implements CanActivate, CanLoad {
constructor(private router: Router) {} constructor(private router: Router) {
}
check(path: string) : boolean{ check(path: string): boolean {
let loggedIn = false; let loggedIn = false;
let isAuthorized = false; let isAuthorized = false;
let errorCode = LoginErrorCodes.NOT_LOGIN; let errorCode = LoginErrorCodes.NOT_LOGIN;
if(Session.isLoggedIn()){ if (Session.isLoggedIn()) {
loggedIn = true; loggedIn = true;
if(Session.isClaimsCurator() || Session.isPortalAdministrator()){ if (Session.isClaimsCurator() || Session.isPortalAdministrator()) {
isAuthorized = true; isAuthorized = true;
} } else {
else {
errorCode = LoginErrorCodes.NOT_ADMIN; errorCode = LoginErrorCodes.NOT_ADMIN;
} }
} }
if(!loggedIn || !isAuthorized){ if (!loggedIn || !isAuthorized) {
// this.guardHelper.redirect("/user-info",errorCode,state.url); this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path}});
this.router.navigate(['/user-info'], {queryParams: {"errorCode": errorCode, "redirectUrl": path}});
} }
return loggedIn && isAuthorized; return loggedIn && isAuthorized;
} }

View File

@ -7,19 +7,19 @@ import {
Route, Route,
CanLoad CanLoad
} from '@angular/router'; } from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {LoginErrorCodes} from './utils/guardHelper.class'; import {LoginErrorCodes} from './utils/guardHelper.class';
@Injectable() @Injectable()
export class FreeGuard implements CanActivate, CanLoad{ export class FreeGuard implements CanActivate, CanLoad {
constructor(private router: Router) {} constructor(private router: Router) {
}
check(path: string) :boolean { check(path: string): boolean {
let valid = true; const valid = true;
let errorCode = LoginErrorCodes.NOT_LOGIN; if (!valid) {
if(!valid){ this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': path}});
this.router.navigate(['/user-info'], {queryParams: {"errorCode": errorCode, "redirectUrl": path}});
} }
return valid; return valid;
} }

View File

@ -1,24 +1,22 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Route, CanLoad} from '@angular/router'; import {Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Route, CanLoad} from '@angular/router';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {Session} from './utils/helper.class'; import {Session} from './utils/helper.class';
import {LoginErrorCodes} from './utils/guardHelper.class'; import {LoginErrorCodes} from './utils/guardHelper.class';
@Injectable() @Injectable()
export class LoginGuard implements CanActivate, CanLoad { export class LoginGuard implements CanActivate, CanLoad {
constructor(private router: Router) {} constructor(private router: Router) {
}
check(path: string): boolean{ check(path: string): boolean {
let loggedIn = false; let loggedIn = false;
let errorCode = LoginErrorCodes.NOT_LOGIN; if (Session.isLoggedIn()) {
if(Session.isLoggedIn()) {
loggedIn = true; loggedIn = true;
} }
if(!loggedIn){ if (!loggedIn) {
// this.guardHelper.redirect("/user-info",errorCode,state.url); this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_LOGIN, path}});
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, path} });
} }
return loggedIn; return loggedIn;
} }