mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 12:03:09 +00:00
[DS-3179] Collection admin, edit item no authorization to remove file in JSPUI: Additional fixes to delete item as collection admin
This commit is contained in:
@@ -547,17 +547,18 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
||||
|
||||
@Override
|
||||
public void removeItem(Context context, Collection collection, Item item) throws SQLException, AuthorizeException, IOException {
|
||||
// Check authorisation
|
||||
// Check authorisation
|
||||
authorizeService.authorizeAction(context, collection, Constants.REMOVE);
|
||||
|
||||
//Remove the item from the collection
|
||||
item.removeCollection(collection);
|
||||
|
||||
//Check if we orphaned our poor item
|
||||
if (item.getCollections().isEmpty())
|
||||
if (item.getCollections().size() == 1)
|
||||
{
|
||||
// Orphan; delete it
|
||||
itemService.delete(context, item);
|
||||
} else {
|
||||
//Remove the item from the collection if we have multiple collections
|
||||
item.removeCollection(collection);
|
||||
|
||||
}
|
||||
|
||||
context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
|
||||
|
Reference in New Issue
Block a user