Package org.nuxeo.ecm.multi.tenant
Class MultiTenantHelper
- java.lang.Object
-
- org.nuxeo.ecm.multi.tenant.MultiTenantHelper
-
public class MultiTenantHelper extends Object
- Since:
- 5.6
- Author:
- Thomas Roger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
MultiTenantHelper.TenantIdFinder
-
Field Summary
Fields Modifier and Type Field Description protected static Integer
CACHE_CONCURRENCY_LEVEL
protected static Integer
CACHE_MAXIMUM_SIZE
protected static Integer
CACHE_TIMEOUT
protected static String
NO_TENANT
protected static com.google.common.cache.Cache<String,String>
pathCache
protected static com.google.common.cache.Cache<String,String>
tenantBinding
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
computeTenantAdministratorsGroup(String tenantId)
static String
computeTenantMembersGroup(String tenantId)
static String
getCurrentTenantId(Principal principal)
Returns the current tenantId for the givenprincipal
, or from the principal stored in the login stack.static String
getOwningTenantId(DocumentModel doc)
Return the Tenant containing the provided DocumentModel if anystatic String
getTenantDocumentPath(CoreSession session, String tenantId)
Returns the path of the tenant document matching thetenantId
, ornull
if there is no document matching.static String
getTenantId(String username)
Returns the tenantId for the givenusername
if any,null
otherwise.
-
-
-
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
-
NO_TENANT
protected static final String NO_TENANT
- See Also:
- Constant Field Values
-
-
Method Detail
-
computeTenantAdministratorsGroup
public static String computeTenantAdministratorsGroup(String tenantId)
-
getCurrentTenantId
public static String getCurrentTenantId(Principal principal)
Returns the current tenantId for the givenprincipal
, or from the principal stored in the login stack.The
principal
is used if it is aSystemPrincipal
, then the tenantId is retrieved from the Principal matching theSystemPrincipal.getOriginatingUser()
.
-
getTenantId
public static String getTenantId(String username)
Returns the tenantId for the givenusername
if any,null
otherwise.
-
getTenantDocumentPath
public static String getTenantDocumentPath(CoreSession session, String tenantId)
Returns the path of the tenant document matching thetenantId
, ornull
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
-
-