# usergroup.massadd

### Description

`object usergroup.massadd(object parameters)`

This method allows to simultaneously add permissions and users to
multiple user groups.

### Parameters

`(object)` Parameters containing the IDs of the user groups to update
and the permissions and users to add.

The method accepts the following parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|**usrgrpids**<br>(required)|string/array|IDs of user groups to update.|
|rights|object/array|Permissions to assign to the user groups.|
|userids|string/array|IDs of the users to add to the user groups.|

### Return values

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

### Examples

#### Denying access to host group

Deny two user groups access to host group "2".

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "usergroup.massadd",
    "params": {
        "usrgrpids": [
            "17",
            "19"
        ],
        "rights": {
            "permission": 0,
            "id": "2"
        }
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "usrgrpids": [
            "17",
            "19"
        ]
    },
    "id": 1
}
```

### See also

-   [Permission](definitions#permission)
-   [usergroup.massupdate](massupdate)
-   [usergroup.update](update)

### Source

CUserGroup::massAdd() in *frontends/php/api/classes/CUserGroup.php*.
