From b7416e159e6a4f6eb6338410f474072263ac650b Mon Sep 17 00:00:00 2001 From: Andrew Hind Date: Fri, 7 Mar 2008 20:39:18 +0000 Subject: [PATCH] Merged V2.2 to HEAD 8014: Extended support for RunAs - real and effctive authorities 8032: Build Fix - there is a special check for the effective user 8094: Fix for NPE in AuthenticationUtil noticed on first upgrade from V2.1.x to V2.2 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8471 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/web/bean/wcm/SubmitDialog.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java index 88d8d4f623..655b7a068c 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java @@ -46,6 +46,7 @@ import org.alfresco.model.WCMWorkflowModel; import org.alfresco.repo.avm.AVMDAOs; import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.domain.PropertyValue; +import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.workflow.WorkflowModel; @@ -471,9 +472,13 @@ public class SubmitDialog extends BaseDialogBean List items = getSubmitItems(); // construct diffs for selected items for submission - String sandboxPath = AVMUtil.buildSandboxRootPath(this.avmBrowseBean.getSandbox()); - String stagingPath = AVMUtil.buildSandboxRootPath(this.avmBrowseBean.getStagingStore()); - List diffs = new ArrayList(items.size()); + final String sandboxPath = AVMUtil.buildSandboxRootPath(this.avmBrowseBean.getSandbox()); + final String stagingPath = AVMUtil.buildSandboxRootPath(this.avmBrowseBean.getStagingStore()); + final List diffs = new ArrayList(items.size()); + final AVMSyncService syncService = this.getAvmSyncService(); + final String submitLabel = this.label; + final String submitComment = this.comment; + String storeId = this.avmBrowseBean.getWebProject().getStoreId(); for (ItemWrapper wrapper : items) { @@ -498,9 +503,23 @@ public class SubmitDialog extends BaseDialogBean } } // write changes to layer so files are marked as modified - this.getAvmSyncService().update(diffs, null, true, true, false, false, this.label, this.comment); - AVMDAOs.Instance().fAVMNodeDAO.flush(); - getAvmSyncService().flatten(sandboxPath, stagingPath); + + + // Submit is done as system as the staging store is read only + // We could add support to runIgnoringStoreACls + AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + { + public Object doWork() throws Exception + { + syncService.update(diffs, null, true, true, false, false, submitLabel, submitComment); + AVMDAOs.Instance().fAVMNodeDAO.flush(); + getAvmSyncService().flatten(sandboxPath, stagingPath); + return null; + } + }, AuthenticationUtil.getSystemUserName()); + + + // if we get this far return the default outcome return this.getDefaultFinishOutcome(); }