marklogicmarklogic-9

Problem in locking a document using xdmp:lock-acquire() function


We have tried all the options for the lock method, the document is locked, but still, another user can able to update the document even though the lock is not yet released.

xdmp:lock-acquire("/inventory/hassan", "exclusive", "0", "This lock is acquiuired by admin user", 60)

We have another user called "shiv" with the "admin" role assigned to it, still, "shiv" user can execute the below function and modify the document even though the lock is not yet released.

xdmp:node-replace(doc("/inventory/hassan")//location, <location>ABC</location>)

We are using MarkLogic 10.0-.2.1

Please help me to find out what is wrong going on here.


Solution

  • It seems that if you are using a user with admin it is bypassing the lock.

    When I lock a document with one user, and then attempt to modify it with a different unprivileged, user I get the following:

    [1.0-ml] XDMP-LOCKED: xdmp:node-replace(fn:doc("/test.xml")/doc/location, <location>ABC</location>) -- Document or Directory is locked
    

    However, after giving that user the admin role, it executes successfully and updates the document.