Module tripleblind.team

Teams API

This module allows you to interact with the TripleBlind Router to obtain a list of teams available to the current user.

Classes

class Team

A Team object represents a group of users who can collaborate on projects.

Class variables

var all_user_rights

Rights which can be granted to a user.

Static methods

def add_member(user: str, team_id: int, rights: List[str] = None, session: Optional[Session] = None) -> dict

Add a user to a team.

Rights which can be granted are: rights= [ "create_job" "delete_asset" "download_algorithm" "download_algorithm_output" "download_dataset" "download_dataset_output" "grant_permission_algorithm" "grant_permission_dataset" "invite_user" "manage_agreement" "manage_job" "manage_user" "publish_algorithm" "publish_dataset" "remove_user" "update_asset" ]

Args

user : str
The user ID or email to add to the team.
team_id : int
The team ID.
rights : List[str], optional
The permissions to grant the user.
session : Session, optional
A connection session. If not specified the default session is used.

Returns

dict
The updated team information.
def create(name: str, owner_email: str = None, session: Optional[Session] = None) -> dict

Create a new team.

NOTE: This will only work for users which are an organization "owner".

Args

name : str
The name of the new team.
owner_email : str, optional
The email address of the team owner, defaults to the current user.
session : Session, optional
A connection session. If not specified the default session is used.

Returns

Team
The newly created team.
def get_all(allow_cached: bool = True, session: Optional[Session] = None) -> List[dict]

Retrieve a list of teams available to the current user.

Args

allow_cached : bool, optional
When True, allow usage of a previously cached list of teams. Set to False to force syncing with the server. Defaults to True.
session : Session, optional
A connection session. If not specified the default session is used.

Returns

List[dict]
A list of Teams available to the current user, e.g.: [{'id': 1, 'name': 'IniTech'}, {'id': 11, 'name': 'Second Team'}]
def get_all_org(allow_cached: bool = True, session: Optional[Session] = None) -> List[dict]

Retrieve a list of all teams for organization.

NOTE: This method is only available for users with the "owner" role.

Args

allow_cached : bool, optional
When True, allow usage of a previously cached list of teams. Set to False to force syncing with the server. Defaults to True.
session : Session, optional
A connection session. If not specified the default session is used.

Returns

List[dict]
A list of Teams available to the current user, e.g.: [{'id': 1, 'name': 'IniTech'}, {'id': 11, 'name': 'Second Team'}]
def is_valid(team_id: int) -> bool

Check if the current user is a member of the given team ID.

Args

team_id : int
The team ID to check.

Returns

bool
True if the team ID is valid, False otherwise.
def remove_member(user: str, team_id: int, session: Optional[Session] = None) -> dict

Remove a user from a team.

NOTE: Unable to remove the owner of a team.

Args

user : str
The user ID or email to add to the team.
team_id : int
The team ID.
session : Session, optional
A connection session. If not specified the default session is used.

Returns

dict
The updated team information.
def set_owner(team_id: int, owner_email: str, session: Optional[Session] = None) -> dict

Set the owner of a team.

NOTE: This will only work for users who are organization owners or are currently the team owner.

Args

team_id : int
The team ID.
owner_email : str
The email address of the new owner.
session : Session, optional
A connection session. If not specified the default session is used.

Returns

dict
The updated team information.