This is a translation of the original English documentation page. Help us make it better.

usergroup.create

Description

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.

Parameters

(object/array) User groups to create.

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

Parameter Type Description
rights object/array Permissions to assign to the group
tag_filters array Tag based permissions to assign to the group
users object/array Users to add to the user group.

The user must have the userid property defined.

Valori di ritorno

(object) Restituisce un oggetto contenente gli ID dei gruppi utente creati sotto la proprietà usrgrpids. L'ordine degli ID restituiti corrisponde all'ordine dei gruppi utente passati.

Esempi

Creating a user group

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

Request:

{
           "jsonrpc": "2.0",
           "method": "usergroup.create",
           "params": {
               "name": "Operation managers",
               "rights": {
                   "permission": 0,
                   "id": "2"
               },
               "users": [
                   {"userid": "12"}
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

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

Guarda anche

Fonte

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