Class MultiTenantHelper

    • Field Detail

      • CACHE_CONCURRENCY_LEVEL

        protected static final Integer CACHE_CONCURRENCY_LEVEL
      • CACHE_MAXIMUM_SIZE

        protected static final Integer CACHE_MAXIMUM_SIZE
      • CACHE_TIMEOUT

        protected static final Integer CACHE_TIMEOUT
      • pathCache

        protected static final com.google.common.cache.Cache<String,​String> pathCache
      • tenantBinding

        protected static final com.google.common.cache.Cache<String,​String> tenantBinding
    • Method Detail

      • computeTenantAdministratorsGroup

        public static String computeTenantAdministratorsGroup​(String tenantId)
      • computeTenantMembersGroup

        public static String computeTenantMembersGroup​(String tenantId)
      • getCurrentTenantId

        public static String getCurrentTenantId​(Principal principal)
        Returns the current tenantId for the given principal, or from the principal stored in the login stack.

        The principal is used if it is a SystemPrincipal, then the tenantId is retrieved from the Principal matching the SystemPrincipal.getOriginatingUser().

      • getTenantId

        public static String getTenantId​(String username)
        Returns the tenantId for the given username if any, null otherwise.
      • getTenantDocumentPath

        public static String getTenantDocumentPath​(CoreSession session,
                                                   String tenantId)
        Returns the path of the tenant document matching the tenantId, or null if there is no document matching.
      • getOwningTenantId

        public static String getOwningTenantId​(DocumentModel doc)
        Return the Tenant containing the provided DocumentModel if any
        Returns:
        DocumentModel corresponding to the Tenant container, null otherwise