Documentation

Sidebar

Zabbix Summit 2022
View presentations

usergroup.update

Description

object usergroup.update(object/array userGroups)

This method allows to update existing user groups.

This method is only available to Super admin user type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object/array) User group properties to be updated.

The usrgrpid property must be defined for each user group, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

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

Parameter Type Description
hostgroup_rights object/array Host group permissions to replace the current permissions assigned to the user group.
templategroup_rights object/array Template group permissions to replace the current permissions assigned to the user group.
tag_filters array Tag-based permissions to assign to the user group.
users object/array Users to add to the user group.

The user must have the userid property defined.
rights
(deprecated)
object/array This parameter is deprecated, please use hostgroup_rights or templategroup_rights instead.
Permissions to assign to the user group.

Return values

(object) Returns an object containing the IDs of the updated user groups under the usrgrpids property.

Examples

Enabling a user group and updating permissions

Enable a user group and provide read-write access for it to host groups "2" and "4".

Request:

{
           "jsonrpc": "2.0",
           "method": "usergroup.update",
           "params": {
               "usrgrpid": "17",
               "users_status": "0",
               "hostgroup_rights": [
                   {
                       "id": "2",
                       "permission": 3
                   },
                   {
                       "id": "4",
                       "permission": 3
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "usrgrpids": [
                   "17"
               ]
           },
           "id": 1
       }

See also

Source

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