Merge remote-tracking branch 'DSpace_github/main' into w2p-108055_isClosed-config-ignored-fix

This commit is contained in:
Jens Vannerum
2023-11-09 11:02:52 +01:00
3 changed files with 50 additions and 47 deletions

View File

@@ -494,6 +494,8 @@ public class LDAPAuthentication
try { try {
SearchControls ctrls = new SearchControls(); SearchControls ctrls = new SearchControls();
ctrls.setSearchScope(ldap_search_scope_value); ctrls.setSearchScope(ldap_search_scope_value);
// Fetch both user attributes '*' (eg. uid, cn) and operational attributes '+' (eg. memberOf)
ctrls.setReturningAttributes(new String[] {"*", "+"});
String searchName; String searchName;
if (useTLS) { if (useTLS) {
@@ -700,13 +702,13 @@ public class LDAPAuthentication
/* /*
* Add authenticated users to the group defined in dspace.cfg by * Add authenticated users to the group defined in dspace.cfg by
* the authentication-ldap.login.groupmap.* key. * the authentication-ldap.login.groupmap.* key.
* *
* @param dn * @param dn
* The string containing distinguished name of the user * The string containing distinguished name of the user
* *
* @param group * @param group
* List of strings with LDAP dn of groups * List of strings with LDAP dn of groups
* *
* @param context * @param context
* DSpace context * DSpace context
*/ */

View File

@@ -152,17 +152,10 @@ public class Curation extends DSpaceRunnable<CurationScriptConfiguration> {
super.handler.logInfo("Curating id: " + entry.getObjectId()); super.handler.logInfo("Curating id: " + entry.getObjectId());
} }
curator.clear(); curator.clear();
// does entry relate to a DSO or workflow object? for (String taskName : entry.getTaskNames()) {
if (entry.getObjectId().indexOf('/') > 0) { curator.addTask(taskName);
for (String taskName : entry.getTaskNames()) {
curator.addTask(taskName);
}
curator.curate(context, entry.getObjectId());
} else {
// TODO: Remove this exception once curation tasks are supported by configurable workflow
// e.g. see https://github.com/DSpace/DSpace/pull/3157
throw new IllegalArgumentException("curation for workflow items is no longer supported");
} }
curator.curate(context, entry.getObjectId());
} }
queue.release(this.queue, ticket, true); queue.release(this.queue, ticket, true);
return ticket; return ticket;

View File

@@ -13,6 +13,7 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
@@ -139,40 +140,47 @@ public class XmlWorkflowCuratorServiceImpl
item.setOwningCollection(wfi.getCollection()); item.setOwningCollection(wfi.getCollection());
for (Task task : step.tasks) { for (Task task : step.tasks) {
curator.addTask(task.name); curator.addTask(task.name);
curator.curate(c, item); // Check whether the task is configured to be queued rather than automatically run
int status = curator.getStatus(task.name); if (StringUtils.isNotEmpty(step.queue)) {
String result = curator.getResult(task.name); // queue attribute has been set in the FlowStep configuration: add task to configured queue
String action = "none"; curator.queue(c, item.getID().toString(), step.queue);
switch (status) { } else {
case Curator.CURATE_FAIL: // Task is configured to be run automatically
// task failed - notify any contacts the task has assigned curator.curate(c, item);
if (task.powers.contains("reject")) { int status = curator.getStatus(task.name);
action = "reject"; String result = curator.getResult(task.name);
} String action = "none";
notifyContacts(c, wfi, task, "fail", action, result); switch (status) {
// if task so empowered, reject submission and terminate case Curator.CURATE_FAIL:
if ("reject".equals(action)) { // task failed - notify any contacts the task has assigned
workflowService.sendWorkflowItemBackSubmission(c, wfi, if (task.powers.contains("reject")) {
c.getCurrentUser(), null, action = "reject";
task.name + ": " + result); }
return false; notifyContacts(c, wfi, task, "fail", action, result);
} // if task so empowered, reject submission and terminate
break; if ("reject".equals(action)) {
case Curator.CURATE_SUCCESS: workflowService.sendWorkflowItemBackSubmission(c, wfi,
if (task.powers.contains("approve")) { c.getCurrentUser(), null,
action = "approve"; task.name + ": " + result);
} return false;
notifyContacts(c, wfi, task, "success", action, result); }
if ("approve".equals(action)) { break;
// cease further task processing and advance submission case Curator.CURATE_SUCCESS:
return true; if (task.powers.contains("approve")) {
} action = "approve";
break; }
case Curator.CURATE_ERROR: notifyContacts(c, wfi, task, "success", action, result);
notifyContacts(c, wfi, task, "error", action, result); if ("approve".equals(action)) {
break; // cease further task processing and advance submission
default: return true;
break; }
break;
case Curator.CURATE_ERROR:
notifyContacts(c, wfi, task, "error", action, result);
break;
default:
break;
}
} }
curator.clear(); curator.clear();
} }