From 3461cfe2191ac327cf221a44a438b9cc8b8f740f Mon Sep 17 00:00:00 2001 From: Ancuta Morarasu Date: Wed, 11 May 2016 12:03:25 +0000 Subject: [PATCH] Merged HEAD (5.2) to 5.2.N (5.2.1) 126535 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 123185 jvonka: RA-706, ACE-5113: Revese merge 123162 & 123163 (needs more thought, re: impact on existing tests etc) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126879 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/public-rest-context.xml | 1 - .../org/alfresco/rest/api/impl/NodesImpl.java | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/alfresco/public-rest-context.xml b/config/alfresco/public-rest-context.xml index c4ccbdc933..087344e713 100644 --- a/config/alfresco/public-rest-context.xml +++ b/config/alfresco/public-rest-context.xml @@ -146,7 +146,6 @@ - diff --git a/source/java/org/alfresco/rest/api/impl/NodesImpl.java b/source/java/org/alfresco/rest/api/impl/NodesImpl.java index 29e77875b8..0d089d8365 100644 --- a/source/java/org/alfresco/rest/api/impl/NodesImpl.java +++ b/source/java/org/alfresco/rest/api/impl/NodesImpl.java @@ -1273,6 +1273,8 @@ public class NodesImpl implements Nodes } props.put(ContentModel.PROP_NAME, nodeName); + validatePropValues(props); + QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(nodeName)); try { @@ -1299,6 +1301,20 @@ public class NodesImpl implements Nodes } } + // special cases: additional validation of property values (if not done by underlying foundation services) + private void validatePropValues(Map props) + { + String newOwner = (String)props.get(ContentModel.PROP_OWNER); + if (newOwner != null) + { + // validate that user exists + if (! personService.personExists(newOwner)) + { + throw new InvalidArgumentException("Unknown owner: "+newOwner); + } + } + } + @Override public Node updateNode(String nodeId, Node nodeInfo, Parameters parameters) { @@ -1430,6 +1446,8 @@ public class NodesImpl implements Nodes if (props.size() > 0) { + validatePropValues(props); + try { // update node properties - note: null will unset the specified property