usergroup.create

Description

object usergroup.create(object/array **userGroups**)

This method allows to create new user groups.

Parameters

(object/array) User groups to create.

Additionally to the standard user group properties, the method accepts the following parameters.

ParameterTypeDescription
rightsobject/arrayPermissions to assign to the group
tag_filtersarrayTag based permissions to assign to the group
useridsstring/arrayIDs of users to add to the user group.

Return values

(object) Returns an object containing the IDs of the created user groups under the usrgrpids property. The order of the returned IDs matches the order of the passed user groups.

Examples

Creating a user group

Create a user group, which denies access to host group “2”, and add a user to it.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "usergroup.create",
  4. "params": {
  5. "name": "Operation managers",
  6. "rights": {
  7. "permission": 0,
  8. "id": "2"
  9. },
  10. "userids": "12"
  11. },
  12. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  13. "id": 1
  14. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "usrgrpids": [
  5. "20"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

Source

CUserGroup::create() in ui/include/classes/api/services/CUserGroup.php.