Skip to content

Commit f8e6c43

Browse files
authored
Merge branch 'master' into brandon/BB2-3349-update-django
2 parents addbfae + cb83285 commit f8e6c43

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/capabilities/permissions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ def has_permission(self, request, view):
3232
return True
3333

3434
if hasattr(token, "scope"): # OAuth 2
35+
token_scopes = token.scope.split()
3536
scopes = list(ProtectedCapability.objects.filter(
36-
slug__in=token.scope.split()
37+
slug__in=token_scopes
3738
).values_list('protected_resources', flat=True).all())
3839

3940
# this is a shorterm fix to reject all tokens that do not have either
4041
# patient/coverage.read or patient/ExplanationOfBenefit.read
41-
if ("patient/Coverage.read" or "patient/ExplanationOfBenefit.read") in token.scope.split():
42+
if ("patient/Coverage.read" in token_scopes) or ("patient/ExplanationOfBenefit.read" in token_scopes):
4243
for scope in scopes:
4344
for method, path in json.loads(scope):
4445
if method != request.method:

0 commit comments

Comments
 (0)