mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
[DS-270] Make delegate admin permissions configurable
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@4309 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -46,6 +46,7 @@ import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeConfiguration;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.AuthorizeManager;
|
||||
import org.dspace.authorize.ResourcePolicy;
|
||||
@@ -657,4 +658,79 @@ public class Bundle extends DSpaceObject
|
||||
AuthorizeManager.removeAllPolicies(ourContext, this);
|
||||
AuthorizeManager.addPolicies(ourContext, newpolicies, this);
|
||||
}
|
||||
|
||||
public DSpaceObject getAdminObject(int action) throws SQLException
|
||||
{
|
||||
DSpaceObject adminObject = null;
|
||||
Item[] items = getItems();
|
||||
Item item = null;
|
||||
Collection collection = null;
|
||||
Community community = null;
|
||||
if (items != null && items.length > 0)
|
||||
{
|
||||
item = items[0];
|
||||
collection = item.getOwningCollection();
|
||||
if (collection != null)
|
||||
{
|
||||
Community[] communities = collection.getCommunities();
|
||||
if (communities != null && communities.length > 0)
|
||||
{
|
||||
community = communities[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (action)
|
||||
{
|
||||
case Constants.REMOVE:
|
||||
if (AuthorizeConfiguration.canItemAdminPerformBitstreamDeletion())
|
||||
{
|
||||
adminObject = item;
|
||||
}
|
||||
else if (AuthorizeConfiguration.canCollectionAdminPerformBitstreamDeletion())
|
||||
{
|
||||
adminObject = collection;
|
||||
}
|
||||
else if (AuthorizeConfiguration
|
||||
.canCommunityAdminPerformBitstreamDeletion())
|
||||
{
|
||||
adminObject = community;
|
||||
}
|
||||
break;
|
||||
case Constants.ADD:
|
||||
if (AuthorizeConfiguration.canItemAdminPerformBitstreamCreation())
|
||||
{
|
||||
adminObject = item;
|
||||
}
|
||||
else if (AuthorizeConfiguration
|
||||
.canCollectionAdminPerformBitstreamCreation())
|
||||
{
|
||||
adminObject = collection;
|
||||
}
|
||||
else if (AuthorizeConfiguration
|
||||
.canCommunityAdminPerformBitstreamCreation())
|
||||
{
|
||||
adminObject = community;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
adminObject = this;
|
||||
break;
|
||||
}
|
||||
return adminObject;
|
||||
}
|
||||
|
||||
public DSpaceObject getParentObject() throws SQLException
|
||||
{
|
||||
Item[] items = getItems();
|
||||
|
||||
if (items != null && (items.length > 0 && items[0] != null))
|
||||
{
|
||||
return items[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user