mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-11 18:38:14 +01:00
Allow retag in portal only for developer or above role
Signed-off-by: 陈德 <chende@caicloud.io>
This commit is contained in:
parent
4dc89f57f2
commit
4bf5962e35
@ -45,7 +45,10 @@
|
|||||||
</section>
|
</section>
|
||||||
<section id="image" role="tabpanel" aria-labelledby="repo-image" [hidden]='!isCurrentTabContent("image")'>
|
<section id="image" role="tabpanel" aria-labelledby="repo-image" [hidden]='!isCurrentTabContent("image")'>
|
||||||
<div id=images-container>
|
<div id=images-container>
|
||||||
<hbr-tag ngProjectAs="clr-dg-row-detail" (tagClickEvent)="watchTagClickEvt($event)" (signatureOutput)="saveSignatures($event)" class="sub-grid-custom" [repoName]="repoName" [registryUrl]="registryUrl" [withNotary]="withNotary" [withClair]="withClair" [withAdmiral]="withAdmiral" [hasSignedIn]="hasSignedIn" [hasProjectAdminRole]="hasProjectAdminRole" [isGuest]="isGuest" [projectId]="projectId"></hbr-tag>
|
<hbr-tag ngProjectAs="clr-dg-row-detail" (tagClickEvent)="watchTagClickEvt($event)" (signatureOutput)="saveSignatures($event)" class="sub-grid-custom"
|
||||||
|
[repoName]="repoName" [registryUrl]="registryUrl" [withNotary]="withNotary" [withClair]="withClair"
|
||||||
|
[withAdmiral]="withAdmiral" [hasSignedIn]="hasSignedIn" [hasProjectAdminRole]="hasProjectAdminRole"
|
||||||
|
[isGuest]="isGuest" [projectId]="projectId" [memberRoleID]="memberRoleID"></hbr-tag>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,6 +36,7 @@ const TabLinkContentMap: {[index: string]: string} = {
|
|||||||
export class RepositoryComponent implements OnInit {
|
export class RepositoryComponent implements OnInit {
|
||||||
signedCon: {[key: string]: any | string[]} = {};
|
signedCon: {[key: string]: any | string[]} = {};
|
||||||
@Input() projectId: number;
|
@Input() projectId: number;
|
||||||
|
@Input() memberRoleID: number;
|
||||||
@Input() repoName: string;
|
@Input() repoName: string;
|
||||||
@Input() hasSignedIn: boolean;
|
@Input() hasSignedIn: boolean;
|
||||||
@Input() hasProjectAdminRole: boolean;
|
@Input() hasProjectAdminRole: boolean;
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</clr-dropdown-menu>
|
</clr-dropdown-menu>
|
||||||
</clr-dropdown>
|
</clr-dropdown>
|
||||||
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!(selectedRow.length===1)" (click)="retag(selectedRow)"><clr-icon shape="copy" size="16"></clr-icon> {{'REPOSITORY.RETAG' | translate}}</button>
|
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!(selectedRow.length===1 && developerRoleOrAbove)" (click)="retag(selectedRow)"><clr-icon shape="copy" size="16"></clr-icon> {{'REPOSITORY.RETAG' | translate}}</button>
|
||||||
<button type="button" class="btn btn-sm btn-secondary" *ngIf="hasProjectAdminRole" (click)="deleteTags(selectedRow)" [disabled]="!selectedRow.length"><clr-icon shape="times" size="16"></clr-icon> {{'REPOSITORY.DELETE' | translate}}</button>
|
<button type="button" class="btn btn-sm btn-secondary" *ngIf="hasProjectAdminRole" (click)="deleteTags(selectedRow)" [disabled]="!selectedRow.length"><clr-icon shape="times" size="16"></clr-icon> {{'REPOSITORY.DELETE' | translate}}</button>
|
||||||
</clr-dg-action-bar>
|
</clr-dg-action-bar>
|
||||||
<clr-dg-column style="width: 120px;" [clrDgField]="'name'">{{'REPOSITORY.TAG' | translate}}</clr-dg-column>
|
<clr-dg-column style="width: 120px;" [clrDgField]="'name'">{{'REPOSITORY.TAG' | translate}}</clr-dg-column>
|
||||||
|
@ -32,7 +32,7 @@ import { ChannelService } from "../channel/index";
|
|||||||
import {
|
import {
|
||||||
ConfirmationTargets,
|
ConfirmationTargets,
|
||||||
ConfirmationState,
|
ConfirmationState,
|
||||||
ConfirmationButtons
|
ConfirmationButtons, Roles
|
||||||
} from "../shared/shared.const";
|
} from "../shared/shared.const";
|
||||||
|
|
||||||
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
import { ConfirmationDialogComponent } from "../confirmation-dialog/confirmation-dialog.component";
|
||||||
@ -73,6 +73,7 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
signedCon: {[key: string]: any | string[]} = {};
|
signedCon: {[key: string]: any | string[]} = {};
|
||||||
@Input() projectId: number;
|
@Input() projectId: number;
|
||||||
|
@Input() memberRoleID: number;
|
||||||
@Input() repoName: string;
|
@Input() repoName: string;
|
||||||
@Input() isEmbedded: boolean;
|
@Input() isEmbedded: boolean;
|
||||||
|
|
||||||
@ -755,4 +756,8 @@ export class TagComponent implements OnInit, AfterViewInit {
|
|||||||
onCpError($event: any): void {
|
onCpError($event: any): void {
|
||||||
this.copyInput.setPullCommendShow();
|
this.copyInput.setPullCommendShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get developerRoleOrAbove(): boolean {
|
||||||
|
return this.memberRoleID === Roles.DEVELOPER || this.hasProjectAdminRole;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<a (click)="goProBack()">{{'SIDE_NAV.PROJECTS'| translate}}</a>
|
<a (click)="goProBack()">{{'SIDE_NAV.PROJECTS'| translate}}</a>
|
||||||
<a (click)="watchGoBackEvt(projectId)">< {{'REPOSITORY.REPOSITORIES'| translate}}</a>
|
<a (click)="watchGoBackEvt(projectId)">< {{'REPOSITORY.REPOSITORIES'| translate}}</a>
|
||||||
</div>
|
</div>
|
||||||
<hbr-repository [repoName]="repoName" [hasSignedIn]="hasSignedIn" [hasProjectAdminRole]="hasProjectAdminRole" [projectId]="projectId" [isGuest]="isGuest"
|
<hbr-repository [repoName]="repoName" [hasSignedIn]="hasSignedIn" [hasProjectAdminRole]="hasProjectAdminRole"
|
||||||
|
[projectId]="projectId" [memberRoleID]="projectMemberRoleId" [isGuest]="isGuest"
|
||||||
(tagClickEvent)="watchTagClickEvt($event)" (backEvt)="watchGoBackEvt($event)"></hbr-repository>
|
(tagClickEvent)="watchTagClickEvt($event)" (backEvt)="watchGoBackEvt($event)"></hbr-repository>
|
||||||
</div>
|
</div>
|
@ -28,6 +28,7 @@ import { Project } from '../../project/project';
|
|||||||
export class TagRepositoryComponent implements OnInit {
|
export class TagRepositoryComponent implements OnInit {
|
||||||
|
|
||||||
projectId: number;
|
projectId: number;
|
||||||
|
projectMemberRoleId: number;
|
||||||
repoName: string;
|
repoName: string;
|
||||||
hasProjectAdminRole: boolean = false;
|
hasProjectAdminRole: boolean = false;
|
||||||
isGuest: boolean;
|
isGuest: boolean;
|
||||||
@ -54,6 +55,7 @@ export class TagRepositoryComponent implements OnInit {
|
|||||||
if (resolverData) {
|
if (resolverData) {
|
||||||
this.hasProjectAdminRole = (<Project>resolverData['projectResolver']).has_project_admin_role;
|
this.hasProjectAdminRole = (<Project>resolverData['projectResolver']).has_project_admin_role;
|
||||||
this.isGuest = (<Project>resolverData['projectResolver']).current_user_role_id === 3;
|
this.isGuest = (<Project>resolverData['projectResolver']).current_user_role_id === 3;
|
||||||
|
this.projectMemberRoleId = (<Project>resolverData['projectResolver']).current_user_role_id;
|
||||||
}
|
}
|
||||||
this.repoName = this.route.snapshot.params['repo'];
|
this.repoName = this.route.snapshot.params['repo'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user