Constructor
new Groups(opts)
Creates a Groups object.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
opts |
object | The configuration options. Properties
|
- Source:
Example
var Nuxeo = require('nuxeo')
var nuxeo = new Nuxeo({
baseURL: 'http://localhost:8080/nuxeo',
auth: {
method: 'basic',
username: 'Administrator',
password: 'Administrator'
}
});
nuxeo.groups()
.fetch('administrators')
.then(function(res) {
// res.id === '00000000-0000-0000-0000-000000000000' || res.id === 'administrators' (previous behavior)
// res.properties.groupname === 'administrators'
// res.properties.grouplabel === 'Administrators group'
})
.catch(function(error) {
throw new Error(error));
});
Methods
create(user, optsopt) → {Promise}
Creates a group.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
user |
object | The group to be created. |
|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A Promise object resolved with the created Group.
- Type
- Promise
delete(idOrGroupname, optsopt) → {Promise}
Deletes a group given an id or a groupname.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
idOrGroupname |
string | The id or groupname. |
|
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(idOrGroupname, optsopt) → {Promise}
Fetches a group given an id or a groupname.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
idOrGroupname |
string | The id or groupname. |
|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A Promise object resolved with the Group.
- Type
- Promise
update(group, optsopt) → {Promise}
Updates a group. Assumes that the group object has an groupname field.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
group |
object | The group to be updated. |
|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A Promise object resolved with the updated Group.
- Type
- Promise