Skip to content

Commit

Permalink
EEA / Streamlining publication and groups - issue metadata unpublicat…
Browse files Browse the repository at this point in the history
…ion event when removing ALL group privileges from privileges dialog - improve check
  • Loading branch information
josegar74 committed Feb 29, 2024
1 parent 2be9157 commit 68393f2
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,18 +559,18 @@ private void setOperations(
}
}

if (sharing.isClear() && !metadataUtils.isMetadataPublished(metadata.getId())) {
// Throw the metadata unpublish event, as when removing privileges, are not part of the parameters,

java.util.Optional<GroupPrivilege> allGroupPrivsBefore =
sharingBefore.getPrivileges().stream().filter(p -> p.getGroup() == ReservedGroup.all.getId()).findFirst();
boolean publishedBefore = allGroupPrivsBefore.get().getOperations().get(ReservedOperation.view.name());

if (sharing.isClear() && publishedBefore && !metadataUtils.isMetadataPublished(metadata.getId())) {
// Throw the metadata unpublish event, when removing privileges, are not part of the parameters,
// not processed in setOperation / unsetOperation that triggers the metadata publish/unpublish events
eventPublisher.publishEvent(new MetadataUnpublished(metadata));
}

if (notifyByMail) {
java.util.Optional<GroupPrivilege> allGroupPrivsBefore =
sharingBefore.getPrivileges().stream().filter(p -> p.getGroup() == ReservedGroup.all.getId()).findFirst();

boolean publishedBefore = allGroupPrivsBefore.get().getOperations().get(ReservedOperation.view.name());

java.util.Optional<GroupOperations> allGroupOpsAfter =
privileges.stream().filter(p -> p.getGroup() == ReservedGroup.all.getId()).findFirst();

Expand Down

0 comments on commit 68393f2

Please sign in to comment.