unassignRole( )


Unassigns a role from group members.

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.

Method Declaration
Copy
function unassignRole(
  identifiers: Identifiers,
  role: string,
  options: Options,
): Promise<Role>;
Method Parameters
identifiersIdentifiersRequired

Group ID and member IDs.


rolestringRequired

Group member role to unassign.

  • "ADMIN": Group admin.

optionsOptions

Authorization options.

Returns
Return Type:Promise<Role>
Unassign a role to a group member
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { roles } from "wix-groups-backend"; // Sample identifiers value: // { // memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'], // groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.' // } // // Sample role value: // 'ADMIN' // // Sample options value: // { // suppressAuth: true // } export const unassignRole = webMethod( Permissions.Anyone, async (identifiers, role, options) => { try { const response = await roles.unassignRole(identifiers, role, options); console.log(response); } catch (error) { console.error(error); } }, ); /* Promise resolves to: * role: "MEMBER" */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?