mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
MT - fixes for new MT interceptor (create/login tenant admin, get stores)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10995 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -108,9 +108,11 @@ public class MultiTNodeServiceInterceptor extends DelegatingIntroductionIntercep
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
String methodName = invocation.getMethod().getName();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Intercepting method " + invocation.getMethod().getName());
|
||||
logger.debug("Intercepting method " + methodName);
|
||||
}
|
||||
|
||||
Object[] args = invocation.getArguments();
|
||||
@@ -162,8 +164,49 @@ public class MultiTNodeServiceInterceptor extends DelegatingIntroductionIntercep
|
||||
// Make the call
|
||||
Object ret = invocation.proceed();
|
||||
|
||||
// Convert the outbound value
|
||||
ret = convertOutboundValue(ret);
|
||||
if (methodName.equals("getStores"))
|
||||
{
|
||||
if ((ret == null) || (! (ret instanceof List)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<StoreRef> rawValues = (List<StoreRef>)ret;
|
||||
final List<StoreRef> convertedValues = new ArrayList<StoreRef>(rawValues.size());
|
||||
|
||||
for (StoreRef ref : rawValues)
|
||||
{
|
||||
StoreRef storeRef = ref;
|
||||
try
|
||||
{
|
||||
if (tenantService.isEnabled())
|
||||
{
|
||||
String currentUser = AuthenticationUtil.getCurrentUserName();
|
||||
|
||||
// MT: return tenant stores only (although for super System return all stores - as used by
|
||||
// ConfigurationChecker, IndexRecovery, IndexBackup etc)
|
||||
if ((currentUser == null) || (!currentUser.equals(AuthenticationUtil.getSystemUserName())))
|
||||
{
|
||||
tenantService.checkDomain(storeRef.getIdentifier());
|
||||
storeRef = tenantService.getBaseName(storeRef);
|
||||
}
|
||||
}
|
||||
|
||||
convertedValues.add(storeRef);
|
||||
}
|
||||
catch (RuntimeException re)
|
||||
{
|
||||
// deliberately ignore - stores in different domain will not be listed
|
||||
}
|
||||
}
|
||||
|
||||
return convertedValues;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Convert the outbound value
|
||||
ret = convertOutboundValue(ret);
|
||||
}
|
||||
|
||||
// done
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user