diff --git a/rapyuta_io/clients/core_api_client.py b/rapyuta_io/clients/core_api_client.py index b38dc7b3..d7e0788d 100644 --- a/rapyuta_io/clients/core_api_client.py +++ b/rapyuta_io/clients/core_api_client.py @@ -149,6 +149,13 @@ def remove_user_from_project(self, project_guid, user_guid): response = RestClient(url).method(HttpMethod.DELETE).headers(headers).execute(payload) get_api_response_data(response, parse_full=True) + def update_user_role(self, project_guid, user_guid, user_role=None): + url = '{}{}/{}/updaterole'.format(self._core_api_host, self.PROJECT_PATH, project_guid) + headers = create_auth_header(self._auth_token, self._project) + payload = {'userGUID': user_guid, 'userRole': user_role} + response = RestClient(url).method(HttpMethod.PUT).headers(headers).execute(payload) + get_api_response_data(response, parse_full=True) + def create_secret(self, secret): url = self._core_api_host + self.SECRET_PATH + '/create' headers = create_auth_header(self._auth_token, self._project) diff --git a/rapyuta_io/rio_client.py b/rapyuta_io/rio_client.py index 134151f6..c01f8b61 100644 --- a/rapyuta_io/rio_client.py +++ b/rapyuta_io/rio_client.py @@ -1506,6 +1506,29 @@ def remove_user_from_project(self, project_guid, user_guid): """ return self._core_api_client.remove_user_from_project(project_guid=project_guid, user_guid=user_guid) + def update_user_role(self, project_guid, user_guid, user_role): + + """ + Upate a user's role in a project. + + :param project_guid: Project's GUID + :type project_guid: str + :param user_guid: User's GUID + :type user_guid: str + :param user_role: User's role + :type user_role: str + + Following example demonstrates how to update a User's role in a Project. + + >>> client = Client(auth_token='auth_token') + >>> client.update_user_role(project_guid='project_guid', user_guid='user_guid', user_role='admin') + + """ + return self._core_api_client.update_user_role( + project_guid=project_guid, + user_guid=user_guid, + user_role=user_role) + def create_secret(self, secret): """ Create a new Secret on the Platform under the project.