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 30715dce2b..4846205c93 100644 --- a/source/java/org/alfresco/rest/api/impl/NodesImpl.java +++ b/source/java/org/alfresco/rest/api/impl/NodesImpl.java @@ -1266,6 +1266,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 { @@ -1292,6 +1294,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) { @@ -1423,6 +1439,8 @@ public class NodesImpl implements Nodes if (props.size() > 0) { + validatePropValues(props); + try { // update node properties - note: null will unset the specified property