mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
60016: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 59975: MNT-10380: (WebDAV) access denied when attempting to rename file should result in error message. Previously fixed for same issue (was ALF-14398) but lost (most likely during a large merge). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62253 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -248,8 +248,6 @@ public class MoveMethod extends HierarchicalMethod
|
|||||||
else if (sourceParentNodeRef.equals(destParentNodeRef))
|
else if (sourceParentNodeRef.equals(destParentNodeRef))
|
||||||
{
|
{
|
||||||
// It is a simple rename operation
|
// It is a simple rename operation
|
||||||
try
|
|
||||||
{
|
|
||||||
// MNT-9939 - check overwrite
|
// MNT-9939 - check overwrite
|
||||||
if (hasOverWrite() && destFileInfo != null && !sourceFileInfo.equals(destFileInfo))
|
if (hasOverWrite() && destFileInfo != null && !sourceFileInfo.equals(destFileInfo))
|
||||||
{
|
{
|
||||||
@@ -265,20 +263,6 @@ public class MoveMethod extends HierarchicalMethod
|
|||||||
// As per the WebDAV spec, we make sure the node is unlocked once moved
|
// As per the WebDAV spec, we make sure the node is unlocked once moved
|
||||||
getDAVHelper().getLockService().unlock(sourceNodeRef);
|
getDAVHelper().getLockService().unlock(sourceNodeRef);
|
||||||
}
|
}
|
||||||
catch (AccessDeniedException e)
|
|
||||||
{
|
|
||||||
XMLWriter xml = createXMLWriter();
|
|
||||||
|
|
||||||
Attributes nullAttr = getDAVHelper().getNullAttributes();
|
|
||||||
|
|
||||||
xml.startElement(WebDAV.DAV_NS, WebDAV.XML_ERROR, WebDAV.XML_NS_ERROR, nullAttr);
|
|
||||||
// Output error
|
|
||||||
xml.write(DocumentHelper.createElement(WebDAV.XML_NS_CANNOT_MODIFY_PROTECTED_PROPERTY));
|
|
||||||
|
|
||||||
xml.endElement(WebDAV.DAV_NS, WebDAV.XML_ERROR, WebDAV.XML_NS_ERROR);
|
|
||||||
m_response.setStatus(HttpServletResponse.SC_CONFLICT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// It is a simple move operation
|
// It is a simple move operation
|
||||||
|
@@ -21,7 +21,6 @@ package org.alfresco.repo.webdav;
|
|||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -31,6 +30,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
@@ -217,6 +217,16 @@ public class MoveMethodTest
|
|||||||
verify(mockFileFolderService, never()).create(destParentNodeRef, "dest.doc", ContentModel.TYPE_CONTENT);
|
verify(mockFileFolderService, never()).create(destParentNodeRef, "dest.doc", ContentModel.TYPE_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test(expected=AccessDeniedException.class)
|
||||||
|
public void testMNT_10380_ThrowAccessDeniedExceptionWhenUserLacksPermissions() throws Exception
|
||||||
|
{
|
||||||
|
when(mockFileFolderService.rename(sourceNodeRef, "dest.doc")).
|
||||||
|
thenThrow(new AccessDeniedException("Access denied in test by mockFileFolderService"));
|
||||||
|
|
||||||
|
moveMethod.moveOrCopy(sourceNodeRef, sourceParentNodeRef, destParentNodeRef, "dest.doc");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMNT_9662()
|
public void testMNT_9662()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user