[DS-3179] Collection admin, edit item no authorization to remove file in JSPUI

This commit is contained in:
KevinVdV
2016-05-03 12:01:38 +02:00
parent 2e309a116f
commit 1940e4e6a2
2 changed files with 27 additions and 4 deletions

View File

@@ -170,8 +170,6 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
log.info(LogManager.getHeader(context, "remove_bitstream",
"bundle_id=" + bundle.getID() + ",bitstream_id=" + bitstream.getID()));
bundle.getBitstreams().remove(bitstream);
bitstream.getBundles().remove(bundle);
context.addEvent(new Event(Event.REMOVE, Constants.BUNDLE, bundle.getID(),
Constants.BITSTREAM, bitstream.getID(), String.valueOf(bitstream.getSequenceID()),
@@ -193,7 +191,16 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
bundle.unsetPrimaryBitstreamID();
}
bitstreamService.delete(context, bitstream);
// Check if we our bitstream is part of a single bundle:
// If so delete it, if not then remove the link between bundle & bitstream
if(bitstream.getBundles().size() == 1)
{
// We don't need to remove the link between bundle & bitstream, this will be handled in the delete() method.
bitstreamService.delete(context, bitstream);
}else{
bundle.getBitstreams().remove(bitstream);
bitstream.getBundles().remove(bundle);
}
}
@Override