org.dspace.app.util
Class AuthorizeUtil

java.lang.Object
  extended by org.dspace.app.util.AuthorizeUtil

public class AuthorizeUtil
extends Object

This class is an addition to the AuthorizeManager that perform authorization check on not crud (ADD, WRITE, etc.) actions.

Author:
bollini

Constructor Summary
AuthorizeUtil()
           
 
Method Summary
static void authorizeManageAdminGroup(Context context, Collection collection)
          Can the current user create/edit the admins group of the collection? please note that the remove action need a separate check
static void authorizeManageAdminGroup(Context context, Community community)
          Can the current user create/edit the admins group of the community? please note that the remove action need a separate check
static void authorizeManageBitstreamPolicy(Context context, Bitstream bitstream)
          Is allowed manage (create, remove, edit) bitstream's policies in the current context?
static void authorizeManageBundlePolicy(Context context, Bundle bundle)
          Is allowed manage (create, remove, edit) bundle's policies in the current context?
static void authorizeManageCCLicense(Context context, Item item)
          Is the current user allowed to manage (add, remove, replace) the item's CC License
static void authorizeManageCollectionPolicy(Context context, Collection collection)
          Is allowed manage (create, remove, edit) collection's policies in the current context?
static void authorizeManageCommunityPolicy(Context context, Community community)
          Is allowed manage (create, remove, edit) community's policies in the current context?
static void authorizeManageItemPolicy(Context context, Item item)
          Is allowed manage (create, remove, edit) item's policies in the current context?
static void authorizeManagePolicy(Context c, ResourcePolicy rp)
          Can the current user remove or edit the supplied policy?
static void authorizeManageSubmittersGroup(Context context, Collection collection)
          Can the current user manage (create, remove, edit) the submitters group of the collection?
static void authorizeManageTemplateItem(Context context, Collection collection)
          Is the current user allowed to manage (create, remove, edit) the collection's template item?
static void authorizeManageWorkflowsGroup(Context context, Collection collection)
          Can the current user manage (create, remove, edit) the workflow groups of the collection?
static void authorizeReinstateItem(Context context, Item item)
          Can the current user reistate the item?
static void authorizeRemoveAdminGroup(Context context, Collection collection)
          Can the current user remove the admins group of the collection? please note that the create/edit actions need separate check
static void authorizeRemoveAdminGroup(Context context, Community community)
          Can the current user remove the admins group of the community? please note that the create/edit actions need separate check
static void authorizeWithdrawItem(Context context, Item item)
          Can the current user withdraw the item?
static void requireAdminRole(Context context)
          Throw an AuthorizeException if the current user is not a System Admin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizeUtil

public AuthorizeUtil()
Method Detail

authorizeManageBitstreamPolicy

public static void authorizeManageBitstreamPolicy(Context context,
                                                  Bitstream bitstream)
                                           throws AuthorizeException,
                                                  SQLException
Is allowed manage (create, remove, edit) bitstream's policies in the current context?

Parameters:
context - the DSpace Context Object
bitstream - the bitstream that the policy refer to
Throws:
AuthorizeException - if the current context (current user) is not allowed to manage the bitstream's policies
SQLException - if a db error occur

authorizeManageBundlePolicy

public static void authorizeManageBundlePolicy(Context context,
                                               Bundle bundle)
                                        throws AuthorizeException,
                                               SQLException
Is allowed manage (create, remove, edit) bundle's policies in the current context?

Parameters:
context - the DSpace Context Object
bundle - the bundle that the policy refer to
Throws:
AuthorizeException - if the current context (current user) is not allowed to manage the bundle's policies
SQLException - if a db error occur

authorizeManageItemPolicy

public static void authorizeManageItemPolicy(Context context,
                                             Item item)
                                      throws AuthorizeException,
                                             SQLException
Is allowed manage (create, remove, edit) item's policies in the current context?

Parameters:
context - the DSpace Context Object
item - the item that the policy refer to
Throws:
AuthorizeException - if the current context (current user) is not allowed to manage the item's policies
SQLException - if a db error occur

authorizeManageCollectionPolicy

public static void authorizeManageCollectionPolicy(Context context,
                                                   Collection collection)
                                            throws AuthorizeException,
                                                   SQLException
Is allowed manage (create, remove, edit) collection's policies in the current context?

Parameters:
context - the DSpace Context Object
collection - the collection that the policy refer to
Throws:
AuthorizeException - if the current context (current user) is not allowed to manage the collection's policies
SQLException - if a db error occur

authorizeManageCommunityPolicy

public static void authorizeManageCommunityPolicy(Context context,
                                                  Community community)
                                           throws AuthorizeException,
                                                  SQLException
Is allowed manage (create, remove, edit) community's policies in the current context?

Parameters:
context - the DSpace Context Object
community - the community that the policy refer to
Throws:
AuthorizeException - if the current context (current user) is not allowed to manage the community's policies
SQLException - if a db error occur

requireAdminRole

public static void requireAdminRole(Context context)
                             throws AuthorizeException,
                                    SQLException
Throw an AuthorizeException if the current user is not a System Admin

Parameters:
context - the DSpace Context Object
Throws:
AuthorizeException - if the current user is not a System Admin
SQLException - if a db error occur

authorizeManageCCLicense

public static void authorizeManageCCLicense(Context context,
                                            Item item)
                                     throws AuthorizeException,
                                            SQLException
Is the current user allowed to manage (add, remove, replace) the item's CC License

Parameters:
context - the DSpace Context Object
item - the item that the CC License refer to
Throws:
AuthorizeException - if the current user is not allowed to manage the item's CC License
SQLException - if a db error occur

authorizeManageTemplateItem

public static void authorizeManageTemplateItem(Context context,
                                               Collection collection)
                                        throws AuthorizeException,
                                               SQLException
Is the current user allowed to manage (create, remove, edit) the collection's template item?

Parameters:
context - the DSpace Context Object
collection - the collection
Throws:
AuthorizeException - if the current user is not allowed to manage the collection's template item
SQLException - if a db error occur

authorizeManageSubmittersGroup

public static void authorizeManageSubmittersGroup(Context context,
                                                  Collection collection)
                                           throws AuthorizeException,
                                                  SQLException
Can the current user manage (create, remove, edit) the submitters group of the collection?

Parameters:
context - the DSpace Context Object
collection - the collection
Throws:
AuthorizeException - if the current user is not allowed to manage the collection's submitters group
SQLException - if a db error occur

authorizeManageWorkflowsGroup

public static void authorizeManageWorkflowsGroup(Context context,
                                                 Collection collection)
                                          throws AuthorizeException,
                                                 SQLException
Can the current user manage (create, remove, edit) the workflow groups of the collection?

Parameters:
context - the DSpace Context Object
collection - the collection
Throws:
AuthorizeException - if the current user is not allowed to manage the collection's workflow groups
SQLException - if a db error occur

authorizeManageAdminGroup

public static void authorizeManageAdminGroup(Context context,
                                             Collection collection)
                                      throws AuthorizeException,
                                             SQLException
Can the current user create/edit the admins group of the collection? please note that the remove action need a separate check

Parameters:
context - the DSpace Context Object
collection - the collection
Throws:
AuthorizeException - if the current user is not allowed to create/edit the collection's admins group
SQLException - if a db error occur
See Also:
authorizeRemoveAdminGroup(Context, Collection)

authorizeRemoveAdminGroup

public static void authorizeRemoveAdminGroup(Context context,
                                             Collection collection)
                                      throws AuthorizeException,
                                             SQLException
Can the current user remove the admins group of the collection? please note that the create/edit actions need separate check

Parameters:
context - the DSpace Context Object
collection - the collection
Throws:
AuthorizeException - if the current user is not allowed to remove the collection's admins group
SQLException - if a db error occur
See Also:
authorizeManageAdminGroup(Context, Collection)

authorizeManageAdminGroup

public static void authorizeManageAdminGroup(Context context,
                                             Community community)
                                      throws AuthorizeException,
                                             SQLException
Can the current user create/edit the admins group of the community? please note that the remove action need a separate check

Parameters:
context - the DSpace Context Object
community - the community
Throws:
AuthorizeException - if the current user is not allowed to create/edit the community's admins group
SQLException - if a db error occur
See Also:
authorizeRemoveAdminGroup(Context, Collection)

authorizeRemoveAdminGroup

public static void authorizeRemoveAdminGroup(Context context,
                                             Community community)
                                      throws SQLException,
                                             AuthorizeException
Can the current user remove the admins group of the community? please note that the create/edit actions need separate check

Parameters:
context - the DSpace Context Object
community - the community
Throws:
AuthorizeException - if the current user is not allowed to remove the collection's admins group
SQLException - if a db error occur
See Also:
authorizeManageAdminGroup(Context, Community)

authorizeManagePolicy

public static void authorizeManagePolicy(Context c,
                                         ResourcePolicy rp)
                                  throws SQLException,
                                         AuthorizeException
Can the current user remove or edit the supplied policy?

Parameters:
context - the DSpace Context Object
rp - a resource policy
Throws:
AuthorizeException - if the current context (current user) is not allowed to remove/edit the policy
SQLException - if a db error occur

authorizeWithdrawItem

public static void authorizeWithdrawItem(Context context,
                                         Item item)
                                  throws SQLException,
                                         AuthorizeException
Can the current user withdraw the item?

Parameters:
context - the DSpace Context Object
item - the item
Throws:
SQLException - if a db error occur
AuthorizeException - if the current user is not allowed to perform the item withdraw

authorizeReinstateItem

public static void authorizeReinstateItem(Context context,
                                          Item item)
                                   throws SQLException,
                                          AuthorizeException
Can the current user reistate the item?

Parameters:
context - the DSpace Context Object
item - the item
Throws:
SQLException - if a db error occur
AuthorizeException - if the current user is not allowed to perform the item reistate


Copyright © 2010 DuraSpace. All Rights Reserved.