mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-1164: [REST API] 422 error when executing unlock on a node that is not locked
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130400 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -62,6 +62,7 @@ import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
|
|||||||
import org.alfresco.repo.node.getchildren.FilterProp;
|
import org.alfresco.repo.node.getchildren.FilterProp;
|
||||||
import org.alfresco.repo.node.getchildren.FilterPropBoolean;
|
import org.alfresco.repo.node.getchildren.FilterPropBoolean;
|
||||||
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
|
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
@@ -2966,7 +2967,7 @@ public class NodesImpl implements Nodes
|
|||||||
|
|
||||||
if (!nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null, false))
|
if (!nodeMatches(nodeRef, Collections.singleton(ContentModel.TYPE_CONTENT), null, false))
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException("NodeId of content is expected: " + nodeRef.getId());
|
throw new InvalidArgumentException("Node of type cm:content or a subtype is expected: " + nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
lockInfo = validateLockInformation(lockInfo);
|
lockInfo = validateLockInformation(lockInfo);
|
||||||
@@ -3002,6 +3003,10 @@ public class NodesImpl implements Nodes
|
|||||||
{
|
{
|
||||||
throw new PermissionDeniedException("Current user doesn't have permission to unlock node " + nodeId);
|
throw new PermissionDeniedException("Current user doesn't have permission to unlock node " + nodeId);
|
||||||
}
|
}
|
||||||
|
if (!lockService.isLocked(nodeRef))
|
||||||
|
{
|
||||||
|
throw new IntegrityException("Can't unlock node " + nodeId + " because it isn't locked", null);
|
||||||
|
}
|
||||||
|
|
||||||
lockService.unlock(nodeRef);
|
lockService.unlock(nodeRef);
|
||||||
return getFolderOrDocument(nodeId, parameters);
|
return getFolderOrDocument(nodeId, parameters);
|
||||||
|
@@ -3806,7 +3806,7 @@ public class NodeApiTest extends AbstractSingleNetworkSiteTest
|
|||||||
|
|
||||||
setRequestContext(user1);
|
setRequestContext(user1);
|
||||||
//Unlock on a not locked node
|
//Unlock on a not locked node
|
||||||
post(getNodeOperationUrl(folderId, "unlock"), null, null, 403);
|
post(getNodeOperationUrl(folderId, "unlock"), null, null, 422);
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
setRequestContext(user1); // all locks were made by user1
|
setRequestContext(user1); // all locks were made by user1
|
||||||
|
Reference in New Issue
Block a user