From 7430ae7426f4492b64193a90cfed9b3355adabb8 Mon Sep 17 00:00:00 2001 From: FangyuanCheng Date: Thu, 1 Nov 2018 18:15:38 +0800 Subject: [PATCH] Ordinary user login is forbidden to add labels in images. Signed-off-by: FangyuanCheng --- .../helm-chart/versions/helm-chart-version.component.html | 2 +- .../helm-chart/versions/helm-chart-version.component.ts | 8 +++++++- src/portal/lib/src/tag/tag.component.html | 2 +- .../list-chart-versions.component.html | 1 + .../list-chart-versions/list-chart-versions.component.ts | 2 ++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.html b/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.html index 2b0d1e776..519ed6027 100644 --- a/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.html +++ b/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.html @@ -49,7 +49,7 @@ diff --git a/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.ts b/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.ts index 6202b877b..48b618721 100644 --- a/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.ts +++ b/src/portal/lib/src/helm-chart/versions/helm-chart-version.component.ts @@ -37,7 +37,8 @@ import { ConfirmationTargets, ConfirmationState, DefaultHelmIcon, - ResourceType + ResourceType, + Roles } from "../../shared/shared.const"; @Component({ @@ -48,6 +49,7 @@ import { }) export class ChartVersionComponent implements OnInit { signedCon: { [key: string]: any | string[] } = {}; + @Input() projectRoleID: number; @Input() projectId: number; @Input() projectName: string; @Input() chartName: string; @@ -321,4 +323,8 @@ export class ChartVersionComponent implements OnInit { setTimeout(() => clearInterval(hnd), 5000); }); } + + public get developerRoleOrAbove(): boolean { + return this.projectRoleID === Roles.DEVELOPER || this.hasProjectAdminRole; + } } diff --git a/src/portal/lib/src/tag/tag.component.html b/src/portal/lib/src/tag/tag.component.html index 428c82777..afa2e1a68 100644 --- a/src/portal/lib/src/tag/tag.component.html +++ b/src/portal/lib/src/tag/tag.component.html @@ -60,7 +60,7 @@ - +
diff --git a/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.html b/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.html index 876072b61..b870f47af 100644 --- a/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.html +++ b/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.html @@ -10,6 +10,7 @@ [chartName]='chartName' [roleName]='roleName' [hasSignedIn]='hasSignedIn' + [projectRoleID]='project_member_role_id' [hasProjectAdminRole]='hasProjectAdminRole' (versionClickEvt)='onVersionClick($event)' (backEvt)='gotoChartList()'> diff --git a/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.ts b/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.ts index bc3c2e1b9..a4315d97a 100644 --- a/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.ts +++ b/src/portal/src/app/project/list-chart-versions/list-chart-versions.component.ts @@ -23,6 +23,7 @@ export class ListChartVersionsComponent implements OnInit { hasSignedIn: boolean; hasProjectAdminRole: boolean; currentUser: SessionUser; + project_member_role_id: number; constructor( private route: ActivatedRoute, @@ -41,6 +42,7 @@ export class ListChartVersionsComponent implements OnInit { this.hasProjectAdminRole = project.has_project_admin_role; this.roleName = project.role_name; this.projectName = project.name; + this.project_member_role_id = project.current_user_role_id; } }