Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hotfix/1.0.0.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hhund committed Sep 13, 2023
2 parents 3e1d4f5 + e187996 commit 33df4a8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

<groupId>dev.dsf</groupId>
<artifactId>dsf-process-allow-list</artifactId>
<version>1.0.0.0</version>
<version>1.0.0.1</version>
<packaging>jar</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compileSource>17</compileSource>
<compileTarget>17</compileTarget>

<dsf.version>1.1.0</dsf.version>
<dsf.version>1.2.0</dsf.version>
<dsf.location>../dsf</dsf.location>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

public class AllowListProcessPluginDefinition implements ProcessPluginDefinition
{
public static final String VERSION = "1.0.0.0";
public static final LocalDate RELEASE_DATE = LocalDate.of(2023, 8, 22);
public static final String VERSION = "1.0.0.1";
public static final LocalDate RELEASE_DATE = LocalDate.of(2023, 9, 14);

@Override
public String getName()
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/dev/dsf/bpe/service/CheckAllowList.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.OrganizationAffiliation;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.ResourceType;
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.Task;
import org.slf4j.Logger;
Expand Down Expand Up @@ -76,10 +77,17 @@ private Predicate<BundleEntryComponent> entryNotAllowedWithError(Task task, Stri
private boolean resourceNotAllowedWithError(BundleEntryComponent entry, Task task, String bundleUrl)
{
Resource resource = entry.getResource();
boolean resourceAllowed = (resource instanceof Organization || resource instanceof OrganizationAffiliation
|| resource instanceof Endpoint);

if (!resourceAllowed)
boolean resourceAllowed = (HTTPVerb.DELETE.equals(entry.getRequest().getMethod())
&& (entry.getRequest().getUrl().startsWith(ResourceType.Organization.name())
|| entry.getRequest().getUrl().startsWith(ResourceType.OrganizationAffiliation.name())
|| entry.getRequest().getUrl().startsWith(ResourceType.Endpoint.name())))
|| (resource instanceof Organization || resource instanceof OrganizationAffiliation
|| resource instanceof Endpoint);

if (HTTPVerb.DELETE.equals(entry.getRequest().getMethod()) && !resourceAllowed)
addError(task, "Resource delete of '" + entry.getRequest().getUrl() + "' not allowed in Bundle with id '"
+ bundleUrl + "'");
else if (!HTTPVerb.DELETE.equals(entry.getRequest().getMethod()) && !resourceAllowed)
addError(task, "Resource of type '" + resource.getResourceType().name()
+ "' not allowed in Bundle with id '" + bundleUrl + "'");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class AllowListConfig
{
@Autowired
ProcessPluginApi api;
private ProcessPluginApi api;

@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
Expand Down

0 comments on commit 33df4a8

Please sign in to comment.