Sharing objects
Sharing Objects¶
Using the integrated Jupyter notebook, users are able to share Draft registered objects with other users before they are Approved. Additionally, users can access shared details and modify read/write access without having to navigate to the object page on the Platform. We illustrate the same in this notebook for a DataElement.
# Import DataElement from Corridor
from corridor import DataElement
Access a DataElements available through the imported DataElement
# Accessing registered draft DataElement using alias
DE_example = DataElement('annual_income')
print(f'current_status: {DE_example.current_status}')
print(f'created_date: {DE_example.created_date}')
print(f'created_by: {DE_example.created_by}')
current_status: Draft created_date: 2022-10-03 11:36:32 created_by: master
Share Details
Users have the ability to access a list of individuals with whom the object has been previously shared using share_details attribute.
# As the DE_example has not yet been shared with any other users, the returned list will be empty.
DE_example.share_details
[]
Grant Share
Users have the capability to share objects with other registered users on the platform utilizing the grant_share attribute.
grant_share requires the following arguments
user: The username of the user to whom the object is being shared.access_type: Indicates the level of access being granted, which can be either "Read" or "Write".
# Sharing Read access with admin
DE_example.grant_share(user='admin',access_type='Read')
# Sharing Write access with analyst
DE_example.grant_share(user='analyst',access_type='Write')
Shared DataElement with user "admin" with "Read" access Shared DataElement with user "analyst" with "Write" access
# The share_details attribute should now accurately reflect the information of users to whom access has been granted.
DE_example.share_details
[ShareRecord(id=2281, access_type='Read', user='admin'), ShareRecord(id=2282, access_type='Write', user='analyst')]
Revoke Share
Users can revoke the access to the object using revoke_share attribute.
revoke_share requires the following arguments
user: The username of the user to whom the object is being shared
# Revoking share for the users
DE_example.revoke_share(user='admin')
DE_example.revoke_share(user='analyst')
Revoked access for admin Revoked access for analyst
# As access has been revoked, the share_details attribute should now be an empty list.
DE_example.share_details
[]