Currently, when calling Document.Lock on the same document using the same username, the 1st call will succeed and others will fail on a 500 error.
A more accurate behavior would be: if the document is already locked, returns its existing lock status (there is no re-locking) and returns a 200 HTTP status. If the lock exists and is owned by another user, then a 409 (Conflict) error should be returned.
Logs from the Python client test file:
Calling 'http://192.168.0.100:8080/nuxeo/site/automation/Document.Lock' with headers={'Content-Type': 'application/json', 'X-NXproperties': '*', 'X-NXDocumentProperties': '*', 'X-NXRepository': 'default', 'X-Application-Name': 'Python client', 'X-Client-Version': '2.0.0', 'Accept': 'application/json+nxentity, */*'}, params={} and cookies=<RequestsCookieJar[]> Request "POST /nuxeo/site/automation/Document.Lock HTTP/1.1" 200 None Response '{"entity-type":"document","repository":"default","uid":"7a36b4b8-4dd7-4d0f-8078-3c54f38d2366","path":"/foo.txt.1518001142455","type":"File","state":"project","parentRef":"5ede3de5-a2f0-48b7-85d8-fe1ea60d4165","isCheckedOut":true,"isVersion":false,"isProxy":false,"changeToken":"1-0","title":"Foo","lastModified":"2018-02-07T10:59:02.458Z","properties":{"uid:uid":null,"uid:major_version":0,"uid:minor_version":0,"file:content":null,"common:icon-expanded":null,"common:icon":"/icons/file.gif","files:files":[],"dc:description":"This is me.","dc:language":null,"dc:coverage":null,"dc:valid":null,"dc:creator":"Administrator","dc:modified":"2018-02-07T10:59:02.458Z","dc:lastContributor":"Administrator","dc:rights":null,"dc:expired":null,"dc:format":null,"dc:created":"2018-02-07T10:59:02.458Z","dc:title":"Foo","dc:issued":null,"dc:nature":null,"dc:subjects":[],"dc:contributors":["Administrator"],"dc:source":null,"dc:publisher":null,"relatedtext:relatedtextresources":[],"nxtag:tags":[]},"facets":["Versionable","NXTag","Publishable","Commentable","HasRelatedText","Downloadable"]}' with cookies <RequestsCookieJar[]> Calling 'http://192.168.0.100:8080/nuxeo/site/automation/Document.Lock' with headers={'Content-Type': 'application/json', 'X-NXproperties': '*', 'X-NXDocumentProperties': '*', 'X-NXRepository': 'default', 'X-Application-Name': 'Python client', 'X-Client-Version': '2.0.0', 'Accept': 'application/json+nxentity, */*'}, params={} and cookies=<RequestsCookieJar[]> Request "POST /nuxeo/site/automation/Document.Lock HTTP/1.1" 500 None Response 500 error: Failed to invoke operation: Document.Lock, Failed to invoke operation Document.Lock, Document already locked by Administrator: 7a36b4b8-4dd7-4d0f-8078-3c54f38d2366
- causes
-
NXJS-189 Lock Status Test fails on Nuxeo JS Client
- Resolved
-
NXP-27660 Fix TestSQLRepositoryAPI.testLocking on MongoDB
- Resolved
- is required by
-
NXDRIVE-1666 Handle lock conflicts in DirectEdit
- Resolved
-
NXPY-93 Fix test_locking()
- Resolved