UserClient
class UserClient(lightctl.client.base_client.BaseClient)
| Helper functions for acessing workspace users
|
| Example:
| uc = UserClient()
| wc = WorkspaceClient()
| workspaces = wc.list_workspaces()
| workspace_name_to_update = "Revenue"
| workspace_to_update = [workspace for workspace in workspaces if workspace["name"] == workspace_name_to_update][0]
| uc.add_user_to_workspace(workspace_to_update["uuid"], "[email protected]", "editor")
|
| Methods defined here:
|
| add_app_user(self, user_id: str, role: str) -> Dict
| Add a user to the app
|
| Args:
| user_id (str): User id (email) of user to be added to workspace
| role (str): Role of user when added to app. Legal roles are "app_admin", "app_editor", "app_viewer"
|
| Returns:
| dict: A user object
|
| add_user_to_workspace(self, workspace_id: str, user_id: str, role: str) -> Dict
| Add a user to a workspace
|
| Args:
| workspace_id (str): Workspace id
| user_id (str): User id (email) of user to be added to workspace
| role (str): Role of user when added to workspace. Legal roles are "viewer", "editor", "admin", and "observer"
|
| Returns:
| dict: A user object with role set to the user's role in the workspace
|
| app_users_url(self) -> str
| Returns:
| str: The app users endpoint, used for getting and modifying users
|
| delete_app_user(self, user_id: str)
| Remove a user from the app
|
| Args:
| user_id (str): User id (email) of user to be removed
|
| Returns:
| ??
|
| get_app_user(self, user_id: str)
| Get an app user by user_id
|
| Args:
| user_id (str): User id (email) of user to be returned
|
| Returns:
| dict: A user object
|
| list_app_users(self) -> List[Dict]
| Get all users in the app
|
| Args:
| workspace_id (str): Workspace id
|
| Returns:
| list: a list of users
|
| list_users(self, workspace_id: str) -> List[Dict]
| Get all users in the workspace
|
| Args:
| workspace_id (str): Workspace id
|
| Returns:
| list: a list of users
|
| remove_user_from_workspace(self, workspace_id: str, user_id: str) -> Dict
| Remove user from a workspace
|
| Args:
| workspace_id (str): Workspace id
| user_id (str): User id (email) of user to be removed
|
| update_app_user_role(self, user_id: str, role: str)
| Update a user's role in the app
|
| Args:
| user_id (str): User id (email) of user to be updated
| role (str): New role of user. Legal roles are "app_admin", "app_editor", "app_viewer"
| Returns:
| dict: A user object
|
| update_user_role(self, workspace_id: str, user_id: str, role: str)
| Update a user's role in a workspace
|
| Args:
| workspace_id (str): Workspace id
| user_id (str): User id (email) of user to be removed
| role (str): New role of user. Legal roles are "viewer", "editor", "admin", and "observer"
| Returns:
| dict: A user object with role set to the user's role in the workspace
|
| users_url(self, workspace_id) -> str
| Returns:
| str: The workspace users endpoint, used for getting and modifying workspace users
Updated about 1 year ago