diff --git a/src/ui_ng/src/app/harbor-routing.module.ts b/src/ui_ng/src/app/harbor-routing.module.ts index 15b625602..f5eb5d075 100644 --- a/src/ui_ng/src/app/harbor-routing.module.ts +++ b/src/ui_ng/src/app/harbor-routing.module.ts @@ -94,7 +94,6 @@ const harborRoutes: Routes = [ { path: 'tags/:id/:repo', component: TagRepositoryComponent, - canActivate: [MemberGuard], resolve: { projectResolver: ProjectRoutingResolver } diff --git a/src/ui_ng/src/app/shared/route/member-guard-activate.service.ts b/src/ui_ng/src/app/shared/route/member-guard-activate.service.ts index c9645f9d3..865076a90 100644 --- a/src/ui_ng/src/app/shared/route/member-guard-activate.service.ts +++ b/src/ui_ng/src/app/shared/route/member-guard-activate.service.ts @@ -33,29 +33,24 @@ export class MemberGuard implements CanActivate, CanActivateChild { let projectId = route.params['id']; this.sessionService.setProjectMembers([]); return new Promise((resolve, reject) => { - if(!this.sessionService.getCurrentUser()) { - return resolve(true); - } - this.projectService.checkProjectMember(projectId) - .subscribe( - res=>{ - this.sessionService.setProjectMembers(res); - return resolve(true) - }, - error => { - //Add exception for repository in project detail router activation. - if(state.url.endsWith('repository')) { + let projectId = route.params['id']; + this.sessionService.setProjectMembers([]); + return new Promise((resolve, reject) => { + this.projectService.checkProjectMember(projectId) + .subscribe( + res=>{ + this.sessionService.setProjectMembers(res); + return resolve(true) + }, + error => { + //Add exception for repository in project detail router activation. + if(state.url.endsWith('repository')) { return resolve(true); - } - this.projectService.getProject(projectId).subscribe(project=>{ - if(project.public === 1) { - return resolve(true); - } else { - this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); - return resolve(false); } + this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); + return resolve(false); }); - }); + }); }); }