Madoantony
Madoantony

Reputation: 195

Add permissions for existing directory in MarkLogic

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?

Upvotes: 1

Views: 133

Answers (1)

Mads Hansen
Mads Hansen

Reputation: 66714

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

Upvotes: 0

Related Questions