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 classMultiTenantHelper.TenantIdFinder
-
Field Summary
Fields Modifier and Type Field Description protected static IntegerCACHE_CONCURRENCY_LEVELprotected static IntegerCACHE_MAXIMUM_SIZEprotected static IntegerCACHE_TIMEOUTprotected static StringNO_TENANTprotected static com.google.common.cache.Cache<String,String>pathCacheprotected static com.google.common.cache.Cache<String,String>tenantBinding
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcomputeTenantAdministratorsGroup(String tenantId)static StringcomputeTenantMembersGroup(String tenantId)static StringgetCurrentTenantId(Principal principal)Returns the current tenantId for the givenprincipal, or from the principal stored in the login stack.static StringgetOwningTenantId(DocumentModel doc)Return the Tenant containing the provided DocumentModel if anystatic StringgetTenantDocumentPath(CoreSession session, String tenantId)Returns the path of the tenant document matching thetenantId, ornullif there is no document matching.static StringgetTenantId(String username)Returns the tenantId for the givenusernameif any,nullotherwise.
-
-
-
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
principalis 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 givenusernameif any,nullotherwise.
-
getTenantDocumentPath
public static String getTenantDocumentPath(CoreSession session, String tenantId)
Returns the path of the tenant document matching thetenantId, ornullif 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
-
-