clone public plan and description

This commit is contained in:
Sofia Papacharalampous 2024-07-12 17:21:02 +03:00
parent 50e38c6854
commit c2333a68e4
4 changed files with 9 additions and 2 deletions

View File

@ -14,6 +14,7 @@ export enum AppPermission {
PublicSendContactSupport = "PublicSendContactSupport",
PublicBrowseReferenceType = "PublicBrowseReferenceType",
PublicClonePlan = "PublicClonePlan",
PublicCloneDescription = "PublicCloneDescription",
//Elastic
ManageElastic = "ManageElastic",
//Queue Events

View File

@ -56,7 +56,7 @@
</button>
</div>
</ng-template>
<div *ngIf="canEdit" class="col-auto pr-0">
<div *ngIf="canCopy" class="col-auto pr-0">
<button (click)="openCopyToPlanDialog()" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>

View File

@ -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
@ -135,6 +137,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);

View File

@ -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 {