Skip to content

Commit

Permalink
KOP-833: Fixed some incorrect log statements that somehow caused no p…
Browse files Browse the repository at this point in the history
…roblems during local test runs, but only during the docker build. Also changed invalid Task.owner from 400 to 403
  • Loading branch information
JorisHeadease committed Aug 9, 2024
1 parent c230045 commit fcedb04
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions application/idp_client/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def handle_relatedperson_checks(self, related_person, hti_launch_token, headers,

# Firstly, the user itself must not be marked as end-of-life
if not related_person['active']:
logger.error(f'[RelatedPerson/{related_person['id']}] launched, but user marked as inactive')
logger.error(f'[RelatedPerson/{related_person["id"]}] launched, but user marked as inactive')
return f'Forbidden', 403

if related_person['patient']['reference'] != hti_launch_token['patient']:
logger.error(f'[RelatedPerson/{related_person['id']}] launched, but got a patient mismatch: RelatedPerson.patient == {related_person['patient']} and launch.patient == {hti_launch_token['patient']}')
logger.error(f'[RelatedPerson/{related_person["id"]}] launched, but got a patient mismatch: RelatedPerson.patient == {related_person["patient"]} and launch.patient == {hti_launch_token["patient"]}')
return f'Forbidden', 403

# Secondly, we need to ensure the RelatedPerson Task also not marked as end-of-life
Expand All @@ -131,7 +131,7 @@ def handle_relatedperson_checks(self, related_person, hti_launch_token, headers,
task_for = task['for']['reference']

if task_for != hti_launch_token['patient']:
logger.error(f'Task.for [{task_for}] does not match launch token patient [{hti_launch_token['patient']}]')
logger.error(f'Task.for [{task_for}] does not match launch token patient [{hti_launch_token["patient"]}]')
return 'Forbidden', 403

task_owner = task['owner']['reference']
Expand All @@ -158,7 +158,7 @@ def handle_relatedperson_checks(self, related_person, hti_launch_token, headers,
logger.error(f'Forbidden, [{launch_sub}] is not a member of the Task.owner [{task_owner}]. Cannot launch [{hti_launch_token["resource"]}]')
return 'Forbidden', 403
else:
return 'Bad request, invalid Task.owner for RelatedPerson launch', 400
return 'Bad request, invalid Task.owner for RelatedPerson launch', 403


def _get_trace_headers(self):
Expand Down

0 comments on commit fcedb04

Please sign in to comment.