Class RepositoryContextHolder

java.lang.Object
com.emc.documentum.rest.config.RepositoryContextHolder

public class RepositoryContextHolder extends Object
A repository context holder contains the user credentials and other information for an authenticated security context. It is thread-safe. The repository context holder will be used first by the security modules to save the authenticated user credentials; later, it will be used by the persistence to create new session managers.
  • Field Details

  • Method Details

    • getRepositoryName

      public static String getRepositoryName()
      Get the repository for current user lives
      Returns:
      the repository name
    • getLoginName

      public static String getLoginName()
      Get the user login name for current user
      Returns:
      user_login_name for current user
    • getUserName

      public static String getUserName()
      Get the user_name (instead of user_login_name) for current user The retrieval is done via a DQL query and is not very cheap and the retrieved user_login_name will be stored in ThreadLocal for later use and will be destroyed when the context is destroyed
      Returns:
      user_name for the current user
    • getUserId

      public static String getUserId()
      Get the r_object_id value for current user.
      Returns:
      r_object_id value for the current user.
    • getDefaultFolder

      public static String getDefaultFolder()
      Get the default_folder for current user
      Returns:
      default_folder for the current user
    • getUserPrivileges

      public static int getUserPrivileges()
      Get user privileges of the login user.
      Returns:
      the user privileges
    • getUserExtendedPrivileges

      public static UserExtendedPrivileges getUserExtendedPrivileges()
      Get user extended privileges of the login user.
      Returns:
      the user extended privileges
    • getUserGroups

      public static Set<String> getUserGroups()
      Get belonging user groups of the login user.
      Returns:
      the belonging user groups of the login user
    • getPassword

      public static Object getPassword()
      Get the password of the login user.
      Returns:
      the password of the login user.
    • setRepositoryName

      public static void setRepositoryName(String repositoryName)
      Set the repository name into the repository context.
      Parameters:
      repositoryName - the repository name
    • setBaseUriInfo

      public static void setBaseUriInfo(BaseUriInfo uri)
      set the base uri info
      Parameters:
      uri - thr base uri
    • getBaseUriInfo

      public static BaseUriInfo getBaseUriInfo()
      Returns:
      the base uri info of current context
    • isCurrentRepository

      public static boolean isCurrentRepository(String repositoryName)
      Return true if the specified repository name is current user's login repository
      Parameters:
      repositoryName - the repository name
      Returns:
      true if the specified repository is current user login repository
    • setLoginName

      public static void setLoginName(String loginName)
      Set the login user name into the repository context.
      Parameters:
      loginName - the login user name
    • setUserName

      public static void setUserName(String userName)
      Set the user name into the repository context.
      Parameters:
      userName - the user name
    • setPassword

      public static void setPassword(Object password)
      Set the user password into the repository context.
      Parameters:
      password - the user password
    • getLoginTicket

      public static Object getLoginTicket()
      Get the login ticket for client-token mode from the repository context. This is maily aimed for CCE.
      Returns:
      the user login ticket for Documentum from the repository context
    • setLoginTicket

      public static void setLoginTicket(Object loginTicket)
      Set the login ticket for client-token mode from the repository context. This is maily aimed for CCE.
      Parameters:
      loginTicket - the user login ticket for Documentum from the repository context
    • getAuthType

      public static AuthType getAuthType()
      Get the user authentication type the repository context.
      Returns:
      the user authentication type the repository context
    • setAuthType

      public static void setAuthType(AuthType authType)
      Set the user authentication type into the repository context.
      Parameters:
      authType - the user authentication type
    • isSuperUser

      public static boolean isSuperUser()
      Whether the current user is super user
      Returns:
      true if current user is super user, else false
    • isSysAdmin

      public static boolean isSysAdmin()
      Whether the current user is sysAdmin
      Returns:
      true if current user is super user, else false
    • isSysAdminOrSuperUser

      public static boolean isSysAdminOrSuperUser()
      Whether the current user is sysAdmin or super user
      Returns:
      true if current user is super user or sys admin, else false
    • isGroupOwner

      public static boolean isGroupOwner(GroupObject group)
      Whether the current user is sepcified group's owner
      Parameters:
      group - the sepcified group. attribute owner_name must be provided.
      Returns:
      true if sepcified group's owner, else false
    • isGroupAdmin

      public static boolean isGroupAdmin(GroupObject group)
      Whether the current user is sepcified group's admin
      Parameters:
      group - the sepcified group. attribute group_admin must be provided.
      Returns:
      true if sepcified group's admin, else false
    • isContextSessionTransactional

      public static boolean isContextSessionTransactional()
      Check from the repository context whether the context session is transactional.
      Returns:
      true if the context session is transactional
    • setContextSessionTransactional

      public static void setContextSessionTransactional(boolean b)
      Set the context session transaction for the repository context.
      Parameters:
      b - true if the context session is transactional; false otherwise.
    • isContextSessionEnabled

      public static Boolean isContextSessionEnabled()
      Check from the repository context whether context session is enabled.
      Returns:
      true if the context session is enabled
    • setContextSessionEnabled

      public static void setContextSessionEnabled(Boolean enabled)
      Set the context session enabling into the repository context.
      Parameters:
      enabled - true if the context session is enabled; false otherwise.
    • getContextSession

      public static com.documentum.fc.client.IDfSession getContextSession()
      Return the context session.
      Returns:
      context session
    • setContextSession

      public static void setContextSession(com.documentum.fc.client.IDfSession session)
      Set the context session into the repository context.
      Parameters:
      session - the DFC session
    • safeClearContextSession

      public static void safeClearContextSession()
      Safely clear the context session.
    • setLocales

      public static void setLocales(List<Locale> locales)
      Set the locales for the login user.
      Parameters:
      locales - locales supported for the login user
    • getLocales

      public static List<Locale> getLocales()
      Get the locales for the login user.
      Returns:
      the supported locales for the login user
    • getPrimaryLocale

      public static Locale getPrimaryLocale()
      Get the primary locale from the locales.
      Returns:
      the primary locale supported for the login user
    • setAttribute

      public static void setAttribute(String attribute, Object value)
      Set an attribute into the repository context.
      Parameters:
      attribute - the attribute name
      value - the attribute value
    • getAttribute

      public static Object getAttribute(String attribute)
      Get the attribute value from the repository context by name.
      Parameters:
      attribute - the attribute name
      Returns:
      the attribute value
    • clear

      public static void clear()
      Clear everything in the repository context.
    • clearUserCredentials

      public static void clearUserCredentials()
      Clear user name and credentials for the repository context.