Skip to content

Groups ^v2.7.0 ​

Creates, finds and deletes security groups.

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

Constructor ​

Reached through the userSecurity.groups property. It can't be created directly.

Methods ​

create create(name) Group ​

Creates a security group and returns it as a Group. The name must be unique.

ParameterTypeDescription
namestringThe new group's name.

get get(name) Group | null ​

Returns a Group by name, or null when there's no such group.

ParameterTypeDescription
namestringThe group's name.

list list() object ​

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

delete delete(name) boolean ​

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

ParameterTypeDescription
namestringThe 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.");
  • Group: the group these methods return.