diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java index 26848e8cc..da27e9722 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/ClonePlanPersist.java @@ -91,10 +91,7 @@ public class ClonePlanPersist { .failOn(ClonePlanPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._id}, LocaleContextHolder.getLocale())), this.spec() .must(() -> !this.isEmpty(item.getLabel())) - .failOn(ClonePlanPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._label}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isEmpty(item.getDescription())) - .failOn(ClonePlanPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._description}, LocaleContextHolder.getLocale())) + .failOn(ClonePlanPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._label}, LocaleContextHolder.getLocale())) ); } } diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java index f39a2accb..d3973c025 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/NewVersionPlanPersist.java @@ -123,9 +123,6 @@ public class NewVersionPlanPersist { .iff(() -> !this.isEmpty(item.getLabel())) .must(() -> this.lessEqualLength(item.getLabel(), PlanEntity._labelLength)) .failOn(NewVersionPlanPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionPlanPersist._label}, LocaleContextHolder.getLocale())), - this.spec() - .must(() -> !this.isEmpty(item.getDescription())) - .failOn(NewVersionPlanPersist._description).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._description}, LocaleContextHolder.getLocale())), this.spec() .must(() -> this.isValidGuid(item.getBlueprintId())) .failOn(NewVersionPlanPersist._blueprintId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._blueprintId}, LocaleContextHolder.getLocale())), diff --git a/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java index 6d499320c..31fa61dbc 100644 --- a/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java @@ -584,7 +584,7 @@ public class PlanServiceImpl implements PlanService { this.usageLimitService.checkIncrease(UsageLimitTargetMetric.DESCRIPTION_COUNT); PlanEntity descriptionPlan = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).isActive(IsActive.Active).first(); - if (!descriptionPlan.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription); + if (descriptionPlan.getAccessType() != null && !descriptionPlan.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription); else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.PublicCloneDescription); DescriptionEntity existing = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).isActive(IsActive.Active).first(); @@ -699,7 +699,7 @@ public class PlanServiceImpl implements PlanService { if (!this.conventionService.isValidGuid(model.getId()) || existingPlanEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale())); - if (!existingPlanEntity.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation( model.getId())), Permission.ClonePlan); + if (existingPlanEntity.getAccessType() != null && !existingPlanEntity.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation( model.getId())), Permission.ClonePlan); else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation( model.getId())), Permission.PublicClonePlan); PlanEntity newPlan = new PlanEntity(); diff --git a/frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts b/frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts index 546596f5e..7a732fbce 100644 --- a/frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts +++ b/frontend/src/app/ui/plan/clone-dialog/plan-clone-dialog.editor.model.ts @@ -42,7 +42,7 @@ export class PlanCloneDialogEditorModel implements ClonePlanPersist { const baseValidationArray: Validation[] = new Array(); baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] }); baseValidationArray.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] }); - baseValidationArray.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] }); + baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] }); baseValidationArray.push({ key: 'descriptions', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptions')] }); baseContext.validation = baseValidationArray; return baseContext; diff --git a/frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts b/frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts index 1aaf46709..c633116a4 100644 --- a/frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts +++ b/frontend/src/app/ui/plan/new-version-dialog/plan-new-version-dialog.editor.model.ts @@ -76,7 +76,7 @@ export class PlanNewVersionDialogEditorModel implements NewVersionPlanPersist { const baseValidationArray: Validation[] = new Array(); baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] }); baseValidationArray.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] }); - baseValidationArray.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] }); + baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] }); baseValidationArray.push({ key: 'blueprintId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'blueprintId')] }); baseValidationArray.push({ key: 'descriptions', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptions')] }); baseValidationArray.push({ key: 'hash', validators: [] });