Authorization Interceptor to allow multiple compartments results

Skip to first unread message

Ajay shekar

unread,
Feb 17, 2021, 12:59:25 PM2/17/21
to HAPI FHIR
Hi,

I am using Hapi-Fhir version 5.3.0-SNAPSHOT. 
1.I have enforced multiple patient compartment(patient/ABC, Patient/DEF) in search narrowing interceptor by using AuthorizedList as - 

return new AuthorizedList()
.addCompartments("Patient/ABC","Patient/DEF");
This part works fine.

2.In similar fashion, I want Authorization Interceptor to enforce multiple patient compartment(Patient/ABC, Patient/DEF). My code looks like 

return new RuleBuilder()
.allow().read().allResources().inCompartment("Patient", new IdType("Patient", "ABC")).andThen()
.allow().read().allResources().inCompartment("Patient",new IdType("Patient", "DEF")).andThen()
.build();

This part throws error - Access denied by default policy (no applicable rules)

My expectation is to get all Encounter resources belonging to both Patient(Patient/ABC, Patient/DEF) compartments.

What am i missing here ? How to make rules in Authorization Interceptor to access multiple compartments results at same time ? 

James Agnew

unread,
Feb 17, 2021, 1:03:48 PM2/17/21
to Ajay shekar, HAPI FHIR
That combination of rules will allow results that belong to either compartment (ABC or DEF or both). It doesn't require resources to be in both- there isn't currently a  way of doing this, and I've never actually heard of anyone needing this before today. Feel free to file an enhancement request, or to submit a PR for supporting the "both" option.

Cheers,
James


--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/76f8039a-ff9b-447c-8241-34733ce57a81n%40googlegroups.com.

Ajay shekar

unread,
Feb 22, 2021, 11:21:54 AM2/22/21
to HAPI FHIR
Thanks James, for your response.
Reply all
Reply to author
Forward
0 new messages