Skip to content

Commit

Permalink
some minor cleanup changes #10623
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Aug 21, 2024
1 parent 4ae3ee6 commit 9cf4e1b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.harvard.iq.dataverse;

import jakarta.persistence.Column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,7 @@ public Response addFiles(String jsonData, Dataset dataset, User authUser) {
logger.log(Level.WARNING, "Dataset not locked for EditInProgress ");
} else {
datasetService.removeDatasetLocks(dataset, DatasetLock.Reason.EditInProgress);
logger.log(Level.INFO, "Removed EditInProgress lock "+eipLock.getId());
logger.log(Level.FINE, "Removed EditInProgress lock");
}

try {
Expand Down Expand Up @@ -2306,7 +2306,7 @@ public Response replaceFiles(String jsonData, Dataset ds, User authUser) {
logger.warning("Dataset not locked for EditInProgress ");
} else {
datasetService.removeDatasetLocks(dataset, DatasetLock.Reason.EditInProgress);
logger.info("Removed EditInProgress lock ");
logger.fine("Removed EditInProgress lock ");
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ public Dataset execute(CommandContext ctxt) throws CommandException {
}

Dataset theDataset = getDataset();
//ctxt.permissions().checkUpdateDatasetVersionLock(theDataset, getRequest(), this);
// this is an experiment (probably temporary)
checkUpdateDatasetVersionLock(ctxt);
ctxt.permissions().checkUpdateDatasetVersionLock(theDataset, getRequest(), this);

Dataset savedDataset = null;

Expand Down Expand Up @@ -302,22 +300,4 @@ public boolean onSuccess(CommandContext ctxt, Object r) {
return true;
}

private void checkUpdateDatasetVersionLock(CommandContext ctxt) throws IllegalCommandException {
List<DatasetLock> locks = ctxt.datasets().getLocksByDatasetId(getDataset().getId());
//locks.forEach(lock -> {
for (DatasetLock lock : locks) {
// Ingest lock is ok:
if (DatasetLock.Reason.Ingest != lock.getReason()) {
// with Workflow lock *some* users can edit;
// any other kind of lock - nope
if (DatasetLock.Reason.Workflow != lock.getReason()
|| !ctxt.permissions().isMatchingWorkflowLock(getDataset(),
getUser().getIdentifier(),
getRequest().getWFInvocationId())) {
throw new IllegalCommandException(
BundleUtil.getStringFromBundle("dataset.message.locked.editNotAllowed"), this);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.harvard.iq.dataverse.globus;

import edu.harvard.iq.dataverse.Dataset;
Expand Down

0 comments on commit 9cf4e1b

Please sign in to comment.