object usergroup.create(object/array userGroups)
This method allows to create new 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.
(object/array)
User groups to create.
Additionally to the standard user group properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
hostgroup_rights | object/array | Host group permissions to assign to the user group. |
templategroup_rights | object/array | Template group permissions to assign 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. |
(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.
Create a user group Operation managers with denied access to host group "2", and add a user to it.
Request:
{
"jsonrpc": "2.0",
"method": "usergroup.create",
"params": {
"name": "Operation managers",
"hostgroup_rights": {
"id": "2",
"permission": 0
},
"users": [
{
"userid": "12"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
CUserGroup::create() in ui/include/classes/api/services/CUserGroup.php.