xquerymarklogicmarklogic-9marklogic-10

How to add permissions on existing temporal document for the role in Marklogic?


The MarkLogic database with temporal functionality contains data with permissions assigned to specific roles. However, we now need to grant read access to a particular role for temporal documents. I have attempted to utilize a MarkLogic function to enable this read permission.

 xdmp:document-add-permissions(
                           "/entities/abc.xml",
                           (xdmp:permission("read-user", "read"))
                           ) 

But getting the below error:

1.0-ml] SEC-TEMPORALDOC: xdmp:document-add-permissions("/entities/abc.xml", <sec:permission xmlns:sec="http://marklogic.com/xdmp/security"> sec:capability...</sec:capability>...</sec:permission>) -- Cannot perform non-temporal operation on document in temporal collection

Kindly suggest how can I provide the new permissions on temporal documents.


Solution

  • As the error message states, you cannot perform non-temporal operations on temporal documents.

    Use the temporal function temporal:document-insert() and set the appropriate options with the permissions you want to set.