Module tripleblind.request
Access Request API
Access Requests are generated when a user in an team wants to use an asset (data and/or algorithms) owned by another team. Each request is associated with asset(s) and a specific job.
The Access Request API allows users to view and respond to access requests associated with their team's assets.
The Access Request API is only available to users with the "owner" role for their team.
Classes
class Request (asset: List[uuid.UUID], is_algo: bool, by_team: dict, by_user: dict, job_id: uuid.UUID, job_name: str, job_meta: dict = None, perm_meta: list = None, preprocessors: List[dict] = None)
-
Requests (also called Access Requests) are generated when a user in an team wants to use an asset (data and/or algorithms) owned by another team. Each request is associated with asset(s) and a specific job.
Class variables
var asset : List[uuid.UUID]
-
The UUID(s) of the asset(s) being requested, dataset(s) or algorithm.
var by_team : dict
-
team of the requestor. Example. {'container': '1855c9d3-6c01-4f04-b409-a86c3b9b91a4', 'id': 2, 'is_active': True, 'modified': '2020-05-13T14:25:51.862000-05:00', 'name': 'Globex'}
var by_user : dict
-
User info of the requestor. Example: {'first_name': 'Betty', 'id': '84c4098f-b298-42c0-a5af-b02d64d006d3', 'is_locked': False, 'last_login': '2023-06-22T11:05:20.527485-05:00', 'last_name': 'Zweiten', 'username': 'organization-two'},
var is_algo : bool
-
the type of asset being requested: if algorithm, True; if dataset(s), False
var job_id : uuid.UUID
-
The Job ID for which the request is associated
var job_meta : dict
-
The Job metadata for which the request is associated
var job_name : str
-
The Job ID for which the request is associated
var perm_meta : list
-
Metadata about the assets for which permissions are required
var preprocessors : List[dict]
-
Preprocessors used for dataset asset(s) being requested. None for algorithm assets
Static methods
def accept(asset_id: uuid.UUID, job_id: uuid.UUID, session: Optional[Session] = None)
-
Accept the access request for the provided asset_id and job_id
Args
asset_id
:UUID
- ID of the asset for which access is being approved.
job_id
:UUID
- ID of job that is requesting access to the asset.
session
:Session
, optional- A connection session. If not specified the default session is used.
def accept_all(asset_ids: List[uuid.UUID], job_id: uuid.UUID, session: Optional[Session] = None)
-
Accept the access request for all assets associated with a job. Successful acceptance depends on whether the user has permissions to grant access to asset usage and whether the asset is owned by that user's associated team.
Args
asset_id
:List[UUID]
- List of IDs of the assets for which access is being approved.
job_id
:UUID
- ID of job that is requesting access to the assets.
session
:Session
, optional- A connection session. If not specified the default session is used.
def deny(asset_id: uuid.UUID, job_id: uuid.UUID, session: Optional[Session] = None)
-
Deny the access request for the provided asset_id and job_id
Args
asset_id
:UUID
- ID of the asset for which access is being denied.
job_id
:UUID
- ID of job that is requesting access to the asset.
session
:Session
, optional- A connection session. If not specified the default session is used.
def deny_all(asset_ids: List[uuid.UUID], job_id: uuid.UUID, session: Optional[Session] = None)
-
Deny the access request for all assets associated with a job.
Successful denial depends on whether the user has permissions to deny access to asset usage and whether the asset is owned by that user's associated team.
Args
asset_ids
:List[UUID]
- List of IDs of the assets for which access is being denied.
job_id
:UUID
- ID of job that is requesting access to the assets.
session
:Session
, optional- A connection session. If not specified the default session is used.
def get_all(all_assets: Optional[bool] = True, session: Optional[Session] = None) -> List[Request]
-
Retrieve a list of pending access requests.
Args
all_assets
:bool
, optional- Option to return all requested assets (asset) and permission metadata (perm_meta) for each access request, or just the assets owned by the session user's team. If True, shows all assets otherwise shows only assets owned by user's team. Defaults to True.
session
:Session
, optional- A connection session. If not specified the default session is used.
Returns
List[Request]
- A list of pending access requests