mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 13:03:11 +00:00
added implementation that allows to see withdrawn items to anonynous groups
This commit is contained in:
@@ -8,8 +8,10 @@
|
|||||||
package org.dspace.app.rest.converter;
|
package org.dspace.app.rest.converter;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -73,6 +75,9 @@ public class ItemConverter
|
|||||||
List<MetadataValue> fullList = itemService.getMetadata(obj, Item.ANY, Item.ANY, Item.ANY, Item.ANY, true);
|
List<MetadataValue> fullList = itemService.getMetadata(obj, Item.ANY, Item.ANY, Item.ANY, Item.ANY, true);
|
||||||
List<MetadataValue> returnList = new LinkedList<>();
|
List<MetadataValue> returnList = new LinkedList<>();
|
||||||
try {
|
try {
|
||||||
|
if (obj.isWithdrawn() && (Objects.isNull(context) || Objects.isNull(context.getCurrentUser()))) {
|
||||||
|
return new MetadataValueList(new ArrayList<MetadataValue>());
|
||||||
|
}
|
||||||
if (context != null && authorizeService.isAdmin(context)) {
|
if (context != null && authorizeService.isAdmin(context)) {
|
||||||
return new MetadataValueList(fullList);
|
return new MetadataValueList(fullList);
|
||||||
}
|
}
|
||||||
|
@@ -89,8 +89,10 @@ public class AuthorizeServicePermissionEvaluatorPlugin extends RestObjectPermiss
|
|||||||
// If the item is still inprogress we can process here only the READ permission.
|
// If the item is still inprogress we can process here only the READ permission.
|
||||||
// Other actions need to be evaluated against the wrapper object (workspace or workflow item)
|
// Other actions need to be evaluated against the wrapper object (workspace or workflow item)
|
||||||
if (dSpaceObject instanceof Item) {
|
if (dSpaceObject instanceof Item) {
|
||||||
if (!DSpaceRestPermission.READ.equals(restPermission)
|
if (((Item) dSpaceObject).isWithdrawn()) {
|
||||||
&& !((Item) dSpaceObject).isArchived() && !((Item) dSpaceObject).isWithdrawn()) {
|
return true;
|
||||||
|
}
|
||||||
|
if (!DSpaceRestPermission.READ.equals(restPermission) && !((Item) dSpaceObject).isArchived()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user