Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,7 @@ def register_collections_doi(collection_id):
#
# example url: https://my.endpoint.server/entities/a5659553c04f6ccbe54ff073b071f349/allowable-edit-states
# inputs:
# - The uuid of a HuBMAP entity (Donor, Sample or Dataset) as a URL path parameter
# - The uuid of a HuBMAP entity (Donor, Sampl, Dataset, Collection, or EPICollection) as a URL path parameter
# - A valid nexus token in a authorization bearer header
#
# returns
Expand Down Expand Up @@ -2203,6 +2203,13 @@ def allowable_edit_states(hmuuid):

entity_type = entity_type.lower().strip()
if not entity_type == 'upload':
if entity_type in ('collection', 'epicollection'):
doi_url = record.get('e.doi_url', None)
registered_doi = record.get('e.registered_doi', None)
if isBlank(doi_url) and isBlank(registered_doi):
data_access_level = "private"
else:
data_access_level = "public"
if isBlank(data_access_level):
msg = f"ERROR: unable to obtain a data_access_level from database for entity uuid:{hmuuid} during a call to allowable-edit-states"
logger.error(msg)
Expand Down Expand Up @@ -2245,6 +2252,12 @@ def allowable_edit_states(hmuuid):
if entity_type == 'upload':
if status in ['new', 'invalid', 'valid', 'error']:
r_val['has_submit_priv'] = True
if entity_type in ['collection','epicollection']:
doi_url = record.get('e.doi_url', None)
registered_doi = record.get('e.registered_doi', None)
if isBlank(doi_url) and isBlank(registered_doi):
r_val['has_publish_priv'] = True

#if in the users list of groups return true otherwise false
elif group_uuid in user_info['hmgroupids']:
if not status == 'processing':
Expand Down