From 360c249920d5e795a51d25a47bc63406e89d62a4 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 16 Oct 2017 16:10:19 -0400 Subject: [PATCH] reuse checkInReviewEditLock method (check for locks) #4139 We want to make sure people who can legitimately edit datasets can still do so. --- .../java/edu/harvard/iq/dataverse/DatasetPage.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index fae72edb8c1..d9107799d84 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -79,6 +79,7 @@ import java.util.logging.Level; import edu.harvard.iq.dataverse.datasetutility.TwoRavensHelper; import edu.harvard.iq.dataverse.datasetutility.WorldMapPermissionHelper; +import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.engine.command.impl.RequestRsyncScriptCommand; import edu.harvard.iq.dataverse.engine.command.impl.PublishDatasetResult; import edu.harvard.iq.dataverse.engine.command.impl.RestrictFileCommand; @@ -2662,13 +2663,16 @@ public boolean isLocked() { return false; } + /** + * Authors are not allowed to edit but curators are allowed. + */ public boolean isLockedFromEdits() { - // Authors are not allowed to edit but curators are allowed. - if (permissionsWrapper.canIssuePublishDatasetCommand(dataset)) { - return false; - } else { + try { + permissionService.checkInReviewEditLock(dataset, dvRequestService.getDataverseRequest(), new UpdateDatasetCommand(dataset, dvRequestService.getDataverseRequest())); + } catch (IllegalCommandException ex) { return true; } + return false; } public void setLocked(boolean locked) {