Merged V3.0 to HEAD

11919: Split toolbar fixes for wiki and versioning improvements. ETHREEOH-746 Unable to view contents of previous versions of wiki page.
   11920: ETHREEOH-510 Create toolbar for blog & discussions (make it a splitbar with changing link arrows)
   11921: ETHREEOH-448 - Incorrect behavior of Tags working in Share
   11922: ETHREEOH-698 - Error and browser disabling in case incorrect data is entered on the Alfresco Global Feed
   11925: Merged V3.0 to V2.2
      11870: Fixed ETWOTWO-836: NPE when clearCurrentSecurityContext is called in a runAs
             This merge was required for merging after revision 11782 was merged across
   11928: preview and full-preview component previously had a white background, and distorted the view for dialogs. Now its transparent and doesn't hide parts of dialogs.
   11929: ETHREEOH-881
   11931: Follow-up fixes for YUI 2.6.0 upgrade and Pagination
   11932: DocLib Copy-to and Move-to dialogs: fixes to tree clicking and now scroll site and container lists to current selection
   11933: Workarounds for renderLoopSize bug in DataTable

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2008-12-18 13:40:13 +00:00
parent 6608333df2
commit 8075fff6b6
4 changed files with 47 additions and 50 deletions

View File

@@ -35,6 +35,8 @@ import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.rule.RuleServiceImpl; import org.alfresco.repo.rule.RuleServiceImpl;
import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.TransactionListenerAdapter; import org.alfresco.repo.transaction.TransactionListenerAdapter;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -350,40 +352,33 @@ public class AsynchronousActionExecutionQueueImpl implements AsynchronousActionE
throw new ActionServiceException("Cannot execute action asynchronously since run as user is 'null'"); throw new ActionServiceException("Cannot execute action asynchronously since run as user is 'null'");
} }
authenticationComponent.setCurrentUser(userName); // import the content
RunAsWork<Object> actionRunAs = new RunAsWork<Object>()
try
{ {
RetryingTransactionCallback<Object> actionCallback = new RetryingTransactionCallback<Object>() public Object doWork() throws Exception
{ {
public Object execute() RetryingTransactionCallback<Object> actionCallback = new RetryingTransactionCallback<Object>()
{ {
// Bind the callback listener public Object execute()
CallbackTransactionListener tl = new CallbackTransactionListener(action, actionedUponNodeRef); {
AlfrescoTransactionSupport.bindListener(tl); if (ActionExecutionWrapper.this.executedRules != null)
{
if (ActionExecutionWrapper.this.executedRules != null) AlfrescoTransactionSupport.bindResource("RuleServiceImpl.ExecutedRules", ActionExecutionWrapper.this.executedRules);
{ }
AlfrescoTransactionSupport.bindResource("RuleServiceImpl.ExecutedRules", ActionExecutionWrapper.this.executedRules);
} ActionExecutionWrapper.this.actionService.executeActionImpl(
ActionExecutionWrapper.this.action,
// Execute the action ActionExecutionWrapper.this.actionedUponNodeRef,
actionService.executeActionImpl( ActionExecutionWrapper.this.checkConditions, true,
action, ActionExecutionWrapper.this.actionChain);
actionedUponNodeRef,
checkConditions,
true,
actionChain);
return null; return null;
} }
}; };
transactionService.getRetryingTransactionHelper().doInTransaction(actionCallback); return transactionService.getRetryingTransactionHelper().doInTransaction(actionCallback);
} }
finally };
{ AuthenticationUtil.runAs(actionRunAs, userName);
authenticationComponent.clearCurrentSecurityContext();
}
} }
catch (Throwable exception) catch (Throwable exception)
{ {

View File

@@ -32,6 +32,8 @@ import org.alfresco.i18n.I18NUtil;
import org.alfresco.repo.admin.patch.AbstractPatch; import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.importer.ACPImportPackageHandler; import org.alfresco.repo.importer.ACPImportPackageHandler;
import org.alfresco.repo.importer.ImporterBootstrap; import org.alfresco.repo.importer.ImporterBootstrap;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.admin.PatchException; import org.alfresco.service.cmr.admin.PatchException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -171,16 +173,15 @@ public class EmailTemplatesContentPatch extends AbstractPatch
setUp(); setUp();
// import the content // import the content
try RunAsWork<Object> importRunAs = new RunAsWork<Object>()
{ {
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); public Object doWork() throws Exception
{
importContent(); importContent();
} return null;
finally }
{ };
authenticationComponent.clearCurrentSecurityContext(); AuthenticationUtil.runAs(importRunAs, authenticationComponent.getSystemUserName());
}
// output a message to describe the result // output a message to describe the result
return I18NUtil.getMessage(MSG_CREATED); return I18NUtil.getMessage(MSG_CREATED);

View File

@@ -37,6 +37,8 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.admin.patch.AbstractPatch; import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.importer.ACPImportPackageHandler; import org.alfresco.repo.importer.ACPImportPackageHandler;
import org.alfresco.repo.importer.ImporterBootstrap; import org.alfresco.repo.importer.ImporterBootstrap;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.admin.PatchException; import org.alfresco.service.cmr.admin.PatchException;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -222,16 +224,15 @@ public class ScriptsFolderPatch extends AbstractPatch
createFolder(); createFolder();
// import the content // import the content
try RunAsWork<Object> importRunAs = new RunAsWork<Object>()
{ {
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); public Object doWork() throws Exception
{
importContent(); importContent();
} return null;
finally }
{ };
authenticationComponent.clearCurrentSecurityContext(); AuthenticationUtil.runAs(importRunAs, authenticationComponent.getSystemUserName());
}
msg = I18NUtil.getMessage(MSG_CREATED, scriptsFolderNodeRef); msg = I18NUtil.getMessage(MSG_CREATED, scriptsFolderNodeRef);
} }

View File

@@ -608,7 +608,7 @@ public abstract class AuthenticationUtil
} }
else else
{ {
if(!AuthenticationUtil.getCurrentRealUserName().equals(realUser)) if(!realUser.equals(AuthenticationUtil.getCurrentRealUserName()))
{ {
AuthenticationUtil.setCurrentRealUser(realUser); AuthenticationUtil.setCurrentRealUser(realUser);
s_logger.warn("Resetting real user which has changed in RunAs block"); s_logger.warn("Resetting real user which has changed in RunAs block");