sdk.permission.create()

elements.sdk.api.permission

Create a Permission.

Share one or multiple resources with other users by creating a new Permission for those resources.

Parameters

  • user_ids (List[str]) - the user IDs (emails) you'd like to share the resources with
  • resource_ids (List[str]) - the resource IDs you'd like to share with the users
  • resource_type (PermissionResourceType) - the type of resource the resource IDs reference
  • permission_type (PermissionType) - Permission type to grant the users for the resource (read, write, admin)
  • public (bool) - flag to share publicly (with all Elements users). Overrides user_ids arg. NOTE: user must have a global admin role and set the public_confirm arg to True to enable this functionality
  • public_confirm (bool) - flag to confirm the sharing of the resource_ids publicly

Returns

None

Example(s)

# Share with user
await sdk.permission.create(
  user_ids=["[email protected]"],
  resource_ids=["ac9f25c2-48ba-48b1-b096-ac3d0ec83c21"],
  permission_type=PermissionType.READ,
  resource_type=PermissionResourceType.ANALYSIS_CONFIG
)

# Share publicly
await sdk.permission.create(
  public=True, public_confirm=True,
  resource_ids=["ac9f25c2-48ba-48b1-b096-ac3d0ec83c21"],
  permission_type=PermissionType.READ,
  resource_type=PermissionResourceType.ANALYSIS_CONFIG
)