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
1 change: 1 addition & 0 deletions src/schema/schema_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class SchemaConstants(object):
ENTITY_API_APP = 'entity-api'
COMPONENT_DATASET = 'component-dataset'
INGEST_PIPELINE_APP = 'ingest-pipeline'
INGEST_UI = 'ingest-ui'
HUBMAP_APP_HEADER = 'X-Hubmap-Application'
LOCKED_ENTITY_UPDATE_HEADER = 'X-HuBMAP-Update-Override'
INTERNAL_TRIGGER = 'X-Internal-Trigger'
Expand Down
6 changes: 4 additions & 2 deletions src/schema/schema_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def validate_application_header_before_entity_create(options_dict):
applications_allowed = [
SchemaConstants.INGEST_API_APP,
SchemaConstants.INGEST_PIPELINE_APP,
SchemaConstants.INGEST_UI,
SchemaConstants.ENTITY_API_APP
]

Expand Down Expand Up @@ -348,6 +349,7 @@ def validate_application_header_before_property_update(property_key, normalized_
applications_allowed = [
SchemaConstants.INGEST_API_APP,
SchemaConstants.INGEST_PIPELINE_APP,
SchemaConstants.INGEST_UI,
SchemaConstants.ENTITY_API_APP
]

Expand Down Expand Up @@ -906,12 +908,12 @@ def _validate_application_header(applications_allowed, request_headers):

if not app_header:
msg = f"Unable to proceed due to missing {SchemaConstants.HUBMAP_APP_HEADER} header from request"
raise MissingApplicationHeaderException(msg)
raise schema_errors.MissingApplicationHeaderException(msg)

# Use lowercase for comparing the application header value against the yaml
if app_header.lower() not in applications_allowed:
msg = f"Unable to proceed due to invalid {SchemaConstants.HUBMAP_APP_HEADER} header value: {app_header}"
raise InvalidApplicationHeaderException(msg)
raise schema_errors.InvalidApplicationHeaderException(msg)

"""
Indicate if the entity meets a criteria to lock out modification updates
Expand Down