mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 12:03:09 +00:00
[DS-259] Community/collection admin should not to be able to delete their admin group
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@4093 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -725,8 +725,20 @@ public class Collection extends DSpaceObject
|
||||
*/
|
||||
public void removeAdministrators() throws SQLException, AuthorizeException
|
||||
{
|
||||
// Check authorisation - Must be an Admin to delete Admin Group
|
||||
AuthorizeManager.authorizeAction(ourContext, this, Constants.ADMIN);
|
||||
// Check authorisation - Must be an Admin of the parent community to delete Admin Group
|
||||
Community[] parentCommunities = getCommunities();
|
||||
if (parentCommunities != null && parentCommunities.length > 0)
|
||||
{
|
||||
AuthorizeManager.authorizeAction(ourContext, this.getCommunities()[0], Constants.ADMIN);
|
||||
}
|
||||
else if (!AuthorizeManager.isAdmin(ourContext))
|
||||
{
|
||||
// this should never happen, a collection should always have at least one parent community!
|
||||
// anyway...
|
||||
throw new AuthorizeException(
|
||||
"Only system admin can remove the admin group of a collection outside any community",
|
||||
this, Constants.ADMIN);
|
||||
}
|
||||
|
||||
// just return if there is no administrative group.
|
||||
if (admins == null)
|
||||
|
Reference in New Issue
Block a user