foundry_dev_tools.helpers.multipass package#

Multipass helper classes for Foundry DevTools.

class foundry_dev_tools.helpers.multipass.Group[source]#

Bases: Principal

Not intended to be initialized directly. Use Group.from_id() or Group.create_group() instead.

name: str#
__init__(*args, **kwargs)[source]#

Not intended to be initialized directly. Use Group.from_id() or Group.create_group() instead.

Return type:

None

classmethod from_id(context, group_id)[source]#

Returns group from id.

Parameters:
  • context (FoundryContext) – the foundry context for the group

  • group_id (api_types.GroupId) – the id of the group on foundry

Return type:

Self

classmethod create(context, name, organization_rids, /, *, description=None)[source]#

Create a new multipass group.

Parameters:
  • context (FoundryContext) – the foundry context for the group

  • name (str) – the name the group should receive on creation

  • organization_rids (set[api_types.OrganizationRid]) – a set of organization identifiers the group will belong to

  • description (str | None) – an optional group description

Return type:

Self

update(group_description)[source]#

Update the multipass group.

Parameters:

group_description (str) – The updated description to apply to the group

Return type:

Self

rename(new_group_name)[source]#

Rename group.

Parameters:

new_group_name (str) – the name the group will be renamed to

Returns:

the dict contains an entry for the renamed group and an alias group which still holds to the old name to support compatibility for projects referring to the old name

Return type:

dict[str, api_types.Group]

delete()[source]#

Deletes multipass group.

Return type:

Self

update_managers(deleted_manager_managers=None, deleted_member_managers=None, new_manager_managers=None, new_member_managers=None)[source]#

Update group managers by adding new member managers or manager managers or removing member managers or manager managers.

Parameters:
  • deleted_manager_managers (set[api_types.PrincipalId] | None) – A set of principal identifiers for which to withdraw the role as manager manager

  • deleted_member_managers (set[api_types.PrincipalId] | None) – A set of principal identifiers for which to withdraw the role as member manager

  • new_manager_managers (set[api_types.PrincipalId] | None) – A set of principal identifiers that should be assigned the role as manager manager

  • new_member_managers (set[api_types.PrincipalId] | None) – A set of principal identifiers that should be assigned the role as member manager

Return type:

Self

get_manager_managers()[source]#

Returns the principals of the group who can add and remove members and who can grant the right to manage group permissions to others.

Return type:

list[api_types.User | api_types.Group]

add_manager_managers(manager_managers)[source]#

Assign principals as manager managers to the group.

Parameters:

manager_managers (set[api_types.PrincipalId]) – A set of principal identifiers that should be assigned the role as manager manager

Return type:

Self

remove_manager_managers(manager_managers)[source]#

Withdraw the provided principals from the manager managers for the group.

Parameters:

manager_managers (set[api_types.PrincipalId]) – A set of principal identifiers that should be withdrawn from the manager managers.

Return type:

Self

get_member_managers()[source]#

Returns the principals of the group who can add and remove members.

Return type:

list[api_types.User | api_types.Group]

add_member_manager(member_managers)[source]#

Assign principals as member managers to the group.

Parameters:

member_managers (set[api_types.PrincipalId]) – A set of principal identifiers that should be assigned the role as member manager

Return type:

Self

remove_member_managers(member_managers)[source]#

Withdraw the provided principals from the member managers for the group.

Parameters:

member_managers (set[api_types.PrincipalId]) – A set of principal identifiers that should be withdrawn from the member managers.

Return type:

Self

add_members(principal_ids, expirations=None)[source]#

Add principals to the group.

Parameters:
  • principal_ids (set[api_types.PrincipalId]) – The identifiers of the principals to be added to the group

  • expirations (dict[api_types.GroupId, dict[api_types.PrincipalId, datetime]] | None) – Optional expiration settings that can be passed if principals should only have temporal access to the group

Return type:

Self

get_members()[source]#

Receive all immediate group members of the group.

Return type:

list[api_types.User | api_types.Group]

remove_members(principal_ids)[source]#

Remove members from the group.

Parameters:

principal_ids (set[api_types.PrincipalId]) – A set of principal identifiers which should be removed from the member list of the group

Return type:

Self

update_expiration_settings(max_expiration=None, max_duration_in_seconds=None)[source]#

Update group member expiration settings of the group.

Parameters:
  • max_expiration (datetime | None) – The time in the future on which all new membership will be automatically expired and no new membership can be requested after this time

  • max_duration_in_seconds (int | None) – When adding a new membership, it can last no longer than the specified maximum duration. Expiration of existing memberships will be adjusted accordingly. Value passed must be greater equal MINIMUM_MAX_DURATION_IN_SECONDS and defaults to DEFAULT_MAX_DURATION_IN_SECONDS if it does not meet the condition

Return type:

Self

get_expiration_settings()[source]#

Returns group member expiration settings for the group.

Return type:

api_types.GroupMemberExpirationSettings

reset_expiration_settings()[source]#

Reset the group member expiration settings for the group.

Return type:

Self

sync()[source]#

Fetches the attributes again.

Return type:

Self

class foundry_dev_tools.helpers.multipass.Principal[source]#

Bases: ABC

Not intended to be initialized directly. Use Principal.from_id() instead.

id: api_types.PrincipalId#
attributes: dict[str, list[str]]#
__init__(*args, **kwargs)[source]#

Not intended to be initialized directly. Use Principal.from_id() instead.

Return type:

None

classmethod from_id(context, principal_id)[source]#

Returns group from id.

Parameters:
  • context (FoundryContext) – the foundry context for the group

  • principal_id (api_types.PrincipalId) – the id of the principal on foundry

Return type:

Self

class foundry_dev_tools.helpers.multipass.User[source]#

Bases: Principal

Not intended to be initialized directly. Use User.me() instead.

username: str#
__init__(*args, **kwargs)[source]#

Not intended to be initialized directly. Use User.me() instead.

Return type:

None

classmethod me(context)[source]#

Returns the user.

Parameters:

context (FoundryContext) – the foundry context for the user

Return type:

Self

Submodules#