provenaclient.clients.auth_client

Created Date: Friday May 31st 2024 +1000 Author: Peter Baker —– Last Modified: Friday May 31st 2024 9:50:26 am +1000 Modified By: Peter Baker —– Description: The Auth API L2 Client —– HISTORY: Date By Comments ———- — ———————————————————

18-06-2024 | Peter Baker | Some issues with admin remove members interfaces - blocked on this

Classes

AuthEndpoints

str(object='') -> str

AuthAdminSubClient

This class interface just captures that the client has an instantiated auth

AuthClient

This class interface just captures that the client has an instantiated auth

Module Contents

class provenaclient.clients.auth_client.AuthEndpoints[source]

Bases: str, enum.Enum

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

GET_CHECK_ACCESS_PUBLIC = '/check-access/public'
GET_CHECK_ACCESS_GENERAL = '/check-access/general'
GET_ADMIN_CONFIG = '/admin/config'
GET_ADMIN_SENTRY_DEBUG = '/admin/sentry-debug'
GET_ACCESS_CONTROL_ADMIN_ALL_PENDING_REQUEST_HISTORY = '/access-control/admin/all-pending-request-history'
GET_ACCESS_CONTROL_ADMIN_ALL_REQUEST_HISTORY = '/access-control/admin/all-request-history'
GET_ACCESS_CONTROL_ADMIN_USER_PENDING_REQUEST_HISTORY = '/access-control/admin/user-pending-request-history'
GET_ACCESS_CONTROL_ADMIN_USER_REQUEST_HISTORY = '/access-control/admin/user-request-history'
POST_ACCESS_CONTROL_ADMIN_ADD_NOTE = '/access-control/admin/add-note'
POST_ACCESS_CONTROL_ADMIN_CHANGE_REQUEST_STATE = '/access-control/admin/change-request-state'
POST_ACCESS_CONTROL_ADMIN_DELETE_REQUEST = '/access-control/admin/delete-request'
POST_ACCESS_CONTROL_USER_REQUEST_CHANGE = '/access-control/user/request-change'
GET_ACCESS_CONTROL_USER_REQUEST_HISTORY = '/access-control/user/request-history'
GET_ACCESS_CONTROL_USER_PENDING_REQUEST_HISTORY = '/access-control/user/pending-request-history'
GET_ACCESS_CONTROL_USER_GENERATE_ACCESS_REPORT = '/access-control/user/generate-access-report'
GET_GROUPS_ADMIN_LIST_GROUPS = '/groups/admin/list_groups'
GET_GROUPS_ADMIN_DESCRIBE_GROUP = '/groups/admin/describe_group'
GET_GROUPS_ADMIN_LIST_MEMBERS = '/groups/admin/list_members'
GET_GROUPS_ADMIN_LIST_USER_MEMBERSHIP = '/groups/admin/list_user_membership'
GET_GROUPS_ADMIN_CHECK_MEMBERSHIP = '/groups/admin/check_membership'
POST_GROUPS_ADMIN_ADD_MEMBER = '/groups/admin/add_member'
DELETE_GROUPS_ADMIN_REMOVE_MEMBER = '/groups/admin/remove_member'
POST_GROUPS_ADMIN_ADD_GROUP = '/groups/admin/add_group'
DELETE_GROUPS_ADMIN_REMOVE_GROUP = '/groups/admin/remove_group'
PUT_GROUPS_ADMIN_UPDATE_GROUP = '/groups/admin/update_group'
GET_GROUPS_ADMIN_EXPORT = '/groups/admin/export'
POST_GROUPS_ADMIN_IMPORT = '/groups/admin/import'
POST_GROUPS_ADMIN_RESTORE_FROM_TABLE = '/groups/admin/restore_from_table'
GET_GROUPS_USER_LIST_GROUPS = '/groups/user/list_groups'
GET_GROUPS_USER_DESCRIBE_GROUP = '/groups/user/describe_group'
GET_GROUPS_USER_LIST_USER_MEMBERSHIP = '/groups/user/list_user_membership'
GET_GROUPS_USER_LIST_MEMBERS = '/groups/user/list_members'
GET_GROUPS_USER_CHECK_MEMBERSHIP = '/groups/user/check_membership'
GET_HEALTH_CHECK = '/'
DELETE_GROUPS_ADMIN_REMOVE_MEMBERS = '/groups/admin/remove_members'
class provenaclient.clients.auth_client.AuthAdminSubClient(auth: provenaclient.clients.client_helpers.AuthManager, config: provenaclient.clients.client_helpers.Config)[source]

Bases: provenaclient.clients.client_helpers.ClientService

This class interface just captures that the client has an instantiated auth manager which allows for helper functions abstracted for L2 clients.

_auth
_config
_build_endpoint(endpoint: AuthEndpoints) str[source]
async get_all_pending_request_history() ProvenaInterfaces.AuthAPI.AccessRequestList[source]

Gets all requests with pending status

Returns:

The response object

Return type:

AccessRequestList

async get_all_request_history() ProvenaInterfaces.AuthAPI.AccessRequestList[source]

Gets all requests

Returns:

The response object

Return type:

AccessRequestList

async get_user_pending_request_history(username: str) ProvenaInterfaces.AuthAPI.AccessRequestList[source]

Gets pending requests for specified user

Parameters:

username (str) – Username to query

Returns:

The response list

Return type:

AccessRequestList

async get_user_request_history(username: str) ProvenaInterfaces.AuthAPI.AccessRequestList[source]

Gets all requests for specified user

Parameters:

username (str) – Username to query

Returns:

The response list

Return type:

AccessRequestList

async post_add_note(note: ProvenaInterfaces.AuthAPI.RequestAddNote) None[source]

Adds a note to an existing request

Parameters:

note (RequestAddNote) – Payload incl note info

async post_change_request_state(send_email_alert: bool, change: ProvenaInterfaces.AuthAPI.AccessRequestStatusChange) ProvenaInterfaces.AuthAPI.ChangeStateStatus[source]

Change state of a request.

Parameters:
  • send_email_alert (bool) – Should trigger email alert?

  • change (AccessRequestStatusChange) – The details of change

Returns:

The response object

Return type:

ChangeStateStatus

async get_list_groups() ProvenaInterfaces.AuthAPI.ListGroupsResponse[source]

Gets a list of groups

Returns:

List of groups

Return type:

ListGroupsResponse

async get_describe_group(group_id: str) ProvenaInterfaces.AuthAPI.DescribeGroupResponse[source]

Describes a group by ID

Parameters:

group_id (str) – The group

Returns:

Description

Return type:

DescribeGroupResponse

async get_list_members(group_id: str) ProvenaInterfaces.AuthAPI.ListMembersResponse[source]

Lists members of group

Parameters:

group_id (str) – The gruop

Returns:

The list of members

Return type:

ListMembersResponse

async get_list_group_membership(username: str) ProvenaInterfaces.AuthAPI.ListUserMembershipResponse[source]

Gets list of groups a user is in

Parameters:

username (str) – The username

Returns:

The list of groups

Return type:

ListUserMembershipResponse

async get_check_user_membership(username: str, group_id: str) ProvenaInterfaces.AuthAPI.CheckMembershipResponse[source]

Checks user membership within a group

Parameters:
  • username (str) – The username to target

  • group_id (str) – The group to check

Returns:

Response

Return type:

CheckMembershipResponse

async post_groups_add_member(group_id: str, user: ProvenaInterfaces.AuthAPI.GroupUser) ProvenaInterfaces.AuthAPI.AddMemberResponse[source]

Adds a member to a group

Parameters:
  • group_id (str) – Id of group

  • user (GroupUser) – The user to add

Returns:

The response

Return type:

AddMemberResponse

async delete_remove_member(group_id: str, username: str) ProvenaInterfaces.AuthAPI.RemoveMemberResponse[source]

Removes member from group

Parameters:
  • group_id (str) – The id of group

  • username (str) – The user to remove

Returns:

The response

Return type:

RemoveMemberResponse

async post_add_group(group: ProvenaInterfaces.AuthAPI.UserGroupMetadata) ProvenaInterfaces.AuthAPI.AddGroupResponse[source]

Adds a group/creates group

Parameters:

group (UserGroupMetadata) – The group details

Returns:

The response

Return type:

AddGroupResponse

async put_update_group(group: ProvenaInterfaces.AuthAPI.UserGroupMetadata) ProvenaInterfaces.AuthAPI.UpdateGroupResponse[source]

Updates group details

Parameters:

group (UserGroupMetadata) – The group metadata

Returns:

The response

Return type:

UpdateGroupResponse

async get_export_groups() ProvenaInterfaces.AuthAPI.GroupsExportResponse[source]

Exports all group details in specified format.

Returns:

The data dump

Return type:

GroupsExportResponse

async post_import_groups(body: ProvenaInterfaces.AuthAPI.GroupsImportRequest) ProvenaInterfaces.AuthAPI.GroupsImportResponse[source]

Imports groups from data dump back in

Parameters:

body (GroupsImportRequest) – The import request incl. dump

Returns:

The response

Return type:

GroupsImportResponse

async post_restore_groups_from_table(table_name: str, body: ProvenaInterfaces.AuthAPI.GroupsRestoreRequest) ProvenaInterfaces.AuthAPI.GroupsImportResponse[source]

Restores groups by first dumping from valid group table. Needs permissions to table.

Parameters:
  • table_name (str) – The table name

  • body (GroupsRestoreRequest) – The request

Returns:

The response details

Return type:

GroupsImportResponse

Gets the linked person for user

Parameters:

username (str) – User to lookup

Returns:

Response

Return type:

AdminLinkUserLookupResponse

Looks up reverse by person ID

Parameters:

person_id (str) – The person to lookup

Returns:

The response

Return type:

UserLinkReverseLookupResponse

Assigns a person to a given user

Parameters:

body (AdminLinkUserAssignRequest) – The request

Returns:

The response

Return type:

AdminLinkUserAssignResponse

Deletes an existing link

Parameters:

username (str) – The user to unlink

Returns:

The response

Return type:

AdminLinkUserClearResponse

class provenaclient.clients.auth_client.AuthClient(auth: provenaclient.clients.client_helpers.AuthManager, config: provenaclient.clients.client_helpers.Config)[source]

Bases: provenaclient.clients.client_helpers.ClientService

This class interface just captures that the client has an instantiated auth manager which allows for helper functions abstracted for L2 clients.

admin: AuthAdminSubClient
_auth
_config
_build_endpoint(endpoint: AuthEndpoints) str[source]
async get_health_check() provenaclient.models.HealthCheckResponse[source]

Health check the API

Returns:

Response

Return type:

HealthCheckResponse

async get_user_request_history() ProvenaInterfaces.AuthAPI.AccessRequestList[source]

Gets the users access request history

Returns:

The list of requests

Return type:

AccessRequestList

async post_user_request_change(body: ProvenaInterfaces.AuthAPI.AccessReport, send_email: bool) provenaclient.utils.helpers.StatusResponse[source]

Requests a change by diffing access models

Parameters:
  • body (AccessReport) – The new access desired

  • send_email (bool) – Email alert

Returns:

Ok?

Return type:

StatusResponse

async get_user_pending_request_history() ProvenaInterfaces.AuthAPI.AccessRequestList[source]

Gets only pending requests from history

Returns:

The list

Return type:

AccessRequestList

async get_user_generate_access_report() ProvenaInterfaces.AuthAPI.AccessReportResponse[source]

Generates an access report detailing system access.

Returns:

The response

Return type:

AccessReportResponse

async get_list_groups() ProvenaInterfaces.AuthAPI.ListGroupsResponse[source]

Lists all groups

Returns:

List of groups

Return type:

ListGroupsResponse

async get_describe_group(group_id: str) ProvenaInterfaces.AuthAPI.DescribeGroupResponse[source]

Describes a specific gruop

Parameters:

group_id (str) – The id of group

Returns:

Response with details

Return type:

DescribeGroupResponse

async get_list_membership() ProvenaInterfaces.AuthAPI.ListUserMembershipResponse[source]

Gets the list of groups user is member of

Returns:

List and details

Return type:

ListUserMembershipResponse

async get_list_group_members(group_id: str) ProvenaInterfaces.AuthAPI.ListMembersResponse[source]

Lists the members of a given group

Parameters:

group_id (str) – The group to lookup

Returns:

Members

Return type:

ListMembersResponse

async get_check_membership(group_id: str) ProvenaInterfaces.AuthAPI.CheckMembershipResponse[source]

Checks if user is in specific group

Parameters:

group_id (str) – The group to check

Returns:

In group?

Return type:

CheckMembershipResponse

Looks up either current user or specified user

Parameters:

username (Optional[str], optional) – The username if not current user. Defaults to None.

Returns:

The response indicating link

Return type:

UserLinkUserLookupResponse

Assigns link to current user.

Parameters:

body (UserLinkUserAssignRequest) – The link to assign

Returns:

The response indicating success

Return type:

UserLinkUserAssignResponse

Validates link before making it.

Parameters:

body (UserLinkUserAssignRequest) – The link to assign

Returns:

Valid?

Return type:

UserLinkUserValidateResponse