Loading TOC...

sec.userSetDefaultCollections

sec.userSetDefaultCollections(
   user-name as String,
   collections as String[]
) as null

Summary

Sets the default collections of a user with name $user-name to $collections.

Parameters
user-name The name of a user.
collections A sequence of collections.

Required Privileges

http://marklogic.com/xdmp/privileges/user-set-default-collections

Usage Notes

If a user with name $user-name is not found, an error is raised.

This function must be executed against the security database.

Example


// execute this against the security database

declareUpdate(); 
const sec = require('/MarkLogic/security.xqy');

sec.userSetDefaultCollections("Jim", 
    ["http://marklogic.com/jim_modules", 
     "http://marklogic.com/jim_docs"])

// Sets the default collections for the user, "Jim," to "http://marklogic.com/jim_modules"
   and "http://marklogic.com/jim_docs". Any other previously set collections are removed.
  

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