Fix redirect login page when enter harbor through global search

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-07-30 17:47:15 +08:00
parent 3dcecf7701
commit 106de5cc0e

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