mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
DS-3851 partially remove legacy workflow to simplify testing
First tests for the workflow endpoint
This commit is contained in:
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.dspace.authorize.AuthorizeConfiguration;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.DSpaceObjectServiceImpl;
|
||||
import org.dspace.content.MetadataField;
|
||||
@@ -39,6 +40,8 @@ import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.event.Event;
|
||||
import org.dspace.util.UUIDUtils;
|
||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -62,6 +65,9 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
@Autowired(required = true)
|
||||
protected CollectionService collectionService;
|
||||
|
||||
@Autowired(required = true)
|
||||
protected CollectionRoleService collectionRoleService;
|
||||
|
||||
@Autowired(required = true)
|
||||
protected EPersonService ePersonService;
|
||||
|
||||
@@ -615,15 +621,6 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
org.dspace.content.Collection collection = collectionService.findByGroup(context, group);
|
||||
|
||||
if (collection != null) {
|
||||
if ((group.equals(collection.getWorkflowStep1()) ||
|
||||
group.equals(collection.getWorkflowStep2()) ||
|
||||
group.equals(collection.getWorkflowStep3()))) {
|
||||
if (AuthorizeConfiguration.canCollectionAdminManageWorkflows()) {
|
||||
return collection;
|
||||
} else if (AuthorizeConfiguration.canCommunityAdminManageCollectionWorkflows()) {
|
||||
return collectionService.getParentObject(context, collection);
|
||||
}
|
||||
}
|
||||
if (group.equals(collection.getSubmitters())) {
|
||||
if (AuthorizeConfiguration.canCollectionAdminManageSubmitters()) {
|
||||
return collection;
|
||||
@@ -638,10 +635,32 @@ public class GroupServiceImpl extends DSpaceObjectServiceImpl<Group> implements
|
||||
return collectionService.getParentObject(context, collection);
|
||||
}
|
||||
}
|
||||
} else if (AuthorizeConfiguration.canCommunityAdminManageAdminGroup()) {
|
||||
// is the group related to a community and community administrator allowed
|
||||
// to manage it?
|
||||
return communityService.findByAdminGroup(context, group);
|
||||
} else {
|
||||
if (AuthorizeConfiguration.canCollectionAdminManageWorkflows()
|
||||
|| AuthorizeConfiguration.canCommunityAdminManageCollectionWorkflows()) {
|
||||
// if the group is used for one or more roles on a single collection,
|
||||
// admins can eventually manage it
|
||||
List<CollectionRole> collectionRoles = collectionRoleService.findByGroup(context, group);
|
||||
if (collectionRoles != null && collectionRoles.size() > 0) {
|
||||
Set<Collection> colls = new HashSet<Collection>();
|
||||
for (CollectionRole cr : collectionRoles) {
|
||||
colls.add(cr.getCollection());
|
||||
}
|
||||
if (colls.size() == 1) {
|
||||
collection = colls.iterator().next();
|
||||
if (AuthorizeConfiguration.canCollectionAdminManageWorkflows()) {
|
||||
return collection;
|
||||
} else {
|
||||
return collectionService.getParentObject(context, collection);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (AuthorizeConfiguration.canCommunityAdminManageAdminGroup()) {
|
||||
// is the group related to a community and community administrator allowed
|
||||
// to manage it?
|
||||
return communityService.findByAdminGroup(context, group);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user