sym.sdk.integrations.google

Helpers for interacting with Google APIs within the Sym SDK.

Functions

is_user_in_group(user, *, group_email)

Checks if the provided user is a member of the specified Google Group.

list_groups([domain])

Returns a list of all groups for the Google Workspace account or given domain.

users_in_group(group_email, *[, ...])

Returns a list of users in the specified Google Group.

sym.sdk.integrations.google.is_user_in_group(user: sym.sdk.user.User, *, group_email: str) bool

Checks if the provided user is a member of the specified Google Group. Membership may either be direct or indirect.

Prerequisites:

  • To call this method, your gcp_connector module must have enable_google_group_management = true.

Parameters
  • user – The User to check

  • group_email – The email identifier of the Google Group

Returns

True if the user is part of the Google Group

sym.sdk.integrations.google.list_groups(domain: Optional[str] = None) List[dict]

Returns a list of all groups for the Google Workspace account or given domain.

Parameters

domain – An optional domain to only get groups from the given domain (e.g. a secondary domain). If not provided, this method will retrieve all groups associated with all domains for this Google Workspace account.

Returns

A list of dictionaries, with each dictionary representing a Google Group. See Google’s docs for the dictionary structure: https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups#Group

sym.sdk.integrations.google.users_in_group(group_email: str, *, include_indirect_members: bool = True) List[sym.sdk.user.User]

Returns a list of users in the specified Google Group.

Note that this method only returns emails corresponding to User accounts. If the specified Google Group contains nested Google Groups, those group emails will not be included in the returned list.

Parameters
  • group_email – The email identifier of the Google Group.

  • include_indirect_members – Whether to include users who are indirect members of the given group. Defaults to True.

Returns

A List of User objects