Class: Users

Users(opts)

The Users class allows to work with users on a Nuxeo Platform instance.

Cannot directly be instantiated

Constructor

new Users(opts)

Creates a Users object.

Parameters:
Name Type Description
opts object

The configuration options.

Properties
Name Type Description
nuxeo string

The Nuxeo object linked to this Users object.

Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
 baseURL: 'http://localhost:8080/nuxeo',
 auth: {
   method: 'basic',
   username: 'Administrator',
   password: 'Administrator',
 }
});
nuxeo.users()
  .fetch('Administrator')
  .then(function(res) => {
    // res.id === 'Administrator'
    // res.properties.username === 'Administrator'
  })
  .catch(function(error) {
    throw new Error(error);
  });

Methods

create(user, optsopt) → {Promise}

Creates an user.

Parameters:
Name Type Attributes Description
user object

The user to be created.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the created User.

Type
Promise

delete(username, optsopt) → {Promise}

Deletes an user given an username.

Parameters:
Name Type Attributes Description
username string

The username.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the result of the DELETE request.

Type
Promise

fetch(username, optsopt) → {Promise}

Fetches an user given an username.

Parameters:
Name Type Attributes Description
username string

The username.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the User.

Type
Promise

update(user, optsopt) → {Promise}

Updates an user. Assumes that the user object has an id field.

Parameters:
Name Type Attributes Description
user object

The user to be updated.

opts object <optional>

Options overriding the ones from this object.

Source:
Returns:

A Promise object resolved with the updated User.

Type
Promise