Search.../

unassignRole( )

Unassigns a role from group members.

Description


Note: This function is only relevant for site admins, and group members with group admin permissions.

The unassignRole() function returns a Promise that resolves to the unassigned role after it has successfully been unassigned. This function only applies to admin roles. Using this function with member roles returns an error.

Syntax

function unassignRole(identifiers: Identifiers, role: string, [options: Options]): Promise<Role>

unassignRole Parameters

NAME
TYPE
DESCRIPTION
identifiers
Identifiers

Group ID and member IDs.

role
string

Group member role to unassign.

  • "ADMIN": Group admin.
options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<Role>
NAME
TYPE
DESCRIPTION
role
string

Group member role. One of:

  • "MEMBER": Group member.
  • "ADMIN": Group admin.

Was this helpful?

Unassign a role to a group member

Copy Code
1import { roles } from "wix-groups-backend";
2
3// Sample identifiers value:
4// {
5// memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'],
6// groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.'
7// }
8//
9// Sample role value:
10// 'ADMIN'
11//
12// Sample options value:
13// {
14// suppressAuth: true
15// }
16
17export function unassignRole(identifiers, role, options) {
18 return roles.unassignRole(identifiers, role, options)
19 .then((response) => {
20 console.log(response);
21 })
22 .catch((error) => {
23 console.error(error);
24 });
25}
26
27/* Promise resolves to:
28 * role: "MEMBER"
29 */