gov.nih.nci.caarray.services.security.ejb
Class SecurityManagerEJB

java.lang.Object
  extended by gov.nih.nci.caarray.services.util.AbstractSessionBean
      extended by gov.nih.nci.caarray.services.security.ejb.SecurityManagerEJB
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class SecurityManagerEJB
extends AbstractSessionBean
implements javax.ejb.SessionBean

This class contains the implemention of the SecurityManager EJB.

Author:
Sumeet Muju
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.nih.nci.caarray.services.util.AbstractSessionBean
logger_, sessionCtx_
 
Constructor Summary
SecurityManagerEJB()
           
 
Method Summary
 SecuredElementItf[] canUserAccessElement(SecuredElementItf[] objectIds, java.lang.String[] roleIds)
          Checks if the user can access the securedElement for this Object.
 SecuredElementItf[] canUserAccessElement(SecuredElementItf[] objectIds, 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 securedElement for this Object.
 SecuredElementItf[] canUserAccessElement(java.lang.String userId, SecuredElementItf[] objectIds, java.lang.String[] roleIds)
          Checks if the user can access the securedElemet for this Object.
 boolean canUserAccessElement(java.lang.String userId, java.lang.String objectId, java.lang.String[] roleIds)
          Deprecated.  
 SecuredElementItf[] canUserAccessOwnerElement(SecuredElementItf[] objectIds)
          Checks if the user can access the securedElement for this Object.
 SecuredElementItf[] canUserAccessOwnerElementOnly(SecuredElementItf[] objectIds)
          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
 void ejbCreate()
           
 void ejbRemove()
          called when remove method is called.
 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 specified object.
 ProtectionGroupData[] getProtectionGroups()
          Gets all the protection Groups in the system
 UserDesc[] getSystemUsers()
          Gets all the active Users of 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.
 boolean isUserAuthenticated(java.lang.String userName, java.lang.String password)
          Authenticates the user
 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 Element Owner
 void updateElementProtectionGroups(java.lang.String objectId, ProtectionGroupData[] protectionGroups)
          updateProtectionGroups for a securedElement/Object
 
Methods inherited from class gov.nih.nci.caarray.services.util.AbstractSessionBean
disableAndRememberPreviousValueForCollectionDescriptorCascadeRetrieve, disableAndRememberPreviousValueForObjectDescriptorCascadeRetrieve, ejbActivate, ejbPassivate, getUserTransaction, resetCollectionDescriptorCascadeToPreviousValue, resetObjectDescriptorCascadeToPreviousValue, setSessionContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ejb.SessionBean
ejbActivate, ejbPassivate, setSessionContext
 

Constructor Detail

SecurityManagerEJB

public SecurityManagerEJB()
Method Detail

ejbCreate

public void ejbCreate()
Overrides:
ejbCreate in class AbstractSessionBean
Throws:
javax.ejb.CreateException
java.rmi.RemoteException

ejbRemove

public void ejbRemove()
called when remove method is called.

Specified by:
ejbRemove in interface javax.ejb.SessionBean
Overrides:
ejbRemove in class AbstractSessionBean
Throws:
javax.ejb.EJBException
java.rmi.RemoteException

isUserAuthenticated

public boolean isUserAuthenticated(java.lang.String userName,
                                   java.lang.String password)
                            throws GeneralException
Authenticates the user

Parameters:
userName - - The name to be authenticated
password - - Password
Returns:
boolean - true if authenticated, false if not.
Throws:
GeneralException

getSystemUsers

public UserDesc[] getSystemUsers()
                          throws GeneralException
Gets all the active Users of the system.

Throws:
GeneralException

getUserRoleData

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

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

getUserEmail

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

Throws:
java.lang.Exception

getUserEmail

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

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

getOwnersEmail

public java.lang.String getOwnersEmail(java.lang.String objectId)
                                throws java.lang.Exception
Gets email information for the specified object.

Parameters:
objectId - - The id of the object whose owners email to be retrieved.
Throws:
java.lang.Exception

isUserElementOwner

public boolean isUserElementOwner(java.lang.String userName,
                                  java.lang.String objectId)
                           throws SecurityException
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:
SecurityException

isUserElementOwner

public boolean isUserElementOwner(java.lang.String objectId)
                           throws SecurityException
Checks if the user is owner of the Object SecuredElement. Gets userName from sessionContext.

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

canUserAccessElement

public boolean canUserAccessElement(java.lang.String userId,
                                    java.lang.String objectId,
                                    java.lang.String[] roleIds)
                             throws SecurityException
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:
SecurityException

canUserAccessElement

public SecuredElementItf canUserAccessElement(SecuredElementItf object,
                                              java.lang.String[] roleIds)
                                       throws SecurityException
Checks if the user can access the securedElement for this Object. getsuserName from sessionContext.

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

canUserAccessElement

public SecuredElementItf[] canUserAccessElement(java.lang.String userId,
                                                SecuredElementItf[] objectIds,
                                                java.lang.String[] roleIds)
                                         throws SecurityException
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:
SecurityException

canUserAccessElement

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

Throws:
SecurityException

canUserAccessElement

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

Throws:
SecurityException

canUserAccessOwnerElement

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

Throws:
SecurityException

canUserAccessOwnerElementOnly

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

Throws:
SecurityException

createSecuredElement

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

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

getProtectionGroups

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

Throws:
SecurityException

getElementProtectionGroups

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

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

setSecuredElementOwner

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

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

deassignSecuredElementOwner

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

Parameters:
objectId - - ID for object to which owner is being deassigned.
Throws:
SecurityException

setElementProtectionGroups

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

Parameters:
objectId - - ID for object.
protectionGroups - - protectionGroups to which the object needs to be assigned.
Throws:
SecurityException

updateElementProtectionGroups

public void updateElementProtectionGroups(java.lang.String objectId,
                                          ProtectionGroupData[] protectionGroups)
                                   throws SecurityException
updateProtectionGroups for a securedElement/Object

Parameters:
objectId - - ID for object.
protectionGroups - - protectionGroups to which the object needs to be assigned.
Throws:
SecurityException

removeSecuredElement

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

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