Это перевод страницы документации с английского языка. Помогите нам сделать его лучше.

Sidebar

Become a monitoring expert!
Sign up for Zabbix training

role.update

Description

object role.update(object/array roles)

This method allows to update existing roles.

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) Role properties to be updated.

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

Additionally to the standard role properties the method accepts the following parameters.

Parameter Type Description
rules array Access rules to replace the current access rules assigned to the role.

Return values

(object) Returns an object containing the IDs of the updated roles under the roleids property.

Examples

Disabling ability to execute scripts

Update role with ID "5", disable ability to execute scripts.

Request:

{
           "jsonrpc": "2.0",
           "method": "role.update",
           "params": [
               {
                   "roleid": "5",
                   "rules": {
                       "actions": [
                           {
                               "name": "execute_scripts",
                               "status": "0"
                           }
                       ]
                   }
               }
           ],
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "roleids": [
                   "5"
               ]
           },
           "id": 1
       }

Limiting access to API

Update role with ID "5", deny to call any "create", "update" or "delete" methods.

Request:

{
           "jsonrpc": "2.0",
           "method": "role.update",
           "params": [
               {
                   "roleid": "5",
                   "rules": {
                       "api.access": "1",
                       "api.mode": "0",
                       "api": ["*.create", "*.update", "*.delete"]
                   }
               }
           ],
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "roleids": [
                   "5"
               ]
           },
           "id": 1
       }

Source

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