when using xpath on a managed (dls:document-insert-and-manage(...) ) document, I would like to use
xpath expressions on this documents to retrieve only the actual document especially for other users.
With xpath I get either all versions of the document or no document.
I tried setting permissions on the document.
Restricting the URI is just for create.
Protecting the path does not help as the xpath is the same for all versions.
Is there a possibility to restrict this for some user to only get the latest Version?
We are using Marklogic 9.0.8
Example:
Setting a document with
xquery version "1.0-ml";
import module namespace dls = "http://marklogic.com/xdmp/dls" at "/MarkLogic/dls.xqy";
declare variable $uri :="/smtextdocuments/9114.xml";
declare variable $document := document {
<envelope>
<instance>
<smtextdocuments>
<uri>/smtextdocuments/9114.xml</uri><id>9114</id>
<documentcontent>MyText</documentcontent>
</smtextdocuments>
</instance>
</envelope>
};
let $d := dls:document-insert-and-manage($uri,fn:true(), $document,
"Manage textdocuments",
(
xdmp:permission("dls-user", "read"),
xdmp:permission("dls-internal", "read"),
xdmp:permission("dls-internal", "update")),
()
)
return $d
leads to either 2 or none elements when retrieving documents, depending on the permissions of the actual user
xquery version "1.0-ml";
<queryresult>
<byxPath>{
for $i in //smtextdocuments[id=9114]
return (<uri>{fn:base-uri($i)}</uri>,$i)
}
</byxPath>
</queryresult>