MT - fix SLNG-1183

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10890 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-09-11 22:52:08 +00:00
parent 8f2f0ed14f
commit 3ca446e81e
6 changed files with 42 additions and 9 deletions

View File

@@ -18,7 +18,7 @@
<import resource="classpath:alfresco/network-protocol-context.xml" /> <import resource="classpath:alfresco/network-protocol-context.xml" />
<import resource="classpath:alfresco/emailserver/email-service-context.xml" /> <import resource="classpath:alfresco/emailserver/email-service-context.xml" />
<import resource="classpath:alfresco/content-services-context.xml" /> <import resource="classpath:alfresco/content-services-context.xml" />
<import resource="classpath*:alfresco/mt/*-context.xml"/> <import resource="classpath:alfresco/mt/st-admin-context.xml"/>
<import resource="classpath:alfresco/hibernate-context.xml" /> <import resource="classpath:alfresco/hibernate-context.xml" />
<import resource="classpath:alfresco/ownable-services-context.xml" /> <import resource="classpath:alfresco/ownable-services-context.xml" />
<import resource="classpath:alfresco/template-services-context.xml" /> <import resource="classpath:alfresco/template-services-context.xml" />

View File

@@ -3,8 +3,19 @@
<!-- Beans pertinent to content usage / quota service --> <!-- Beans pertinent to content usage / quota service -->
<beans> <beans>
<bean id="usageService" class="org.alfresco.repo.usage.UsageServiceImpl"> <bean id="usageService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<ref bean="usageServiceImpl" />
</property>
<property name="interceptorNames">
<list>
<value>multiTNodeServiceInterceptor</value>
</list>
</property>
</bean>
<bean id="usageServiceImpl" class="org.alfresco.repo.usage.UsageServiceImpl">
<property name="usageDeltaDAO" ref="usageDeltaDAO"/> <property name="usageDeltaDAO" ref="usageDeltaDAO"/>
</bean> </bean>

View File

@@ -1139,7 +1139,7 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
} }
} }
// tenant deployer services delegated to tenant service // tenant deployer/user services delegated to tenant service
public boolean isEnabled() public boolean isEnabled()
{ {
@@ -1151,6 +1151,11 @@ public class MultiTAdminServiceImpl implements TenantAdminService, ApplicationCo
return tenantService.getCurrentUserDomain(); return tenantService.getCurrentUserDomain();
} }
public String getUserDomain(String username)
{
return tenantService.getUserDomain(username);
}
public String getDomainUser(String baseUsername, String tenantDomain) public String getDomainUser(String baseUsername, String tenantDomain)
{ {
return tenantService.getDomainUser(baseUsername, tenantDomain); return tenantService.getDomainUser(baseUsername, tenantDomain);

View File

@@ -109,6 +109,14 @@ public class SingleTAdminServiceImpl implements TenantAdminService
return TenantService.DEFAULT_DOMAIN; return TenantService.DEFAULT_DOMAIN;
} }
/**
* @return Returns {@link TenantService#DEFAULT_DOMAIN} always
*/
public String getUserDomain(String username)
{
return TenantService.DEFAULT_DOMAIN;
}
/** /**
* @return Returns the given <tt>baseUserName</tt> always * @return Returns the given <tt>baseUserName</tt> always
*/ */

View File

@@ -3,7 +3,7 @@ package org.alfresco.repo.tenant;
/** /**
* Interface for Tenant User-Domain functionality. * Interface for Tenant User-Domain functionality.
* *
* @author Jan Vonka * @author janv
* @author Derek Hulley * @author Derek Hulley
* @since 3.0 * @since 3.0
*/ */
@@ -11,9 +11,11 @@ public interface TenantUserService
{ {
public String getCurrentUserDomain(); public String getCurrentUserDomain();
public String getDomain(String name);
public String getUserDomain(String username);
public String getDomainUser(String baseUsername, String tenantDomain); public String getDomainUser(String baseUsername, String tenantDomain);
public String getDomain(String name);
public boolean isEnabled(); public boolean isEnabled();
} }

View File

@@ -254,9 +254,16 @@ public class UserUsageTrackingComponent
// execute in READ-ONLY txn // execute in READ-ONLY txn
final Set<String> userNames = txnHelper.doInTransaction(getAllPeople, true); final Set<String> userNames = txnHelper.doInTransaction(getAllPeople, true);
for (String userName : userNames) for (final String userName : userNames)
{ {
recalculateUsage(userName); AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
recalculateUsage(userName);
return null;
}
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantAdminService.getUserDomain(userName)));
} }
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())