From c2333a68e49ad0390d26eab8c4e15c912d6b4310 Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Fri, 12 Jul 2024 17:21:02 +0300 Subject: [PATCH] clone public plan and description --- frontend/src/app/core/common/enum/permission.enum.ts | 1 + .../overview/description-overview.component.html | 2 +- .../description/overview/description-overview.component.ts | 6 ++++++ .../src/app/ui/plan/overview/plan-overview.component.ts | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/core/common/enum/permission.enum.ts b/frontend/src/app/core/common/enum/permission.enum.ts index dc951eb59..11fead2d6 100644 --- a/frontend/src/app/core/common/enum/permission.enum.ts +++ b/frontend/src/app/core/common/enum/permission.enum.ts @@ -14,6 +14,7 @@ export enum AppPermission { PublicSendContactSupport = "PublicSendContactSupport", PublicBrowseReferenceType = "PublicBrowseReferenceType", PublicClonePlan = "PublicClonePlan", + PublicCloneDescription = "PublicCloneDescription", //Elastic ManageElastic = "ManageElastic", //Queue Events diff --git a/frontend/src/app/ui/description/overview/description-overview.component.html b/frontend/src/app/ui/description/overview/description-overview.component.html index 1724a0fb3..d8c2235a8 100644 --- a/frontend/src/app/ui/description/overview/description-overview.component.html +++ b/frontend/src/app/ui/description/overview/description-overview.component.html @@ -56,7 +56,7 @@ -
+
diff --git a/frontend/src/app/ui/description/overview/description-overview.component.ts b/frontend/src/app/ui/description/overview/description-overview.component.ts index 668c65e5d..0d214348e 100644 --- a/frontend/src/app/ui/description/overview/description-overview.component.ts +++ b/frontend/src/app/ui/description/overview/description-overview.component.ts @@ -68,6 +68,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni fileTransformerEntityTypeEnum = FileTransformerEntityType; canEdit = false; + canCopy = false; canDelete = false; canFinalize = false; canReview = false; @@ -109,6 +110,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.canDelete = false; this.canEdit = false; + this.canCopy = false; this.canFinalize = false; this.canInvitePlanUsers = false; // Gets description data using parameter id @@ -134,6 +136,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) || this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; + + this.canCopy = this.canEdit || (this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView); this.canReview = (this.authService.hasPermission(AppPermission.ReviewDescription) || this.description.authorizationFlags?.some(x => x === AppPermission.ReviewDescription)) && this.description.belongsToCurrentTenant != false; @@ -162,6 +166,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.descriptionService.getPublicSingle(publicId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { + this.canCopy = this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView; + this.breadcrumbService.addExcludedParam('public', true); this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); diff --git a/frontend/src/app/ui/plan/overview/plan-overview.component.ts b/frontend/src/app/ui/plan/overview/plan-overview.component.ts index ce9a10200..5879385bd 100644 --- a/frontend/src/app/ui/plan/overview/plan-overview.component.ts +++ b/frontend/src/app/ui/plan/overview/plan-overview.component.ts @@ -255,7 +255,7 @@ export class PlanOverviewComponent extends BaseComponent implements OnInit { } canClonePlan(): boolean { - return (this.plan.authorizationFlags?.some(x => x === AppPermission.ClonePlan) || this.authentication.hasPermission(AppPermission.ClonePlan)); + return (this.plan.authorizationFlags?.some(x => x === AppPermission.ClonePlan) || this.authentication.hasPermission(AppPermission.ClonePlan) || (this.authentication.hasPermission(AppPermission.PublicClonePlan) && this.isPublicView)); } canFinalizePlan(): boolean {