gov.nih.nci.caarray.common.delegate
Class SecurityManagerDelegate

java.lang.Object
  extended by gov.nih.nci.caarray.common.delegate.SecurityManagerDelegate

public final class SecurityManagerDelegate
extends java.lang.Object

Delegate class for security manager. Ony the getUserRole method is implemented which will authenticate the user and get his roles. The remaining methods in the security manager should only be accessed by other EJBs and hence are not supported in the delegate

Author:
mujus

Field Summary
static int LOCAL
           
static int REMOTE
           
 
Constructor Summary
SecurityManagerDelegate()
           
SecurityManagerDelegate(int localOrRemote)
          Overloaded contructor to support Local/Remote EJB lookups.
 
Method Summary
 SecuredElementItf[] canUserAccessElement(SecuredElementItf[] objects, java.lang.String[] roleIds)
          Checks if the user can access the securedElement for this Object.
 SecuredElementItf[] canUserAccessElement(SecuredElementItf[] objects, java.lang.String[] roleIds, ProtectionGroupData[] protectionGroups)
          Checks if the user can access the securedElement for this Object.
 SecuredElementItf canUserAccessElement(SecuredElementItf object, java.lang.String[] roleIds)
          Checks if the user can access the securedElemet for this Object.
 SecuredElementItf[] canUserAccessElement(java.lang.String userId, SecuredElementItf[] objectIds, java.lang.String[] roleIds)
          Deprecated.  
 boolean canUserAccessElement(java.lang.String userId, java.lang.String objectId, java.lang.String[] roleIds)
          Deprecated.  
 SecuredElementItf[] canUserAccessOwnerElement(SecuredElementItf[] objects)
          Checks if the user can access the securedElement for this Object.
 SecuredElementItf[] canUserAccessOwnerElementOnly(SecuredElementItf[] objects)
          Checks if the user can access the securedElement for this Object.
 int createSecuredElement(SecuredElementData secElemData)
          creates a secured element
 void deassignSecuredElementOwner(java.lang.String objectId)
          Deassign Secured Element Owner
 ProtectionGroupData[] getElementProtectionGroups(java.lang.String objectId)
          Gets Protection Groups associated with a Object
 java.lang.String getOwnersEmail(java.lang.String objectId)
          Gets email information for the owner of an object.
 ProtectionGroupData[] getProtectionGroups()
          Gets all the protection Groups in the system
 java.lang.String getUserEmail()
          Gets email information for the current user.
 java.lang.String getUserEmail(java.lang.String userName)
          Gets email information for the specified user.
 Role[] getUserRoleData(java.lang.String userName, java.lang.String password)
          Gets role information for the specified user.
 UserDesc[] getUsers()
          Gets role information for the specified user.
 boolean isUserAuthenticated(java.lang.String userName, java.lang.String password)
           
 boolean isUserElementOwner(java.lang.String objectId)
          Checks if the user is owner of the Object SecuredElement.
 boolean isUserElementOwner(java.lang.String userName, java.lang.String objectId)
          Deprecated.  
 void removeSecuredElement(java.lang.String objectId)
          remove a secured element from security database
 void setElementProtectionGroups(java.lang.String objectId, ProtectionGroupData[] protectionGroups)
          set ProtectionGroups for a securedElement/Object
 void setSecuredElementOwner(java.lang.String objectId, java.lang.String userName)
          Set New Secured Elemetn Owner
 void setSecuredElementProtectionGroups(java.lang.String objectId, ProtectionGroupData[] protectionGroups)
          update the protectionGroups associated with a Secured Element
 void updateSecuredElementProtectionGroups(java.lang.String objectId, ProtectionGroupData[] protectionGroups)
          update the protectionGroups associated with a Secured Element
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMOTE

public static final int REMOTE
See Also:
Constant Field Values

LOCAL

public static final int LOCAL
See Also:
Constant Field Values
Constructor Detail

SecurityManagerDelegate

public SecurityManagerDelegate()
                        throws GeneralException
Throws:
GeneralException

SecurityManagerDelegate

public SecurityManagerDelegate(int localOrRemote)
                        throws GeneralException
Overloaded contructor to support Local/Remote EJB lookups.

Parameters:
SecurityManagerDelegate.REMOTE - or LOCAL
Throws:
GeneralException
Method Detail

isUserAuthenticated

public boolean isUserAuthenticated(java.lang.String userName,
                                   java.lang.String password)
                            throws GeneralException
Throws:
GeneralException

getUsers

public UserDesc[] getUsers()
                    throws GeneralException
Gets role information for the specified user. Serves to authenticate the user as well.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

getUserRoleData

public Role[] getUserRoleData(java.lang.String userName,
                              java.lang.String password)
                       throws GeneralException
Gets role information for the specified user. Serves to authenticate the user as well.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

getUserEmail

public java.lang.String getUserEmail()
                              throws GeneralException
Gets email information for the current user.

Throws:
GeneralException

getOwnersEmail

public java.lang.String getOwnersEmail(java.lang.String objectId)
                                throws GeneralException
Gets email information for the owner of an object.

Parameters:
objectId - - The object id whose owners email to be retrieved.
Throws:
GeneralException

getUserEmail

public java.lang.String getUserEmail(java.lang.String userName)
                              throws GeneralException
Gets email information for the specified user.

Parameters:
userName - - The name of the user whose email to be retrieved.
Throws:
GeneralException

isUserElementOwner

public boolean isUserElementOwner(java.lang.String userName,
                                  java.lang.String objectId)
                           throws GeneralException
Deprecated. 

Checks if the user is owner of the Object SecuredElement.

Parameters:
userName - - The name of the user who is to be checked for ownership
objectId - - Object for which the ownership is to be checked
Throws:
GeneralException

isUserElementOwner

public boolean isUserElementOwner(java.lang.String objectId)
                           throws GeneralException
Checks if the user is owner of the Object SecuredElement. userName - The name of the user who is to be checked for ownership is passed via sessionContext

Parameters:
objectId - - Object for which the ownership is to be checked
Throws:
GeneralException

canUserAccessElement

public boolean canUserAccessElement(java.lang.String userId,
                                    java.lang.String objectId,
                                    java.lang.String[] roleIds)
                             throws GeneralException
Deprecated. 

Checks if the user can access the securedElemet for this Object.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

canUserAccessElement

public SecuredElementItf canUserAccessElement(SecuredElementItf object,
                                              java.lang.String[] roleIds)
                                       throws GeneralException
Checks if the user can access the securedElemet for this Object. userName - The name of the user whose roles are to be retrieved is passed via sessionContext

Throws:
GeneralException

canUserAccessElement

public SecuredElementItf[] canUserAccessElement(java.lang.String userId,
                                                SecuredElementItf[] objectIds,
                                                java.lang.String[] roleIds)
                                         throws GeneralException
Deprecated. 

Checks if the user can access the securedElement for this Object.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

canUserAccessElement

public SecuredElementItf[] canUserAccessElement(SecuredElementItf[] objects,
                                                java.lang.String[] roleIds)
                                         throws GeneralException
Checks if the user can access the securedElement for this Object.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

canUserAccessOwnerElement

public SecuredElementItf[] canUserAccessOwnerElement(SecuredElementItf[] objects)
                                              throws GeneralException
Checks if the user can access the securedElement for this Object.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

canUserAccessOwnerElementOnly

public SecuredElementItf[] canUserAccessOwnerElementOnly(SecuredElementItf[] objects)
                                                  throws GeneralException
Checks if the user can access the securedElement for this Object.

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

createSecuredElement

public int createSecuredElement(SecuredElementData secElemData)
                         throws GeneralException
creates a secured element

Parameters:
SecuredElementData - - Contains the attributes need to make a securedElement
Throws:
GeneralException

getProtectionGroups

public ProtectionGroupData[] getProtectionGroups()
                                          throws GeneralException
Gets all the protection Groups in the system

Throws:
GeneralException

getElementProtectionGroups

public ProtectionGroupData[] getElementProtectionGroups(java.lang.String objectId)
                                                 throws GeneralException
Gets Protection Groups associated with a Object

Parameters:
objectId - - Id of object for which protection groups are to be found.
Throws:
GeneralException

setSecuredElementOwner

public void setSecuredElementOwner(java.lang.String objectId,
                                   java.lang.String userName)
                            throws GeneralException
Set New Secured Elemetn Owner

Parameters:
objectId - - ID for object to which new owner is being assigned.
userName - - Name for new owner
Throws:
GeneralException

deassignSecuredElementOwner

public void deassignSecuredElementOwner(java.lang.String objectId)
                                 throws GeneralException
Deassign Secured Element Owner

Parameters:
objectId - - ID for object to which new owner is being assigned.
Throws:
GeneralException

setElementProtectionGroups

public void setElementProtectionGroups(java.lang.String objectId,
                                       ProtectionGroupData[] protectionGroups)
                                throws GeneralException
set ProtectionGroups for a securedElement/Object

Parameters:
userName - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

removeSecuredElement

public void removeSecuredElement(java.lang.String objectId)
                          throws GeneralException
remove a secured element from security database

Parameters:
objectId - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

updateSecuredElementProtectionGroups

public void updateSecuredElementProtectionGroups(java.lang.String objectId,
                                                 ProtectionGroupData[] protectionGroups)
                                          throws GeneralException
update the protectionGroups associated with a Secured Element

Parameters:
objectId - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

setSecuredElementProtectionGroups

public void setSecuredElementProtectionGroups(java.lang.String objectId,
                                              ProtectionGroupData[] protectionGroups)
                                       throws GeneralException
update the protectionGroups associated with a Secured Element

Parameters:
objectId - - The name of the user whose roles are to be retrieved.
Throws:
GeneralException

canUserAccessElement

public SecuredElementItf[] canUserAccessElement(SecuredElementItf[] objects,
                                                java.lang.String[] roleIds,
                                                ProtectionGroupData[] protectionGroups)
                                         throws GeneralException
Checks if the user can access the securedElement for this Object. This method takes in a Array of protection groups on which to filter the results.

Throws:
GeneralException