Skip to main content

GroupsClient

Methods

__init__()

find()

Search for groups by name.

Parameters

NameTypeDescription
querystrSearch query to match against group names

Returns

TypeDescription
List[Group]List of Group instances matching the search query

get()

Get detailed information about a specific group.

Parameters

NameTypeDescription
idstrID or name of the group to retrieve

Returns

TypeDescription
GroupGroup instance with detailed information

save()

Save or update a group.

Parameters

NameTypeDescription
groupGroupThe group to save or update
save_relationsboolWhether to save group relations (members and memberships)

Returns

TypeDescription
GroupThe saved group instance

delete()

Deletes a group.

Parameters

NameTypeDescription
groupGroup or strThe group to delete or (group name or group id)

list()

List groups from Datagrok with optional filtering and inclusion of related data.

Parameters

NameTypeDescription
smart_filterOptional[str]Optional smart search filter to apply
include_personalboolWhether to include personal groups in the results
include_membersboolWhether to include group members in the results
include_membershipsboolWhether to include group memberships in the results

Returns

TypeDescription
List[Group]List of Group instances matching the criteria

add_member()

Adds a child group or user as a member of a parent group.

Parameters

NameTypeDescription
parentGroup or strThe parent group or its name.
childGroup, User, or strThe group, user, or their name to be added to the parent group.
is_adminbool, optionalWhether the child should be granted admin privileges (default is False).

Returns

TypeDescription
GroupThe updated parent group with the new member added.

get_members()

Get members of a specific group.

Parameters

NameTypeDescription
group_idstrID of the group to get members for
adminOptional[bool]If True, returns only admin members. If False, returns only non-admin members. If None, returns all members.

Returns

TypeDescription
List[Group]List of Group instances representing the members

get_memberships()

Get memberships of a specific group.

Parameters

NameTypeDescription
groupGroupThe group to get memberships for
adminOptional[bool]If True, returns only admin memberships. If False, returns only non-admin memberships. If None, returns all memberships.

Returns

TypeDescription
List[Group]List of Group instances representing the memberships

current()

Returns the group associated with the current authenticated user.

Returns

TypeDescription
GroupGroup instance representing the current user's group