mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 08:38:03 +01:00
Update for tags route.
This commit is contained in:
parent
0a8840ee06
commit
ed488e683d
@ -94,6 +94,7 @@ const harborRoutes: Routes = [
|
||||
{
|
||||
path: 'tags/:id/:repo',
|
||||
component: TagRepositoryComponent,
|
||||
canActivate: [MemberGuard],
|
||||
resolve: {
|
||||
projectResolver: ProjectRoutingResolver
|
||||
}
|
||||
|
@ -33,20 +33,29 @@ export class MemberGuard implements CanActivate, CanActivateChild {
|
||||
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')) {
|
||||
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')) {
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user