Inventory Collaborators
Inventories are designed to be collaborative, enabling multiple users with different roles to contribute to the governance of key assets. Below are the methods available for managing collaborators within an inventory:
Important
To add new collaborators:
On the watsonx.governance Platform:
You need either the user_id or the access_group_id of the person. To find these:
Find the `user_id`:
Go to the watsonx.governance Platform.
Navigate to Access Control.
Select Users.
Locate the User-ID for the desired user.
Find the `access_group_id`:
Go to the watsonx.governance Platform.
Navigate to Access Control.
Select User Groups.
Find the desired group.
The access_group_id is located at the end of the URL, e.g., usermgmt-ui/groups/10001, where 10001 is the group ID.
On the IBM Cloud:
You need either the user_id or the access_group_id of the person. To find these:
Find the `user_id`:
Go to cloud.ibm.com.
Navigate to IAM.
Select Users.
Click on the three dots next to the user and choose Manage User.This will allow you to retrieve the necessary user_id to add collaborators.
Find the `access_group_id`:
Go to cloud.ibm.com.
Navigate to IAM.
Select Access Groups.
Click on the three dots next to the group and choose Manage Access.
This will allow you to retrieve the necessary access_group_id from the details to add collaborators.
- add_collaborator(self, role: str, user_id: str | int = None, access_group_id: str | int = None)
Add a collaborator to the inventory.
This method assigns a user or an access group to the inventory with a specified role.
- Parameters:
role (str): The role to assign to the collaborator. Available options are in
Role
.user_id (str, optional): The ID of the user to be added as a collaborator.
access_group_id (str, optional): The ID of the access group to be added as a collaborator.
- Note:
Ensure that you have the correct user ID or access group ID format based on the platform you are using.
Both user_id and access_group_id cannot be provided simultaneously.
- Example:
>>> inventory.add_collaborator(role="Editor", user_id="IBMid-11000***") >>> inventory.add_collaborator(role="Viewer", access_group_id="access-group-12345")
- list_collaborators(self) List[Dict[str, str | None]]
Retrieve a list of collaborators for the inventory.
If no collaborators are found or if the collaborator information is unavailable, an empty list is returned.
- Returns:
List[Dict[str, Optional[str]]]: A list of dictionaries with details about each collaborator, or an empty list if no collaborators are found.
- Example:
>>> collaborators = inventory.list_collaborators()
- set_collaborator_role(self, role: str, user_id: str = None, access_group_id: str = None)
set the role of an existing collaborator in the inventory.
This method changes the role assigned to a user in the inventor.
- Parameters:
role (str): The role to assign to the user.Available options are in
Role
user_id (str,optional): The ID of the user whose role is to be updated.
access_group_id (str, optional): The ID of the access group to be added as a collaborator.
- Note:
Ensure that you have the correct user ID or access group ID format based on the platform you are using.
Both user_id and access_group_id cannot be provided simultaneously.
- Example:
>>> inventory.set_collaborator_role(role="Viewer", user_id="IBMid-11000***") >>> inventory.set_collaborator(role="Viewer", access_group_id="access-group-12345")
- remove_collaborator(self, user_id: str = None, access_group_id: str = None)
Remove a collaborator from the inventory.
This method removes a user from the inventory.
- Parameters:
user_id (str,optional): The ID of the user to be removed from the collaborators.
access_group_id (str, optional): The ID of the access group to be added as a collaborator.
- Note:
Ensure that you have the correct user ID or access group ID format based on the platform you are using.
Both user_id and access_group_id cannot be provided simultaneously.
- Example:
>>> inventory.remove_collaborator(user_id="IBMid-11000***") >>> inventory.remove_collaborator(access_group_id="access-group-12345")