Merge pull request #8494 from jwangyangls/fix-global-search

Fix redirect login page when enter harbor through global search
This commit is contained in:
Daniel Jiang 2019-08-20 11:22:21 +08:00 committed by GitHub
commit 4921b0fb4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));