Fix for CLOUD-2151 - Changing the theme for the alfresco.com network on production does not take effect for all users

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@57263 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2013-10-28 14:47:21 +00:00
parent a1651c876a
commit 454adacee2

View File

@@ -546,26 +546,35 @@ public class ADMRemoteStore extends BaseRemoteStore
@Override @Override
protected void updateDocument(final WebScriptResponse res, String store, final String path, final InputStream content) protected void updateDocument(final WebScriptResponse res, String store, final String path, final InputStream content)
{ {
final String encpath = encodePath(path); final String runAsUser = getPathRunAsUser(path);
final FileInfo fileInfo = resolveFilePath(encpath); AuthenticationUtil.runAs(new RunAsWork<Void>()
if (fileInfo == null || fileInfo.isFolder())
{ {
res.setStatus(Status.STATUS_NOT_FOUND); @SuppressWarnings("synthetic-access")
return; public Void doWork() throws Exception
} {
final String encpath = encodePath(path);
final FileInfo fileInfo = resolveFilePath(encpath);
if (fileInfo == null || fileInfo.isFolder())
{
res.setStatus(Status.STATUS_NOT_FOUND);
return null;
}
try try
{ {
ContentWriter writer = contentService.getWriter(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true); ContentWriter writer = contentService.getWriter(fileInfo.getNodeRef(), ContentModel.PROP_CONTENT, true);
writer.putContent(content); writer.putContent(content);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("updateDocument: " + fileInfo.toString()); logger.debug("updateDocument: " + fileInfo.toString());
} }
catch (AccessDeniedException ae) catch (AccessDeniedException ae)
{ {
res.setStatus(Status.STATUS_UNAUTHORIZED); res.setStatus(Status.STATUS_UNAUTHORIZED);
throw ae; throw ae;
} }
return null;
}
}, runAsUser);
} }
/** /**