Skip to content

Commit

Permalink
jimfuqian/BB2-fix-the-temp-fix-if-checking-cond (#1256)
Browse files Browse the repository at this point in the history
* fix the temp fix if checking.

* Minor adjustments

---------

Co-authored-by: jimmyfagan <jimmyfagan@navapbc.com>
  • Loading branch information
JFU-NAVA-PBC and jimmyfagan authored Oct 16, 2024
1 parent 476ef92 commit cb83285
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 cb83285

Please sign in to comment.