[DS-562] Community admin or user with WRITE, ADD and ADMIN policy on collection cannot delete that collection due to bug in AuthorizeUtil.authorizeManageTemplateItem(context,collection)

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5703 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Andrea Bollini
2010-11-01 11:50:13 +00:00
parent cb3161f6ca
commit 7a4fe91ccb
3 changed files with 8 additions and 3 deletions

View File

@@ -909,16 +909,20 @@ public class Collection extends DSpaceObject
collectionRow.setColumnNull("template_item_id");
DatabaseManager.update(ourContext, collectionRow);
if (template != null)
{
log.info(LogManager.getHeader(ourContext, "remove_template_item",
"collection_id=" + getID() + ",template_item_id="
+ template.getID()));
// temporary turn off auth system, we have already checked the permission on the top of the method
// check it again will fail because we have already broken the relation between the collection and the item
ourContext.turnOffAuthorisationSystem();
template.delete();
ourContext.restoreAuthSystemState();
template = null;
}
ourContext.addEvent(new Event(Event.MODIFY, Constants.COLLECTION, getID(), "remove_template_item"));
}