I ran into this in the following scenario, in Automation:
- In the event handler for "Empty Document Created"
- Copy the schema from another document (Document.CopySchema)
- This schema contains a field of type Document, with a valid document ID inside
- However the user creating the document doesn't have read access to the referenced document
Nuxeo throws "Caused by: org.nuxeo.ecm.core.api.validation.DocumentValidationException: Constraint violation thrown: '"default:aa6ce7d..." is not a valid document id.'" This is technically wrong, the document ID is valid. It's difficult to troubleshoot because it's not a permission error and led me to try troubleshooting the ID itself (e.g. I tried adding the prefix "default:" to see if that's why the validation failed).
The improvement: when validating a document ID, if the user doesn't have access to the document, return a permission error instead.