Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

57095: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      56580: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1)
         56026: Merged DEV to V4.1-BUG-FIX (4.1.7)
            55892: MNT-9485: MT Users added to Alfresco Administrators group via Group addition do not have 'admin' privileges
             - Build bridge cache on behalf of provided tenant user. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61724 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 19:31:02 +00:00
parent 4a8f60cdf5
commit c79482bafa

View File

@@ -21,6 +21,9 @@ package org.alfresco.repo.security.authority;
import java.util.List;
import org.alfresco.repo.cache.AbstractAsynchronouslyRefreshedCache;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.TenantAdminService;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.util.BridgeTable;
@@ -35,6 +38,7 @@ public class AuthorityBridgeTableAsynchronouslyRefreshedCache extends AbstractAs
{
private AuthorityBridgeDAO authorityBridgeDAO;
private RetryingTransactionHelper retryingTransactionHelper;
private TenantAdminService tenantAdminService;
/**
* @param authorityBridgeDAO
@@ -54,17 +58,29 @@ public class AuthorityBridgeTableAsynchronouslyRefreshedCache extends AbstractAs
this.retryingTransactionHelper = retryingTransactionHelper;
}
public void setTenantAdminService(TenantAdminService tenantAdminService)
{
this.tenantAdminService = tenantAdminService;
}
@Override
protected BridgeTable<String> buildCache(final String tenantId)
{
return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<BridgeTable<String>>()
return AuthenticationUtil.runAs(new RunAsWork<BridgeTable<String>>()
{
@Override
public BridgeTable<String> execute() throws Throwable
public BridgeTable<String> doWork() throws Exception
{
return doBuildCache(tenantId);
return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<BridgeTable<String>>()
{
@Override
public BridgeTable<String> execute() throws Throwable
{
return doBuildCache(tenantId);
}
}, true, false);
}
}, true, false);
}, tenantAdminService.getDomainUser(AuthenticationUtil.getSystemUserName(), tenantId));
}
private BridgeTable<String> doBuildCache(String tenantId)