Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions entity-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,10 @@ components:
type: string
readOnly: true
description: 'A HuBMAP Consortium wide unique identifier randomly generated in the format HBM###.ABCD.### for every entity.'
error_message:
type: string
readOnly: false
description: 'An open text field that holds the last error message that arose from pipeline validation or analysis.'
last_modified_timestamp:
type: integer
readOnly: true
Expand Down Expand Up @@ -1476,6 +1480,7 @@ components:
created_by_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456'
uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456'
hubmap_id: 'HBM123.ABCD.456'
error_message: 'An error has occurred'
last_modified_timestamp: 1710243867000
last_modified_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456'
last_modified_user_email: 'janedoe@example.com'
Expand Down Expand Up @@ -1816,6 +1821,7 @@ components:
created_by_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456'
uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456'
hubmap_id: 'HBM123.ABCD.456'
error_message: 'An error has occurred'
last_modified_timestamp: 1710243867000
last_modified_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456'
last_modified_user_email: 'janedoe@example.com'
Expand All @@ -1837,6 +1843,7 @@ components:
created_by_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456'
uuid: 'abcd1234-ef56-gh78-ij90-klmnop123456'
hubmap_id: 'HBM123.ABCD.456'
error_message: 'An error has occurred'
last_modified_timestamp: 1710243867000
last_modified_user_sub: 'abcd1234-ef56-gh78-ij90-klmnop123456'
last_modified_user_email: 'janedoe@example.com'
Expand Down
16 changes: 9 additions & 7 deletions src/schema/schema_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,13 +811,15 @@ def validate_in_admin_group(property_key, normalized_entity_type, request, exist
"""
def validate_group_name(property_key, normalized_entity_type, request, existing_data_dict, new_data_dict):
assigned_to_group_name = new_data_dict['assigned_to_group_name']
globus_groups = schema_manager.get_auth_helper_instance().getHuBMAPGroupInfo()
group_dict = next((entry for entry in globus_groups.values() if entry.get("displayname") == assigned_to_group_name), None)
if group_dict is None:
raise ValueError("Invalid value for 'assigned_to_group_name'")
is_data_provider = group_dict.get('data_provider')
if not is_data_provider:
raise ValueError("Invalid group in 'assigned_to_group_name'. Must be a data provider")
# If method is PUT, an empty string is allowed, thus validation is skipped. But if a value is given, it must still be validated.
if not (request.method == "PUT" and (not assigned_to_group_name or not str(assigned_to_group_name).strip())):
globus_groups = schema_manager.get_auth_helper_instance().getHuBMAPGroupInfo()
group_dict = next((entry for entry in globus_groups.values() if entry.get("displayname") == assigned_to_group_name), None)
if group_dict is None:
raise ValueError("Invalid value for 'assigned_to_group_name'")
is_data_provider = group_dict.get('data_provider')
if not is_data_provider:
raise ValueError("Invalid group in 'assigned_to_group_name'. Must be a data provider")


"""
Expand Down