remove required roles from status editors

This commit is contained in:
CITE\amentis 2024-09-26 11:53:02 +03:00
parent e97de92b3a
commit 3c46462e10
7 changed files with 7 additions and 13 deletions

View File

@ -62,9 +62,6 @@ public class DescriptionStatusDefinitionAuthorizationItemPersist {
@Override
protected List<Specification> specifications(DescriptionStatusDefinitionAuthorizationItemPersist item) {
return Arrays.asList(
this.spec()
.must(() -> !this.isListNullOrEmpty(item.getPlanRoles()))
.failOn(PlanStatusDefinitionAuthorizationItemPersist._planRoles).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanStatusDefinitionAuthorizationItemPersist._planRoles}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -66,9 +66,6 @@ public class PlanStatusDefinitionAuthorizationItemPersist {
@Override
protected List<Specification> specifications(PlanStatusDefinitionAuthorizationItemPersist item) {
return Arrays.asList(
this.spec()
.must(() -> !this.isListNullOrEmpty(item.getPlanRoles()))
.failOn(PlanStatusDefinitionAuthorizationItemPersist._planRoles).failWith(messageSource.getMessage("Validation_Required", new Object[]{PlanStatusDefinitionAuthorizationItemPersist._planRoles}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -103,7 +103,7 @@
</div>
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>{{'DESCRIPTION-STATUS-EDITOR.FIELDS.PLAN-ROLES' | translate}}*</mat-label>
<mat-label>{{'DESCRIPTION-STATUS-EDITOR.FIELDS.PLAN-ROLES' | translate}}</mat-label>
<mat-select [formControl]="editAuthenticationForm.controls.planRoles" [multiple]="true">
<mat-option *ngFor="let planRole of planRolesEnum" [value]="planRole">{{enumUtils.toPlanUserRoleString(planRole)}}</mat-option>
</mat-select>

View File

@ -90,7 +90,7 @@ export class DescriptionStatusEditorModel extends BaseEditorModel implements Des
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'allowAnonymous', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, `${rootPath}allowAnonymous`)] });
baseValidationArray.push({ key: 'allowAuthenticated', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, `${rootPath}allowAuthenticated`)] });
baseValidationArray.push({ key: 'planRoles', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, `${rootPath}planRoles`)] });
baseValidationArray.push({ key: 'planRoles', validators: [ BackendErrorValidator(this.validationErrorModel, `${rootPath}planRoles`)] });
baseValidationArray.push({ key: 'roles', validators: [BackendErrorValidator(this.validationErrorModel, `${rootPath}roles`)] });
baseContext.validation = baseValidationArray;

View File

@ -101,7 +101,7 @@
</div>
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>{{'PLAN-STATUS-EDITOR.FIELDS.PLAN-ROLES' | translate}}*</mat-label>
<mat-label>{{'PLAN-STATUS-EDITOR.FIELDS.PLAN-ROLES' | translate}}</mat-label>
<mat-select [formControl]="editAuthenticationForm.controls.planRoles" [multiple]="true">
<mat-option *ngFor="let planRole of planRolesEnum" [value]="planRole">{{enumUtils.toPlanUserRoleString(planRole)}}</mat-option>
</mat-select>

View File

@ -91,7 +91,7 @@ export class PlanStatusEditorModel extends BaseEditorModel implements PlanStatus
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'allowAnonymous', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, `${rootPath}allowAnonymous`)] });
baseValidationArray.push({ key: 'allowAuthenticated', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, `${rootPath}allowAuthenticated`)] });
baseValidationArray.push({ key: 'planRoles', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, `${rootPath}planRoles`)] });
baseValidationArray.push({ key: 'planRoles', validators: [BackendErrorValidator(this.validationErrorModel, `${rootPath}planRoles`)] });
baseValidationArray.push({ key: 'roles', validators: [BackendErrorValidator(this.validationErrorModel, `${rootPath}roles`)] });
baseContext.validation = baseValidationArray;

View File

@ -66,7 +66,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
}
get canClonePlan(): boolean {
return this.plan.authorizationFlags?.some(x => x === AppPermission.ClonePlan) || this.authentication.hasPermission(AppPermission.ClonePlan) || (this.authentication.hasPermission(AppPermission.PublicClonePlan) && this.isPublic);
return this.plan.authorizationFlags?.some(x => x === AppPermission.ClonePlan) || this.authentication.hasPermission(AppPermission.ClonePlan) || (this.authentication.hasPermission(AppPermission.PublicClonePlan)) && !this.isDeleted;
}
get canFinalizePlan(): boolean {
@ -74,7 +74,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
}
get canExportPlan(): boolean {
return (this.plan.authorizationFlags?.some(x => x === AppPermission.ExportPlan) || this.authentication.hasPermission(AppPermission.ExportPlan)) && this.isPublic &&
return (this.plan.authorizationFlags?.some(x => x === AppPermission.ExportPlan) || this.authentication.hasPermission(AppPermission.ExportPlan)) && !this.isDeleted &&
this.plan.status?.definition?.availableActions?.filter(x => x === PlanStatusAvailableActionType.Export).length > 0;;
}
@ -127,7 +127,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
this.isPublished = false;
if (this.plan.status.internalStatus === PlanStatusEnum.Finalized && this.plan.accessType === PlanAccessType.Public) { this.isPublished = true }
}
if (this.plan.isActive != IsActive.Active) {
if (this.plan.isActive === IsActive.Inactive) {
this.isDeleted = true;
}
}