remove_user_from_group()

Removes a user from a group. Deletes the matching row from the database table bgrel.

To remove a user from all groups, prefer remove_user_from_all_groups() — it is more efficient.

1. Signature

  • Sync

  • Async

ecm.security.remove_user_from_group(user_guid: str, group_guid: str) -> None
ecm.security.remove_user_from_all_groups(user_guid: str) -> None
await ecm.security.remove_user_from_group(user_guid: str, group_guid: str) -> None
await ecm.security.remove_user_from_all_groups(user_guid: str) -> None

2. Parameters

Parameter Default Description

user_guid

GUID of the user.

group_guid

GUID of the group (only remove_user_from_group).

3. Return value

None.

4. Errors

  • ECMException (or subclass) on server failures.

5. Examples

5.1. Remove a single membership

  • Sync

  • Async

user = ecm.security.user("john")
group = ecm.security.group("AUDITORS")
assert user and group
ecm.security.remove_user_from_group(user.guid, group.guid)
user = await ecm.security.user("john")
group = await ecm.security.group("AUDITORS")
assert user and group
await ecm.security.remove_user_from_group(user.guid, group.guid)

5.2. Remove a user from all groups

ecm.security.remove_user_from_all_groups(user.guid)

6. See also