The Collaboration Allowlist API allows you to manage a set of approved domains (i.e. a allowlist) that can collaborate with your enterprise. You can also manage whether the allowlisted domains are approved for outbound or inbound collaboration.
It is important to note that the collaboration allowlist functionality is only available to customers with Box Governance.
- List Collaboration Allowlist Entries
- Get Information for Collaboration Allowlist Entry
- Allowlist a Domain for Collaboration
- Remove a Domain from Allowlist
- List Exempt Users
- Get Exempt User Information
- Exempt User from Allowlist
- Remove User Exemption
To retrieve a list of collaboration allowlist entries, call
collaboration_allowlist.get_entries(limit=None, marker=None, fields=None)
. This method returns a
BoxObjectCollection
which can iterate over the CollaborationAllowlistEntry
objects in the collection.
allowlist_entries = client.collaboration_allowlist().get_entries()
for entry in allowlist_entries:
direction = entry.direction if entry.direction != 'both' else 'bidirectional'
print(f'Domain {entry.domain} is allowlisted for {direction} collaboration')
To get information about a collaboration allowlist entry, use collaboration_allowlist_entry.get(*, fields=None, headers=None, **kwargs)
.
This method returns a CollaborationAllowlistEntry
object with fields populated by data form the API.
allowlist_entry = client.collaboration_allowlist_entry(entry_id='11111').get()
To allowlist a domain for collaboration, call collaboration_allowlist.add_domain(domain, direction)
with
the domain to allowlist and the direction(s) collaboration should be allowed in. This method returns a
CollaborationAllowlistEntry
object representing the newly-allowlisted domain.
You can determine the direction of the allowlist by passing in 'outbound', 'inbound', or 'both'. Outbound collaboration is defined as a user in your enterprise collaborating on content owned by someone outside your enterprise. Inbound collaboration is defined as a user outside of your enterprise collaborating on content owned by your enterprise.
from boxsdk.object.collaboration_allowlist import AllowlistDirection
domain = 'example.com'
allowlist_entry = client.collaboration_allowlist().add_domain(domain, direction=AllowlistDirection.INBOUND)
To remove a collaboration allowlisted domain, call collaboration_allowlist_entry.delete()
. This will remove
the domain from the allowlist, restricting collaboration to and from users in that domain. This method returns True
to indicate that deletion was successful.
client.collaboration_allowlist_entry(entry_id='11111').delete()
To get all exempt users from the collaboration allowlist, call
collaboration_allowlist.get_exemptions(limit=None, marker=None, fields=None)
. This method returns
a BoxObjectCollection
that allows you to iterate over each
CollaborationAllowlistExemptTarget
in the collection.
exemptions = client.collaboration_allowlist().get_exemptions()
for exemption in exemptions:
print(f'{exemption.user.name} (ID: {exemption.user.id}) is exempt from the collaboration allowlist')
To get information about an exempted user, call collaboration_allowlist_exempt_target.get(*, fields=None, headers=None, **kwargs)
.
This method will return a `CollaborationAllowlistExemptTarget with fields populated by data from the API.
exemption_id = '11111'
exemption = client.collaboration_allowlist_exempt_target(exemption_id).get()
To exempt a user from the collaboration allowlist, call collaboration_allowlist.add_exemption(user)
with the User
to exempt from the allowlist. This user will no longer be subject to the collaboration
allowlist, and will be permitted to collaborate with users from any other domain. This method returns a
CollaborationAllowlistExemptTarget
object representing the exempted user.
user = client.user(user_id='11111')
exemption = client.collaboration_allowlist().add_exemption(user)
To remove a user exemption from the collaboration allowlist, call
collaboration_allowlist_exempt_target.delete()
. This will remove the exemption and make the user subject to
the collaboration allowlist again. This method returns True
to indicate that deletion was successful.
client.collaboration_allowlist_exempt_target(exemption_id='22222').delete()