1

I have a directory in content database with some 200 XML documents and I want to add an additional permission to all the documents under this directory.

I tried using xdmp:document-add-permissions as xdmp:document-add-permissions("/dir/",(xdmp:permission("ml-reader", "read", "object")) but this does not seem to be working and giving below error message.

XDMP-DOCNOTFOUND: xdmp:document-add-permissions("/dir/", (json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), json:object(<json:object xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" .../>), ...)) -- Document not found

Could someone please guide me on how to use this function to add permissions for directory?

1 Answer 1

0

Are you sure that you actually have a directory in your database?

Just because your document URIs happen to have paths, does not mean that directories exist.

Unless you have the database configured to automatically create directories (disabled by default), which is usually only needed for WEBDAV, then you won't have a directory.

You can manually create a directory by calling:

xdmp:directory-create( $uri )

https://help.marklogic.com/knowledgebase/article/View/73/0/what-is-a-directory-in-marklogic

Sign up to request clarification or add additional context in comments.

1 Comment

Sorry, I think it is just the path of the document in my case. So ,do I need to fetch all the documents and apply xdmp:document-add-permissions function in a loop?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.