[DS-3179] Collection admin, edit item no authorization to remove file in JSPUI: Additional fixes to fix the unit tests

This commit is contained in:
KevinVdV
2016-05-18 16:41:35 +02:00
parent b2260c48e9
commit 5ebaf76eea
2 changed files with 8 additions and 7 deletions

View File

@@ -668,9 +668,6 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
// Delete bitstream logo
setLogo(context, collection, null);
// Remove all authorization policies
authorizeService.removeAllPolicies(context, collection);
Iterator<WorkspaceItem> workspaceItems = workspaceItemService.findByCollection(context, collection).iterator();
while (workspaceItems.hasNext()) {
WorkspaceItem workspaceItem = workspaceItems.next();
@@ -738,6 +735,9 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
owningCommunity.getCollections().remove(collection);
}
// Remove all authorization policies
authorizeService.removeAllPolicies(context, collection);
collectionDAO.delete(context, collection);
}

View File

@@ -395,15 +395,16 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
// Check authorisation
authorizeService.authorizeAction(context, community, Constants.REMOVE);
community.removeCollection(collection);
ArrayList<String> removedIdentifiers = collectionService.getIdentifiers(context, collection);
String removedHandle = collection.getHandle();
UUID removedId = collection.getID();
collection.removeCommunity(community);
if(CollectionUtils.isEmpty(collection.getCommunities())){
if(collection.getCommunities().size() == 1)
{
collectionService.delete(context, collection);
}else{
community.removeCollection(collection);
collection.removeCommunity(community);
}
log.info(LogManager.getHeader(context, "remove_collection",