From 106de5cc0e24ace6f3fd76a473619419f741fe03 Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Tue, 30 Jul 2019 17:47:15 +0800 Subject: [PATCH] Fix redirect login page when enter harbor through global search Signed-off-by: Yogi_Wang --- .../shared/route/member-guard-activate.service.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/portal/src/app/shared/route/member-guard-activate.service.ts b/src/portal/src/app/shared/route/member-guard-activate.service.ts index 2d823b12f..324c424aa 100644 --- a/src/portal/src/app/shared/route/member-guard-activate.service.ts +++ b/src/portal/src/app/shared/route/member-guard-activate.service.ts @@ -41,8 +41,19 @@ export class MemberGuard implements CanActivate, CanActivateChild { this.checkMemberStatus(state.url, projectId).subscribe((res) => observer.next(res)); } , error => { - this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); - observer.next(false); + // if it is public project return true; + this.projectService.getProject(projectId).subscribe(project => { + if (project.metadata.public) { + observer.next(true); + } else { + this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); + observer.next(false); + } + }, err => { + this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); + observer.next(false); + }); + }); } else { this.checkMemberStatus(state.url, projectId).subscribe((res) => observer.next(res));