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.

ParameterTypeDescription
hostgroup_rightsobject/arrayHost group permissions to replace the current permissions assigned to the user group.
templategroup_rightsobject/arrayTemplate group permissions to replace the current permissions assigned to the user group.
tag_filtersarrayTag-based permissions to assign to the user group.
usersobject/arrayUsers to add to the user group.

The user must have the userid property defined.
rights
(deprecated)
object/arrayThis 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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "usergroup.update",
  4. "params": {
  5. "usrgrpid": "17",
  6. "users_status": "0",
  7. "hostgroup_rights": [
  8. {
  9. "id": "2",
  10. "permission": 3
  11. },
  12. {
  13. "id": "4",
  14. "permission": 3
  15. }
  16. ]
  17. },
  18. "id": 1
  19. }

Response:

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

See also

Source

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