org.dspace.sword
Class SWORDContext

java.lang.Object
  extended by org.dspace.sword.SWORDContext

public class SWORDContext
extends Object

This class represents the users who are involved in the deposit or service document request process. This is the authenticated primary user and the potentially null onBehalfOf user. It can then answer various authorisation questions regarding those users.

Author:
Richard Jones

Constructor Summary
SWORDContext()
           
 
Method Summary
 boolean canSubmitTo(Context context, Collection collection)
          Can the current SWORD Context permit deposit into the given collection in the given DSpace Context
 Collection[] getAllowedCollections(Context context)
          Get an array of all the collections that the current SWORD context will allow deposit onto in the given DSpace context
 EPerson getAuthenticated()
           
 EPerson getOnBehalfOf()
           
 boolean isInGroup(Group group, EPerson eperson)
          Is the given eperson in the given group, or any of the groups that are also members of that group.
 boolean isOnBehalfOfAdmin(Context context)
          Is the given onBehalfOf user DSpace administrator? This translates as asking the question of whether the given eperson is a member of the special DSpace group Administrator, with id 1
 boolean isOnBehalfOfInGroup(Group group)
          Is the onBehalfOf user a member of the given group or one of its sub groups
 boolean isUserAdmin(Context context)
          Is the authenticated user a DSpace administrator? This translates as asking the question of whether the given eperson is a member of the special DSpace group Administrator, with id 1
 boolean isUserInGroup(Group group)
          Is the authenticated user a member of the given group or one of its sub groups?
 void setAuthenticated(EPerson authenticated)
           
 void setOnBehalfOf(EPerson onBehalfOf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWORDContext

public SWORDContext()
Method Detail

getAuthenticated

public EPerson getAuthenticated()
Returns:
the authenticated user

setAuthenticated

public void setAuthenticated(EPerson authenticated)
Parameters:
authenticated - the eperson to set

getOnBehalfOf

public EPerson getOnBehalfOf()
Returns:
the onBehalfOf user

setOnBehalfOf

public void setOnBehalfOf(EPerson onBehalfOf)
Parameters:
onBehalfOf - the eperson to set

isUserAdmin

public boolean isUserAdmin(Context context)
                    throws DSpaceSWORDException
Is the authenticated user a DSpace administrator? This translates as asking the question of whether the given eperson is a member of the special DSpace group Administrator, with id 1

Parameters:
eperson -
Returns:
true if administrator, false if not
Throws:
SQLException
DSpaceSWORDException

isOnBehalfOfAdmin

public boolean isOnBehalfOfAdmin(Context context)
                          throws DSpaceSWORDException
Is the given onBehalfOf user DSpace administrator? This translates as asking the question of whether the given eperson is a member of the special DSpace group Administrator, with id 1

Parameters:
eperson -
Returns:
true if administrator, false if not
Throws:
SQLException
DSpaceSWORDException

isUserInGroup

public boolean isUserInGroup(Group group)
Is the authenticated user a member of the given group or one of its sub groups?

Parameters:
group -
Returns:

isOnBehalfOfInGroup

public boolean isOnBehalfOfInGroup(Group group)
Is the onBehalfOf user a member of the given group or one of its sub groups

Parameters:
group -
Returns:

isInGroup

public boolean isInGroup(Group group,
                         EPerson eperson)
Is the given eperson in the given group, or any of the groups that are also members of that group. This method recurses until it has exhausted the tree of groups or finds the given eperson

Parameters:
group -
eperson -
Returns:
true if in group, false if not

getAllowedCollections

public Collection[] getAllowedCollections(Context context)
                                   throws DSpaceSWORDException
Get an array of all the collections that the current SWORD context will allow deposit onto in the given DSpace context

Parameters:
context -
Returns:
the array of allowed collections
Throws:
DSpaceSWORDException

canSubmitTo

public boolean canSubmitTo(Context context,
                           Collection collection)
                    throws DSpaceSWORDException
Can the current SWORD Context permit deposit into the given collection in the given DSpace Context

Parameters:
context -
collection -
Returns:
Throws:
DSpaceSWORDException


Copyright © 2008 The DSpace Foundation. All Rights Reserved.