Skip to content

Commit ea00d2b

Browse files
authored
BB2-3720: Add v2 scopes (#1305)
* Adds v2 scopes * Tweaked scopes * Added capability update * Fixed titles in scopes.json. * Fix comment typo * Corrected default settings and added to personal scopes * Addressed feedback * Added A.D.'s clarifications * Added test case for new scopes. fixed outstanding typos
1 parent 78b7ed6 commit ea00d2b

File tree

11 files changed

+468
-23
lines changed

11 files changed

+468
-23
lines changed

apps/accounts/fixtures/scopes.json

Lines changed: 121 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"slug": "token_management",
6464
"group": 5,
6565
"description": "Allow an app to manage all of a user's tokens.",
66-
"protected_resources": "[]",
6766
"protected_resources": "[[\"GET\", \"/some-url\"]]",
6867
"default": "False"
6968
}
@@ -76,7 +75,6 @@
7675
"slug": "token_introspect",
7776
"group": 5,
7877
"description": "Allow an app to introspect a user's tokens.",
79-
"protected_resources": "[]",
8078
"protected_resources": "[[\"POST\", \"/v[12]/o/introspect\"]]",
8179
"default": "False"
8280
}
@@ -85,12 +83,132 @@
8583
"model": "capabilities.protectedcapability",
8684
"pk": 7,
8785
"fields": {
88-
"title": "openid",
86+
"title": "Openid profile permissions.",
8987
"slug": "openid",
9088
"group": 5,
9189
"description": "Enables user authentication and provides a unique identifier with basic profile info.",
9290
"protected_resources": "[]",
9391
"default": "True"
9492
}
93+
},
94+
{
95+
"model": "capabilities.protectedcapability",
96+
"pk": 8,
97+
"fields": {
98+
"title": "Read my general patient and demographic information.",
99+
"slug": "patient/Patient.r",
100+
"group": 5,
101+
"description": "Patient FHIR Resource",
102+
"protected_resources": "[\n \n [\n \"GET\",\n \"/v[12]/fhir/Patient[/?].*$\"\n ]\n]",
103+
"default": "False"
104+
}
105+
},
106+
{
107+
"model": "capabilities.protectedcapability",
108+
"pk": 9,
109+
"fields": {
110+
"title": "Search my general patient and demographic information.",
111+
"slug": "patient/Patient.s",
112+
"group": 5,
113+
"description": "Patient FHIR Resource",
114+
"protected_resources": "[\n [\n \"GET\",\n \"/v[12]/fhir/Patient[/]?$\"\n ]\n]",
115+
"default": "False"
116+
}
117+
},
118+
{
119+
"model": "capabilities.protectedcapability",
120+
"pk": 10,
121+
"fields": {
122+
"title": "Read and search my general patient and demographic information.",
123+
"slug": "patient/Patient.rs",
124+
"group": 5,
125+
"description": "Patient FHIR Resource",
126+
"protected_resources": "[\n [\n \"GET\",\n \"/v[12]/fhir/Patient[/]?$\"\n ],\n [\n \"GET\",\n \"/v[12]/fhir/Patient[/?].*$\"\n ]\n]",
127+
"default": "False"
128+
}
129+
},
130+
{
131+
"model": "capabilities.protectedcapability",
132+
"pk": 11,
133+
"fields": {
134+
"title": "Read my Medicare claim information.",
135+
"slug": "patient/ExplanationOfBenefit.r",
136+
"group": 5,
137+
"description": "ExplanationOfBenefit FHIR Resource",
138+
"protected_resources": "[\n \n [\n \"GET\",\n \"/v[12]/fhir/ExplanationOfBenefit[/?].*$\"\n ]\n]",
139+
"default": "False"
140+
}
141+
},
142+
{
143+
"model": "capabilities.protectedcapability",
144+
"pk": 12,
145+
"fields": {
146+
"title": "Search my Medicare claim information.",
147+
"slug": "patient/ExplanationOfBenefit.s",
148+
"group": 5,
149+
"description": "ExplanationOfBenefit FHIR Resource",
150+
"protected_resources": "[\n [\n \"GET\",\n \"/v[12]/fhir/ExplanationOfBenefit[/]?$\"\n ]\n]",
151+
"default": "False"
152+
}
153+
},
154+
{
155+
"model": "capabilities.protectedcapability",
156+
"pk": 13,
157+
"fields": {
158+
"title": "Read and search my Medicare claim information.",
159+
"slug": "patient/ExplanationOfBenefit.rs",
160+
"group": 5,
161+
"description": "ExplanationOfBenefit FHIR Resource",
162+
"protected_resources": "[\n [\n \"GET\",\n \"/v[12]/fhir/ExplanationOfBenefit[/]?$\"\n ],\n [\n \"GET\",\n \"/v[12]/fhir/ExplanationOfBenefit[/?].*$\"\n ]\n]",
163+
"default": "False"
164+
}
165+
},
166+
{
167+
"model": "capabilities.protectedcapability",
168+
"pk": 14,
169+
"fields": {
170+
"title": "Read my Medicare and supplemental coverage information.",
171+
"slug": "patient/Coverage.r",
172+
"group": 5,
173+
"description": "Coverage FHIR Resource",
174+
"protected_resources": "[\n \n [\n \"GET\",\n \"/v[12]/fhir/Coverage[/?].*$\"\n ]\n]",
175+
"default": "False"
176+
}
177+
},
178+
{
179+
"model": "capabilities.protectedcapability",
180+
"pk": 15,
181+
"fields": {
182+
"title": "Search my Medicare and supplemental coverage information.",
183+
"slug": "patient/Coverage.s",
184+
"group": 5,
185+
"description": "Coverage FHIR Resource",
186+
"protected_resources": "[\n [\n \"GET\",\n \"/v[12]/fhir/Coverage[/]?$\"\n ]\n]",
187+
"default": "False"
188+
}
189+
},
190+
{
191+
"model": "capabilities.protectedcapability",
192+
"pk": 16,
193+
"fields": {
194+
"title": "Read and search my Medicare and supplemental coverage information.",
195+
"slug": "patient/Coverage.rs",
196+
"group": 5,
197+
"description": "Coverage FHIR Resource",
198+
"protected_resources": "[\n [\n \"GET\",\n \"/v[12]/fhir/Coverage[/]?$\"\n ],\n [\n \"GET\",\n \"/v[12]/fhir/Coverage[/?].*$\"\n ]\n]",
199+
"default": "False"
200+
}
201+
},
202+
{
203+
"model": "capabilities.protectedcapability",
204+
"pk": 17,
205+
"fields": {
206+
"title": "Patient launch context.",
207+
"slug": "launch/patient",
208+
"group": 5,
209+
"description": "Launch with FHIR Patient context.",
210+
"protected_resources": "[]",
211+
"default": "False"
212+
}
95213
}
96214
]

apps/authorization/tests/test_data_access_grant_permissions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ def _assert_call_all_fhir_endpoints(
154154
The asserts will check for the expected_response_code
155155
and expected_response_detail_mesg to match.
156156
"""
157+
try:
158+
ac = AccessToken.objects.get(token=access_token)
159+
ac.scope = 'patient/Coverage.read patient/Patient.read patient/ExplanationOfBenefit.read'
160+
ac.save()
161+
except Exception:
162+
pass
163+
157164
# Test profile/userinfo v1
158165
response = self.client.get(
159166
"/v1/connect/userinfo", headers={"authorization": "Bearer " + access_token}

0 commit comments

Comments
 (0)