Skip to content

Commit 29635b0

Browse files
committed
moving functionality to a base get_and_update_user call. Putting in comments for now to pass flake8
1 parent de48bf1 commit 29635b0

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

apps/dot_ext/views/authorization.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,13 @@ def post(self, request, *args, **kwargs):
448448
elif app.data_access_type == "RESEARCH_STUDY":
449449
dag_expiry = ""
450450

451+
# Get the crosswalk for the user from token.user like
452+
# try:
453+
# crosswalk = Crosswalk.objects.get(user=token.user)
454+
# except Crosswalk.DoesNotExist:
455+
# crosswalk = None
456+
# This gets us the mbi and other info we need from the crosswalk
457+
# Probably some kind of handling for if there is no mbi needs to happen here too
451458
body['access_grant_expiration'] = dag_expiry
452459
body = json.dumps(body)
453460

apps/mymedicare_cb/models.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,45 @@ class BBMyMedicareCallbackCrosswalkUpdateException(APIException):
2828
# BB2-237 custom exception
2929
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
3030

31-
32-
def get_and_update_user(slsx_client: OAuth2ConfigSLSx, request):
31+
# def _get_and_update_user(mbi, user_id, hicn_hash, request):
32+
# """
33+
# Base function to get and update user from either authorize or refresh flows.
34+
# """
35+
36+
# version = request.session['version']
37+
# logger = logging.getLogger(logging.AUDIT_AUTHN_MED_CALLBACK_LOGGER, request)
38+
39+
# # Match a patient identifier via the backend FHIR server
40+
# if version == Versions.V3:
41+
# hicn_hash = None
42+
43+
# versioned_fhir_ids = {}
44+
# # Perform fhir_id lookup for all supported versions
45+
# # If the lookup for the requested version fails, raise the exception
46+
# # This is wrapped in the case that if the requested version fails, match_fhir_id
47+
# # will still bubble up UpstreamServerException
48+
# for supported_version in Versions.latest_versions():
49+
# try:
50+
# fhir_id, hash_lookup_type = match_fhir_id(
51+
# mbi=mbi,
52+
# hicn_hash=hicn_hash,
53+
# request=request,
54+
# version=supported_version,
55+
# )
56+
# versioned_fhir_ids[supported_version] = fhir_id
57+
# except UpstreamServerException as e:
58+
# if supported_version == version:
59+
# raise e
60+
61+
# bfd_fhir_id_v2 = versioned_fhir_ids.get(Versions.V2, None)
62+
# bfd_fhir_id_v3 = versioned_fhir_ids.get(Versions.V3, None)
63+
64+
65+
# def get_and_update_from_refresh(mbi, user_id, hicn_hash, request):
66+
# version = request.session['version']
67+
# pass
68+
69+
def get_and_update_user_from_authorize(slsx_client: OAuth2ConfigSLSx, request):
3370
"""
3471
Find or create the user associated
3572
with the identity information from the ID provider.

0 commit comments

Comments
 (0)