view:set-permissions( $schema-name as xs:string, $view-name as xs:string, $permissions as item()* ) as empty-sequence()
This function sets the permissions for the named view in the named schema specification. Any existing permissions for the view and removed.
xquery version "1.0-ml"; import module namespace view = "http://marklogic.com/xdmp/view" at "/MarkLogic/views.xqy"; view:set-permissions("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. :)