Skip to main content

Securing MarkLogic Server

Example—Using Permissions

It is important to consider document permissions when you load content into a database, whether you load data using the built-in functions (for example, xdmp:document-load() or xdmp:document-insert()), WebDAV (for example, dragging and dropping files into a WebDAV folder), the REST API, the Java API, or a custom program. In each case, setting permissions is necessary, whether explicitly or by taking advantage of default permissions. This example shows several ways of setting permissions on documents.

Suppose that Ron, of the engineering role, is given the task to create a document to describe new features that will be added to the next version of the widget. Once the document is created, other users with the engineering role contribute to the document and add the features they are working on. Ian, of the engineering-manager role, decides that users of the engineering role should only be allowed to read and add to the document. This enables Ian to control the process of removing or changing features in the document. To implement this security model, the document should be created with read and insert permissions for the engineering role and read and update permissions for the engineering-manager role.

This section describes the two ways to apply permissions to documents at creation time.