ALF-11722: Error fails when try to log in as disable tenant

* Added DisabledTenantException error
* Changed ExceptionTranslatiorMethodInterceptor to translated the above exception into an AuthenticationException



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32353 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward 2011-11-28 15:53:03 +00:00
parent a028484138
commit c6f4ac8b57
3 changed files with 9 additions and 1 deletions

View File

@ -48,6 +48,7 @@ system.locks.err.excl_lock_exists=Failed to get lock ''{0}'' using token ''{1}''
# Multi-Tenant
system.mt.warn.upgrade_mt_admin_context=Please update your alfresco/extension/mt/mt-admin-context.xml (to use latest alfresco/extension/mt/mt-admin-context.xml.sample).
system.mt.disabled=Tenant is disabled: {0}
# Usages
system.usage.err.no_txn=RepoUsageComponent must be called in a transaction.

View File

@ -18,7 +18,9 @@
*/
package org.alfresco.repo.security.permissions.impl;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.tenant.TenantDisabledException;
import org.alfresco.service.transaction.ReadOnlyServerException;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
@ -61,5 +63,10 @@ public class ExceptionTranslatorMethodInterceptor implements MethodInterceptor
// this usually occurs when the server is in read-only mode
throw new AccessDeniedException(ReadOnlyServerException.MSG_READ_ONLY, e);
}
catch (TenantDisabledException e)
{
// the cause already has an I18Nd message
throw new AuthenticationException(e.getMessage(), e);
}
}
}

View File

@ -671,7 +671,7 @@ public class MultiTServiceImpl implements TenantService
// note: System user can access disabled tenants
if (!AuthenticationUtil.isRunAsUserTheSystemUser() && !(getTenant(tenantDomain).isEnabled()))
{
throw new AlfrescoRuntimeException("Tenant is not enabled: " + tenantDomain);
throw new TenantDisabledException(tenantDomain);
}
}