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 { Permissions, webMethod } from 'wix-web-module';2import { roles } from 'wix-groups-backend';34// Sample identifiers value:5// {6// memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'],7// groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.'8// }9//10// Sample role value:11// 'ADMIN'12//13// Sample options value:14// {15// suppressAuth: true16// }171819export const unassignRole = webMethod(Permissions.Anyone, async (identifiers, role, options) => {20 try {21 const response = await roles.unassignRole(identifiers, role, options);22 console.log(response);23 } catch (error) {24 console.error(error);25 }26});2728/* Promise resolves to:29 * role: "MEMBER"30 */