removeRole( )
Removes a role from a member.
Description
The removeRole()
function returns a Promise that resolves when the
specified role is removed from the specified member.
Note: This function replaces the deprecated
wix-users-backend.roles.removeRole()
. The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.
roleId
must be an ID from an existing role in your site.
The role ID can be copied from the Role Settings page.
You can access the Role Settings page from your site's
Member Permissions
page.
Note: This function may take a few seconds until the role is assigned and the promise is resolved.
Syntax
function removeRole(roleId: string, memberId: string, [options: AuthOptions]): Promise<void>
removeRole Parameters
NAME
TYPE
DESCRIPTION
ID of the role to remove from the member.
ID of the member to remove the role from.
Authorization options.
Returns
Fulfilled - When the role is removed from the member. Rejected - Error message.
Return Type:
Was this helpful?
Remove a role from a member
1import { authorization } from 'wix-members-backend';23export function myRemoveRoleFunction() {4 const roleId = "b62310c1-1c81-4ca9-9fe9-42b48f6e164e";5 const memberId = "72751428-2743-4bda-acf5-4218a4279cd3";6 const options = {7 suppressAuth: false8 };910 return authorization.removeRole(roleId, memberId, options)11 .then(() => {12 console.log("Role removed from member");13 })14 .catch((error) => {15 console.error(error);16 });17}