Adding or modifying a user (bizzStream.addUser)
You can use bizzStream.addUser
to add or modify an existing user.
The function bizzStream.addUserV1
can be used to add or modify for V1 documents as well.
Syntax
bizzStream.addUser({options});
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
globalEmailAddress | String | Yes | E-mail address of the user that should be created or updated. The field must be valid otherwise an error is thrown. If there is already a user with the same global e-mail address, the existing user is added to the environment. If there is no user with the same global e-mail address, a new user is created and added to the environment. |
name | String | Yes, but only when adding a new user. | The name of the user in this environment. |
administrator | Boolean | Yes, but only when adding a new user. | Indicates whether the user is an administrator in the environment. |
active | Boolean | No | Indicates whether the user is active in the environment. When not set, the default value is false . |
locale | String | Yes, but only when adding a new user. | Locale of the user that will be used for time/date and numeric values. The values en (English), nl (Dutch), de (German), fr (French), sp (Spanish) and pl (Polish) are allowed. |
language | String | Yes, but only when adding a new user. | Language of the user. The values en (English), nl (Dutch), de (German), fr (French), sp (Spanish) and pl (Polish) are allowed. |
theme | String | No | Theme value, if ommited defaults to Match system settings(systemSettings ). Values dark , light , systemSettings . |
menuName | String | No | Adds the specified menu (by name) to the specified user while overriding existing menus. |
menuId | String | No | Adds the specified menu (by id) to the specified user while overriding existing menus. |
menuNames | Array | No | Adds the specified menus (by name) to the specified user while overriding existing menus. |
menuIds | Array | No | Adds the specified menus (by id) to the specified user while overriding existing menus. |
addMenuNames | Array | No | Adds the specified menus (by name) to the specified user without overriding existing menus. |
addMenuIds | Array | No | Adds the specified menus (by id) to the specified user without overriding existing menus. |
memberGroupNames | Array | No | The group name(s) will be used to attach the user to the group(s) and will be removed from other groups. You should not combine this parameter with the other member group parameters. |
memberGroupIds | Array | No | The group ids will be used to attach the user to the group(s) and will be removed from other groups. You should not combine this parameter with the other member group parameters. |
addMemberGroupNames | Array | No | The group name(s) will be used to attach the user to the group(s). You should not combine this parameter with the other member group parameters. |
addMemberGroupIds | Array | No | The group ids will be used to attach the user to the group(s). You should not combine this parameter with the other member group parameters. |
Return value
An object containing the added or modified user:
{
"_id": "XBFYvbeSAMHGJReGg",
"createdAt": "2017-02-25T09:54:34.203Z",
"username": "peter@maxedy.com",
"emails": [
{
"address": "peter@maxedy.com",
"verified": false
}
],
"profile": {
"environments": [
{
"environmentId": "maxedy_pizza",
"name": "Peter",
"language": "en",
"locale": "en",
"email": "peter@maxedy.com",
"active": true,
"administrator": true
}
],
"sendEmailUponNewReleases": false
},
"_lastModifiedByUserId": "system",
"_lastModifiedOn": "2023-02-25T09:55:07.670Z"
}
Example
The following example shows how to add the user with name "Peter"
as admin user to menuName "maxedyPizza"
with menuId "2345"
:
bizzStream.addUser({
"globalEmailAddress": "peter@maxedy.com",
"name": "Peter",
"administrator": true,
"active": true,
"locale": "en",
"language": "en",
"menuName": "maxedyPizza",
"menuId" : "2345",
"memberGroupNames": ["chiefs", "cooks"],
"memberGroupIds": ["12345", "6789"]
})