/** * Can the current user remove the admins group of the collection? * please note that the create/edit actions need separate check * * @param context the DSpace Context Object * @param collection the collection * @throws AuthorizeException if authorization error * if the current user is not allowed to remove the * collection's admins group * @throws SQLException if database error * if a db error occur * @see #authorizeManageAdminGroup(Context, Collection) */ public static void authorizeRemoveAdminGroup(Context context, Collection collection) throws AuthorizeException, SQLException { List<Community> parentCommunities = collection.getCommunities(); if (AuthorizeConfiguration .canCommunityAdminManageCollectionAdminGroup() && parentCommunities != null && parentCommunities.size() > 0) { authorizeService.authorizeAction(context, collection .getCommunities().get(0), Constants.ADMIN); } else if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only system admin can remove the admin group of a collection"); } }
/** * Can the current user create/edit the admins group of the collection? * please note that the remove action need a separate check * * @param context the DSpace Context Object * @param collection the collection * @throws AuthorizeException if authorization error * if the current user is not allowed to create/edit the * collection's admins group * @throws SQLException if database error * if a db error occur * @see #authorizeRemoveAdminGroup(Context, Collection) */ public static void authorizeManageAdminGroup(Context context, Collection collection) throws AuthorizeException, SQLException { if (AuthorizeConfiguration.canCollectionAdminManageAdminGroup()) { authorizeService.authorizeAction(context, collection, Constants.ADMIN); } else if (AuthorizeConfiguration .canCommunityAdminManageCollectionAdminGroup()) { authorizeService.authorizeAction(context, collection .getCommunities().get(0), Constants.ADMIN); } else if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only system admin are allowed to manage collection admin"); } }
|| AuthorizeConfiguration.canCommunityAdminManageAdminGroup() || AuthorizeConfiguration .canCommunityAdminManageCollectionAdminGroup() || AuthorizeConfiguration .canCommunityAdminManageCollectionSubmitters() if (AuthorizeConfiguration.canCollectionAdminManageAdminGroup()) { return collection; } else if (AuthorizeConfiguration.canCommunityAdminManageCollectionAdminGroup()) { return collectionService.getParentObject(context, collection);