Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-24359

Document.Lock called twice should not fail

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 9.10-HF01
    • Fix Version/s: 11.1, 2021.0
    • Component/s: Rest API
    • Tags:
    • Upgrade notes:
      Hide

      The behavior of AbstractSession.setLock has been modified to meet the requirement "Document.Lock called twice should not fail".

      Now if you try to lock a document locked by you, you will only get your original lock.

      Show
      The behavior of AbstractSession.setLock has been modified to meet the requirement "Document.Lock called twice should not fail". Now if you try to lock a document locked by you, you will only get your original lock.

      Description

      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
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: