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", PublicSendContactSupport = "PublicSendContactSupport",
PublicBrowseReferenceType = "PublicBrowseReferenceType", PublicBrowseReferenceType = "PublicBrowseReferenceType",
PublicClonePlan = "PublicClonePlan", PublicClonePlan = "PublicClonePlan",
PublicCloneDescription = "PublicCloneDescription",
//Elastic //Elastic
ManageElastic = "ManageElastic", ManageElastic = "ManageElastic",
//Queue Events //Queue Events

View File

@ -56,7 +56,7 @@
</button> </button>
</div> </div>
</ng-template> </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"> <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> <mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button> </button>

View File

@ -68,6 +68,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
fileTransformerEntityTypeEnum = FileTransformerEntityType; fileTransformerEntityTypeEnum = FileTransformerEntityType;
canEdit = false; canEdit = false;
canCopy = false;
canDelete = false; canDelete = false;
canFinalize = false; canFinalize = false;
canReview = false; canReview = false;
@ -109,6 +110,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
this.canDelete = false; this.canDelete = false;
this.canEdit = false; this.canEdit = false;
this.canCopy = false;
this.canFinalize = false; this.canFinalize = false;
this.canInvitePlanUsers = false; this.canInvitePlanUsers = false;
// Gets description data using parameter id // 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.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; 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.canReview = (this.authService.hasPermission(AppPermission.ReviewDescription) ||
this.description.authorizationFlags?.some(x => x === AppPermission.ReviewDescription)) && this.description.belongsToCurrentTenant != false; 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()) this.descriptionService.getPublicSingle(publicId, this.lookupFields())
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.canCopy = this.authService.hasPermission(AppPermission.PublicCloneDescription) && this.isPublicView;
this.breadcrumbService.addExcludedParam('public', true); this.breadcrumbService.addExcludedParam('public', true);
this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label);

View File

@ -255,7 +255,7 @@ export class PlanOverviewComponent extends BaseComponent implements OnInit {
} }
canClonePlan(): boolean { 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 { canFinalizePlan(): boolean {