Skip to content

Commit

Permalink
feat(coreapi): adds api to update user role in project
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain committed Aug 24, 2023
1 parent 5b2bacd commit cdf0177
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rapyuta_io/clients/core_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions rapyuta_io/rio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cdf0177

Please sign in to comment.