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 #2777 - bulkdata authz enforcement in fhir-smart #2785

Merged
merged 9 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.ibm.fhir.model.resource.Resource;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.search.SearchConstants;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

/**
* This is an implementation of a retrieve provider for the CQL Engine that uses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.ibm.fhir.model.type.Uri;
import com.ibm.fhir.model.type.code.ResourceType;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;
import com.ibm.fhir.term.service.FHIRTermService;
import com.ibm.fhir.term.service.LookupOutcome;
import com.ibm.fhir.term.service.ValidationOutcome;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import com.ibm.fhir.model.type.code.BundleType;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.persistence.exception.FHIRPersistenceResourceNotFoundException;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class ServerFHIRRetrieveProviderTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.ibm.fhir.model.type.Uri;
import com.ibm.fhir.model.type.code.PublicationStatus;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;
import com.ibm.fhir.term.service.FHIRTermService;
import com.ibm.fhir.term.service.LookupOutcome;
import com.ibm.fhir.term.service.ValidationOutcome;
Expand Down
9 changes: 8 additions & 1 deletion cql/operation/fhir-operation-apply/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>fhir-server</artifactId>
<artifactId>fhir-server-spi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>fhir-persistence</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
import com.ibm.fhir.model.type.code.IssueSeverity;
import com.ibm.fhir.model.type.code.IssueType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.AbstractOperation;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.util.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.AbstractOperation;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

/**
* <code>$apply</code> is an operation specific to PlanDefinition.
Expand Down
4 changes: 3 additions & 1 deletion cql/operation/fhir-operation-cpg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-model</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-server</artifactId>
<artifactId>fhir-server-spi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import com.ibm.fhir.model.resource.Library;
import com.ibm.fhir.model.resource.Parameters;
import com.ibm.fhir.model.resource.Parameters.Parameter;
import com.ibm.fhir.server.operation.spi.AbstractOperation;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.AbstractOperation;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public abstract class AbstractCqlOperation extends AbstractOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
import com.ibm.fhir.model.type.code.PublicationStatus;
import com.ibm.fhir.model.type.code.RelatedArtifactType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class CqlOperation extends AbstractCqlOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import com.ibm.fhir.model.type.code.ResourceType;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class LibraryEvaluateOperation extends AbstractCqlOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import com.ibm.fhir.model.resource.Resource;
import com.ibm.fhir.model.type.code.OperationKind;
import com.ibm.fhir.model.type.code.PublicationStatus;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class AbstractCqlOperationTest extends BaseCqlOperationTest<AbstractCqlOperation> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import static com.ibm.fhir.cql.helpers.ModelHelper.concept;
import static com.ibm.fhir.cql.helpers.ModelHelper.fhirboolean;
import static com.ibm.fhir.cql.helpers.ModelHelper.fhirstring;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
Expand All @@ -20,12 +18,14 @@
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.fail;

import javax.ws.rs.core.MultivaluedMap;

import org.testng.annotations.Test;
import org.mockito.MockedStatic;
import org.testng.annotations.Test;

import com.ibm.fhir.cql.Constants;
import com.ibm.fhir.cql.helpers.LibraryHelper;
Expand All @@ -45,8 +45,8 @@
import com.ibm.fhir.model.type.code.EncounterStatus;
import com.ibm.fhir.model.type.code.IssueType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class CqlOperationTest extends BaseCqlOperationTest<CqlOperation> {

Expand All @@ -63,8 +63,15 @@ public void testInlineExpression() throws Exception {
String encounterCode = "office-visit";
Coding reason = coding(codesystem, encounterCode);

Encounter encounter =
Encounter.builder().reasonCode(concept(reason)).status(EncounterStatus.FINISHED).clazz(reason).period(Period.builder().start(DateTime.now()).end(DateTime.now()).build()).build();
Encounter encounter = Encounter.builder()
.reasonCode(concept(reason))
.status(EncounterStatus.FINISHED)
.clazz(reason)
.period(Period.builder()
.start(DateTime.now())
.end(DateTime.now())
.build())
.build();

String expression = "[Encounter] e where e.status = 'finished'";

Expand All @@ -85,7 +92,7 @@ public void testInlineExpression() throws Exception {

// when(mockRegistry.getResource(javastring(fhirHelpers.getUrl()), Library.class)).thenReturn(fhirHelpers);

FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext();
FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext(null);
Parameters result = getOperation().doInvoke(ctx, null, null, null, parameters, resourceHelper);
assertNotNull(result);

Expand Down Expand Up @@ -136,7 +143,7 @@ public void testInlineExpressionWithIncludes() throws Exception {
canonical = ModelHelper.canonical(modelInfo.getUrl(), modelInfo.getVersion());
when(mockRegistry.getResource(canonical.getValue(), Library.class)).thenReturn(modelInfo);

FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext();
FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext("cql");
getOperation().doInvoke(ctx, null, null, null, parameters, resourceHelper);
}
}
Expand All @@ -158,7 +165,7 @@ public void testInlineExpressionInvalid() throws Exception {
FHIRRegistry mockRegistry = spy(FHIRRegistry.class);
staticRegistry.when(FHIRRegistry::getInstance).thenReturn(mockRegistry);

FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext();
FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext("cql");
getOperation().doInvoke(ctx, null, null, null, parameters, resourceHelper);
fail("Missing expected Exception");
} catch (FHIROperationException fex) {
Expand Down Expand Up @@ -189,7 +196,7 @@ public void testInlineExpressionWithDebug() throws Exception {
FHIRRegistry mockRegistry = spy(FHIRRegistry.class);
staticRegistry.when(FHIRRegistry::getInstance).thenReturn(mockRegistry);

FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext();
FHIROperationContext ctx = FHIROperationContext.createSystemOperationContext("cql");
Parameters result = getOperation().doInvoke(ctx, null, null, null, parameters, resourceHelper);

assertNotNull(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import com.ibm.fhir.model.type.code.EncounterStatus;
import com.ibm.fhir.model.type.code.ProcedureStatus;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class LibraryEvaluateOperationTest extends BaseCqlOperationTest<LibraryEvaluateOperation> {

Expand Down
9 changes: 9 additions & 0 deletions cql/operation/fhir-operation-cqf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,21 @@
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-model</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-server-spi</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-search</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import com.ibm.fhir.model.type.RelatedArtifact;
import com.ibm.fhir.model.type.code.PublicationStatus;
import com.ibm.fhir.model.type.code.RelatedArtifactType;
import com.ibm.fhir.server.operation.spi.AbstractOperation;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.util.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.AbstractOperation;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public abstract class AbstractDataRequirementsOperation extends AbstractOperation {
public static final String PARAM_OUT_RETURN = "return";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import com.ibm.fhir.model.resource.Patient;
import com.ibm.fhir.model.type.Date;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.AbstractOperation;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.AbstractOperation;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public abstract class AbstractMeasureOperation extends AbstractOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import com.ibm.fhir.model.type.code.ResourceType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.search.SearchConstants;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.util.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class CareGapsOperation extends AbstractMeasureOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import com.ibm.fhir.model.type.code.ResourceType;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.util.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class EvaluateMeasureOperation extends AbstractMeasureOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import com.ibm.fhir.model.type.code.ResourceType;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class LibraryDataRequirementsOperation extends AbstractDataRequirementsOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import com.ibm.fhir.model.util.ModelSupport.ElementInfo;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class MeasureCollectDataOperation extends EvaluateMeasureOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.ibm.fhir.model.type.code.ResourceType;
import com.ibm.fhir.persistence.SingleResourceResult;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class MeasureDataRequirementsOperation extends AbstractDataRequirementsOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import com.ibm.fhir.model.type.code.BundleType;
import com.ibm.fhir.model.type.code.HTTPVerb;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.AbstractOperation;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.util.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.AbstractOperation;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIROperationUtil;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public class MeasureSubmitDataOperation extends AbstractOperation {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import com.ibm.fhir.model.type.code.PublicationStatus;
import com.ibm.fhir.model.type.code.RelatedArtifactType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
import com.ibm.fhir.server.spi.operation.FHIROperationContext;
import com.ibm.fhir.server.spi.operation.FHIRResourceHelpers;

public abstract class BaseDataRequirementsOperationTest {

Expand Down
Loading