
sec.userSetDefaultCollections( user-name as String, collections as String[] ) as null
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. | 
http://marklogic.com/xdmp/privileges/user-set-default-collections
  If a user with name $user-name is not found, an error is raised.
This function must be executed against the security database.
// 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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.