allowing public resource to be part of a collection resource
@@ -117,12 +117,13 @@ def update_collection(request, shortkey, *args, **kwargs):
= authorize(request, res_id_add,
needed_permission=ACTION_TO_AUTHORIZE.VIEW_METADATA)
- # the resources being added should be 'Shareable'
+ # the resources being added should be 'Shareable' or 'Public'
# or is owned by current user
is_shareable = res_to_add.raccess.shareable
+ is_public = res_to_add.raccess.public
is_owner = res_to_add.raccess.owners.filter(pk=user.pk).exists()
- if not is_shareable and not is_owner:
- raise Exception('Only resource owner can add a non-shareable '
+ if not is_shareable and not is_public and not is_owner:
+ raise Exception('Only resource owner can add a non-shareable or private '
'resource to a collection ')
# add this new res to collection
