Skip to content

Commit

Permalink
Merge branch 'master' into brandon/BB2-3349-update-django
Browse files Browse the repository at this point in the history
  • Loading branch information
bwang-icf authored Oct 16, 2024
2 parents addbfae + cb83285 commit f8e6c43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/capabilities/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ def has_permission(self, request, view):
return True

if hasattr(token, "scope"): # OAuth 2
token_scopes = token.scope.split()
scopes = list(ProtectedCapability.objects.filter(
slug__in=token.scope.split()
slug__in=token_scopes
).values_list('protected_resources', flat=True).all())

# this is a shorterm fix to reject all tokens that do not have either
# patient/coverage.read or patient/ExplanationOfBenefit.read
if ("patient/Coverage.read" or "patient/ExplanationOfBenefit.read") in token.scope.split():
if ("patient/Coverage.read" in token_scopes) or ("patient/ExplanationOfBenefit.read" in token_scopes):
for scope in scopes:
for method, path in json.loads(scope):
if method != request.method:
Expand Down

0 comments on commit f8e6c43

Please sign in to comment.