---
url: /process-functions/userSecurity-groups.md
description: Creates, finds and deletes security groups.
---

# &#x20;Groups&#x20;

Creates, finds and deletes security groups.

```js
const group = userSecurity.groups.get("Admin");
console.log(group.getName());
```

## Constructor

Reached through the [userSecurity.groups](/process-functions/userSecurity#properties) property. It can't be created directly.

## Methods

### create `create(name)`  {#create}

Creates a security group and returns it as a [Group](/process-functions/userSecurity-group). The name must be unique.

| Parameter | Type | Description |
|---|---|---|
| `name` | `string` | The new group's name. |

### get `get(name)`  {#get}

Returns a [Group](/process-functions/userSecurity-group) by name, or `null` when there's no such group.

| Parameter | Type | Description |
|---|---|---|
| `name` | `string` | The group's name. |

### list `list()`  {#list}

Returns every security group, with each group's id and name.

### delete `delete(name)`  {#delete}

Deletes a security group. Returns `true` when it was deleted, or `false` when there's no such group.

| Parameter | Type | Description |
|---|---|---|
| `name` | `string` | The group's name. |

## Examples

```js
// Create a new security group
const newGroup = userSecurity.groups.create("Example Group");
console.log(newGroup.getName());

// Retrieve a security group
const group = userSecurity.groups.get("Admin");
console.log(group.getName());

// List all security groups
const groups = userSecurity.groups.list();
console.log(groups);

// Delete a security group
const deleted = userSecurity.groups.delete("Example Group");
console.log(deleted ? "Group deleted successfully." : "Group deletion failed.");
```

## Related

* [Group](/process-functions/userSecurity-group): the group these methods return.
