-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feature - Permit Bulk Export on Compartment by FHIR Query #7310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jdar8
wants to merge
28
commits into
rel_8_6
Choose a base branch
from
jd-20251017-bulk-export-permissions
base: rel_8_6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6bba3cb
draft implementation - no support for typefilter yet
f795113
revise and create draft of new permissions arg format w/ implied reso…
4d57ea8
add new rule for group query, with tests
c80280d
Merge branch 'master' into jd-20251017-bulk-export-permissions
384ff31
- formatting
e070201
add Group rule builder code
33d0df7
implement basic Patient rule with tests
5575871
Implement rule building for patient by matcher
6ff269b
spotless
6c5d860
type level ITs, fix some tests and bugs
640c9ef
spotless
2f02a09
add javadocs, remove unused code after some design changes, updated s…
10fd885
spotless
af123a9
round 2 - add javadocs, remove unused code after some design changes,…
bd3ca50
round 4 - add javadocs, remove unused code after some design changes,…
5873e18
round 5 - remove todos
0d906c4
changelogs, more java docs
78324a9
Merge remote-tracking branch 'origin/rel_8_6' into jd-20251017-bulk-e…
9727733
round 1 of addressing review comments
f8b3d41
spotless
7fdc3a4
refactor rule classes to have a base class for common logic
31d143c
spotless
17ed1ad
Revert "spotless"
5f52b36
Revert "refactor rule classes to have a base class for common logic"
5390b9b
round 2 - address code review comments
1f83598
spotless
b50a5aa
draft implementation of combining RuleBuilder apis
d558587
spotless
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...pi/fhir/changelog/8_6_0/7342-enhance-rulebuilder-to-support-compartments-by-matchers.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| type: add | ||
| issue: 7342 | ||
| title: "Enhanced the bulk export RuleBuilder code to support the identification of allowable Groups/Patients to export by a FHIR query matcher." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/interceptor/AuthResourceResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /*- | ||
| * #%L | ||
| * HAPI FHIR JPA Server | ||
| * %% | ||
| * Copyright (C) 2014 - 2025 Smile CDR, Inc. | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * #L% | ||
| */ | ||
| package ca.uhn.fhir.jpa.interceptor; | ||
|
|
||
| import ca.uhn.fhir.jpa.api.dao.DaoRegistry; | ||
| import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; | ||
| import ca.uhn.fhir.rest.api.Constants; | ||
| import ca.uhn.fhir.rest.api.server.SystemRequestDetails; | ||
| import ca.uhn.fhir.rest.param.TokenOrListParam; | ||
| import ca.uhn.fhir.rest.server.interceptor.auth.IAuthResourceResolver; | ||
| import org.hl7.fhir.instance.model.api.IBaseResource; | ||
| import org.hl7.fhir.instance.model.api.IIdType; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Small service class to inject DB access into an interceptor | ||
| * For example, used in bulk export security to allow querying for resource to match against permission argument filters | ||
| */ | ||
| public class AuthResourceResolver implements IAuthResourceResolver { | ||
| private final DaoRegistry myDaoRegistry; | ||
|
|
||
| public AuthResourceResolver(DaoRegistry myDaoRegistry) { | ||
| this.myDaoRegistry = myDaoRegistry; | ||
| } | ||
|
|
||
| public IBaseResource resolveResourceById(IIdType theResourceId) { | ||
| return myDaoRegistry | ||
| .getResourceDao(theResourceId.getResourceType()) | ||
| .read(theResourceId, new SystemRequestDetails()); | ||
| } | ||
jdar8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public List<IBaseResource> resolveResourcesByIds(List<String> theResourceIds, String theResourceType) { | ||
| TokenOrListParam t = new TokenOrListParam(null, theResourceIds.toArray(String[]::new)); | ||
|
|
||
| SearchParameterMap m = new SearchParameterMap(); | ||
| m.add(Constants.PARAM_ID, t); | ||
| return myDaoRegistry.getResourceDao(theResourceType).searchForResources(m, new SystemRequestDetails()); | ||
tadgh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/auth/IAuthResourceResolver.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /*- | ||
| * #%L | ||
| * HAPI FHIR - Server Framework | ||
| * %% | ||
| * Copyright (C) 2014 - 2025 Smile CDR, Inc. | ||
| * %% | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * #L% | ||
| */ | ||
| package ca.uhn.fhir.rest.server.interceptor.auth; | ||
|
|
||
| import org.hl7.fhir.instance.model.api.IBaseResource; | ||
| import org.hl7.fhir.instance.model.api.IIdType; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Small service class to inject DB access into an interceptor | ||
| * For example, used in bulk export security to allow querying for resource to match against permission argument filters | ||
| */ | ||
| public interface IAuthResourceResolver { | ||
| IBaseResource resolveResourceById(IIdType theResourceId); | ||
|
|
||
| /** | ||
| * Resolve a list of resources by ID. All resources should be the same type. | ||
| * @param theResourceIds the FHIR id of the resource(s) | ||
| * @param theResourceType the type of resource | ||
| * @return A list of resources resolved by ID | ||
| */ | ||
tadgh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| List<IBaseResource> resolveResourcesByIds(List<String> theResourceIds, String theResourceType); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me nervous. I get the design, but it's breaking the well-established pattern we have that auth interceptor doesn't resolve anything, it just looks at the data it's passed and makes a decision.
Instead of creating a loading infrastructure, could we add a new parameter object to
STORAGE_PRE_INITIATE_BULK_EXPORTso thatBulkExportJobServicecould handle loading the Group and pass it to AuthInterceptor as a part of the interceptor request? That way AuthInterceptor could look at it and make its decisions without needing to know how to fetch anything