use of org.pentaho.platform.api.mt.ITenantManager in project pentaho-platform by pentaho.
the class DefaultBackingRepositoryLifecycleManager method startup.
@Override
public synchronized void startup() {
ITenant defaultTenant = null;
loginAsRepositoryAdmin();
createCustomPrivilege();
ITenantManager tenantMgr = getTenantManager();
ITenant systemTenant = tenantMgr.createTenant(null, ServerRepositoryPaths.getPentahoRootFolderName(), tenantAdminRoleName, tenantAuthenticatedRoleName, tenantAnonymousRoleName);
if (systemTenant != null) {
try {
userRoleDao.createUser(systemTenant, systemTenantAdminUserName, passwordService.decrypt(systemTenantAdminPassword), "System Tenant User", new String[] { tenantAdminRoleName, tenantAuthenticatedRoleName });
defaultTenant = tenantMgr.getTenant(JcrTenantUtils.getDefaultTenant().getId());
if (defaultTenant == null) {
// We'll create the default tenant here... maybe this isn't the best place.
defaultTenant = tenantMgr.createTenant(systemTenant, TenantUtils.TENANTID_SINGLE_TENANT, tenantAdminRoleName, tenantAuthenticatedRoleName, tenantAnonymousRoleName);
}
} catch (Throwable th) {
th.printStackTrace();
}
}
}
Aggregations