status workflow auth fixes
This commit is contained in:
parent
0689247781
commit
b7bd667486
|
@ -32,9 +32,9 @@ import org.opencdmp.model.builder.plan.PlanBuilder;
|
|||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.model.descriptionreference.DescriptionReference;
|
||||
import org.opencdmp.model.descriptionstatus.DescriptionStatus;
|
||||
import org.opencdmp.model.descriptionstatus.DescriptionStatusDefinitionAuthorization;
|
||||
import org.opencdmp.model.descriptiontemplate.DescriptionTemplate;
|
||||
import org.opencdmp.model.plan.Plan;
|
||||
import org.opencdmp.model.planstatus.PlanStatusDefinitionAuthorization;
|
||||
import org.opencdmp.model.user.User;
|
||||
import org.opencdmp.query.*;
|
||||
import org.opencdmp.service.custompolicy.CustomPolicyService;
|
||||
|
@ -394,9 +394,9 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
if (description == null) return allowed;
|
||||
|
||||
String editPermission = this.customPolicyService.getDescriptionStatusCanEditStatusPermission(description.getStatusId());
|
||||
AffiliatedResource affiliatedResource = this.authorizationContentResolver.planAffiliation(description.getPlanId());
|
||||
AffiliatedResource affiliatedResource = this.authorizationContentResolver.descriptionAffiliation(description.getId());
|
||||
for (String permission : statusAuthorizationFlags.getFields()) {
|
||||
if (statusAuthorizationFlags.hasField(this.asIndexer(PlanStatusDefinitionAuthorization._edit))) {
|
||||
if (statusAuthorizationFlags.hasField(this.asIndexer(DescriptionStatusDefinitionAuthorization._edit))) {
|
||||
Boolean isAllowed = affiliatedResource == null ? this.authorizationService.authorize(editPermission) : this.authorizationService.authorizeAtLeastOne(List.of(affiliatedResource), editPermission);
|
||||
if (isAllowed) allowed.add(permission);
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class DescriptionStatusServiceImpl implements DescriptionStatusService {
|
|||
List<DescriptionStatusEntity> statusEntities = this.queryFactory.query(DescriptionStatusQuery.class).isActive(IsActive.Active).collectAs(new BaseFieldSet().ensure(DescriptionStatus._id));
|
||||
for (DescriptionEntity description: descriptionEntities) {
|
||||
authorizedStatusMap.put(description.getId(), new ArrayList<>());
|
||||
AffiliatedResource affiliatedResource = this.authorizationContentResolver.planAffiliation(description.getPlanId());
|
||||
AffiliatedResource affiliatedResource = this.authorizationContentResolver.descriptionAffiliation(description.getId());
|
||||
for (DescriptionStatusEntity status: statusEntities) {
|
||||
|
||||
List<DescriptionWorkflowDefinitionTransitionEntity> availableTransitions = definition.getStatusTransitions().stream().filter(x -> x.getFromStatusId().equals(description.getStatusId())).collect(Collectors.toList());
|
||||
|
|
Loading…
Reference in New Issue