Loading TOC...

view.setPermissions

view.setPermissions(
   $schema-name as String,
   $view-name as String,
   $permissions as Sequence
) as null

Summary

This function sets the permissions for the named view in the named schema specification. Any existing permissions for the view and removed.

Parameters
$schema-name The name of the schema specification containing the view.
$view-name The name of the view for which the permissions are to be set.
$permissions The permissions for the view. When run in an XQuery context, the permissions are a sequence of XML elements (sec:permission). When importing this module into a Server-Side JavaScript context, the permissions are an array of Objects.

Example

const view = require('/MarkLogic/views');
  
view.setPermissions('main', 'songs', (xdmp.permission('app-user', 'read'),
                                         xdmp.permission('app-user', 'update')));

// Enables only users with the app-user role to read and update the 'songs' view
// in the 'main' schema.
   

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.