Skip to content

Commit

Permalink
Remove InReview lock when dataset is moved to a collection where the …
Browse files Browse the repository at this point in the history
…author can publish (#10729)

* #6575 remove lock if default role in target collection can publish

* #6575 Add unit tests

* #6575 format source
  • Loading branch information
sekmiller committed Aug 2, 2024
1 parent 0d27957 commit ff26ae8
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

import edu.harvard.iq.dataverse.Dataset;
import edu.harvard.iq.dataverse.DatasetLinkingDataverse;
import edu.harvard.iq.dataverse.DatasetLock;
import edu.harvard.iq.dataverse.Dataverse;
import edu.harvard.iq.dataverse.Guestbook;
import edu.harvard.iq.dataverse.authorization.DataverseRole;
import edu.harvard.iq.dataverse.authorization.Permission;
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
import edu.harvard.iq.dataverse.engine.command.AbstractVoidCommand;
Expand Down Expand Up @@ -135,7 +137,14 @@ public void executeImpl(CommandContext ctxt) throws CommandException {
}
throw new UnforcedCommandException(errorString.toString(), this);
}


// 6575 if dataset is submitted for review and the default contributor
// role includes dataset publish then remove the lock

if (moved.isLockedFor(DatasetLock.Reason.InReview)
&& destination.getDefaultContributorRole().permissions().contains(Permission.PublishDataset)) {
ctxt.datasets().removeDatasetLocks(moved, DatasetLock.Reason.InReview);
}

// OK, move
moved.setOwner(destination);
Expand Down
Loading

0 comments on commit ff26ae8

Please sign in to comment.