Skip to content
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

issue #3495 - more selectively scope searches to patient compartment #3498

Merged
merged 3 commits into from
Mar 31, 2022

Conversation

lmsurpre
Copy link
Member

@lmsurpre lmsurpre commented Mar 23, 2022

Specifically, avoid adding the implicit compartment parameter(s) when
the interaction is allowed by one or more scopes with the 'user/' or
'system/' prefix ("context type")

Signed-off-by: Lee Surprenant lmsurpre@us.ibm.com

Specifically, avoid adding the implicit compartment parameter(s) when
the interaction is covered by one or more tokens with the 'user/' or
'system/' prefix ("context type")

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
@lmsurpre lmsurpre requested review from punktilious and tbieste March 23, 2022 03:37
.filter(s -> s.getResourceType() == ResourceType.Value.RESOURCE || s.getResourceType().value().equals(resourceType))
.filter(s -> hasPermission(s.getPermission(), requiredPermission))
.findAny();

if (resource == null) {
// For `patient` scopes, if no resource was retrieved, which happens with history/search
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about deleted resources? The resource value will be null for those too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't call this from afterDelete, but we do call it from afterHistory and so I agree this is worth testing...I'll give it a try and maybe add a test

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't really from this PR, but instead from #3423
however, i confirmed that, with those changes, we now reject a history interaction if any one of the resource versions in the history was a delete...i'll see if i can address that in this PR. if not, i'll open a separate issue for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes to try addressing this one. please have another look

Copy link
Collaborator

@punktilious punktilious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in the file, therefor should be therefore

Also addressed review comments by adding class-level javadoc

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
@lmsurpre lmsurpre force-pushed the issue-3495 branch 2 times, most recently from dbbb102 to 7ad8f13 Compare March 24, 2022 04:55
This fixes an issue that we introduced with #3423 where we reject
history interactions that include one or more DELETE entries in their
response bundle (because we cannot check them for patient compartment
membership since they contain no resource content).

However, now that we reject history interactions that involve patient
compartment resource types (unless the approving scope is of type 'user'
or 'system'), it should always be safe to ignore the delete entries in
the afterHistory call.

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Copy link
Collaborator

@punktilious punktilious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lmsurpre lmsurpre merged commit 424888d into main Mar 31, 2022
@lmsurpre lmsurpre deleted the issue-3495 branch March 31, 2022 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants