diff --git a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.html b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.html index 4e3d3127a..6481467ec 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.html @@ -86,29 +86,29 @@ -
+
- - - - - - diff --git a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts index 697777afc..7420d1f91 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/listing/description-template-listing.component.ts @@ -192,6 +192,36 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent x.toString())); } + public showActions(descriptionTemplate: DescriptionTemplate): boolean { + return this.canEdit(descriptionTemplate) || this.canAddNewVersion(descriptionTemplate) || + this.canClone(descriptionTemplate) || this.canViewVersions(descriptionTemplate) || + this.canDownloadXml(descriptionTemplate) || this.canDelete(descriptionTemplate); + } + + public canEdit(descriptionTemplate: DescriptionTemplate): boolean { + return descriptionTemplate.status !== DescriptionTemplateStatus.Finalized && this.hasPermission(AppPermission.EditDescriptionTemplate, descriptionTemplate); + } + + public canAddNewVersion(descriptionTemplate: DescriptionTemplate): boolean { + return descriptionTemplate.belongsToCurrentTenant != false && this.hasExplicitPermission(AppPermission.EditDescriptionTemplate); + } + + public canClone(descriptionTemplate: DescriptionTemplate): boolean { + return descriptionTemplate.belongsToCurrentTenant != false && this.hasPermission(AppPermission.CloneDescriptionTemplate, descriptionTemplate); + } + + public canViewVersions(descriptionTemplate: DescriptionTemplate): boolean { + return descriptionTemplate.belongsToCurrentTenant != false && this.hasExplicitPermission(AppPermission.EditDescriptionTemplate); + } + + public canDownloadXml(descriptionTemplate: DescriptionTemplate): boolean { + return descriptionTemplate.belongsToCurrentTenant != false && this.hasPermission(AppPermission.ExportDescriptionTemplate, descriptionTemplate); + } + + public canDelete(descriptionTemplate: DescriptionTemplate): boolean { + return descriptionTemplate.belongsToCurrentTenant != false && this.hasPermission(AppPermission.DeleteDescriptionTemplate, descriptionTemplate); + } + private onColumnsChangedInternal(columns: string[]) { // Here are defined the projection fields that always requested from the api. const fields = new Set(this.lookupFields);