Skip to content

Commit

Permalink
[GITFLOW]merging 'release-1.69.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Mar 4, 2022
2 parents 947ba0d + 6a48eca commit 4943fea
Show file tree
Hide file tree
Showing 793 changed files with 13,232 additions and 6,716 deletions.
2 changes: 1 addition & 1 deletion openapi/external_visits_API.json

Large diffs are not rendered by default.

49 changes: 29 additions & 20 deletions openapi/external_visits_API.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ info:
\ symptom journals. it is not contact or case specific.<br><br><b>Configuration\
\ in SORMAS</b><br>In the domain folder, there is a sormas.properties. it holds\
\ the following values relevant for an external journal:<br>``interface.patientdiary.authurl``:\
\ used to fetch an authentication token (see 1. below).<br>``interface.patientdiary.probandsurl``:\
\ used to fetch an authentication token (see 1. below).<br>``interface.patientdiary.frontendAuthurl``:\
\ URL used to retrieve tokens for frontend requests. If not specified, no tokens\
\ will be fetched for such.<br>``interface.patientdiary.tokenLifetime``: Lifetime\
\ of tokens fetched via the authurl or the frontendAuthurl. To be specified in\
\ seconds. Can be set to 0 for no token caching. Defaults to 21600 (6 hrs.).<br>``interface.patientdiary.probandsurl``:\
\ used to register new persons in the external journal (see 2. below).<br>``interface.patientdiary.url``:\
\ used to open a person in the external journal (see 6. below).<br>``interface.patientdiary.email``:\
\ used to authenticate at the external journal (see 1. below).<br>``interface.patientdiary.password``:\
Expand All @@ -59,21 +63,25 @@ info:
\ specified in the sormas.properties<br>Expected response body:<br>{<br>&emsp;&emsp;\"\
success\" : true,<br>&emsp;&emsp;\"userId\" : [some-user-id],<br>&emsp;&emsp;\"\
token\" : [token]<br>}<br>The token returned will be used to authenticate in other\
\ requests.<br><br><li><b>Registration of a new person in the external journal</b></li><br>This\
\ process involves several steps that are triggered via the REGISTER button a\
\ privileged user can see in the top right corner when having opened a case or\
\ a contact.<br>To be able to see this button, the user must have at least one\
\ of the following user roles: national user, contact supervisor, contact officer,\
\ community officer,surveillance officer, surveillance supervisor, or admin supervisor.<br><br>First\
\ comes a SORMAS-internal validation of contact details. The person to be registered\
\ needs to have at least an email address (or a phone number if that is accepted\
\ for registration, see ``interface.patientdiary.acceptPhoneContact``) to pass\
\ this validation.Also, when there are several email addresses or phone numbers,\
\ one of them has to be marked primary contact detail, so that it is clear which\
\ contact detail shall be used.<br><br>Then comes an external validation of the\
\ contact details. For this, SORMAS fetches an authentication token as in 1. Then\
\ it sends a GET request to the following URL for each contact detail to be used\
\ in the external journal:<br><tt>GET [interface.patientdiary.probandsurl]/probands?q=[URL-encoded-query-parameter-and-value]'</tt>,\
\ requests. Its lifetime can be configured via the ``interface.patientdiary.tokenLifetime``\
\ property.<br>One special scenario is fetching a token for frontend calls (see\
\ 6.): When the interface.patientdiary.frontendAuthurl is configured, it is used\
\ instead of the interface.patientdiary.authurl here. If it is not configured,\
\ no token will be used.<br><br><li><b>Registration of a new person in the external\
\ journal</b></li><br>This process involves several steps that are triggered via\
\ the REGISTER button a privileged user can see in the top right corner when having\
\ opened a case or a contact.<br>To be able to see this button, the user must\
\ have at least one of the following user roles: national user, contact supervisor,\
\ contact officer, community officer,surveillance officer, surveillance supervisor,\
\ or admin supervisor.<br><br>First comes a SORMAS-internal validation of contact\
\ details. The person to be registered needs to have at least an email address\
\ (or a phone number if that is accepted for registration, see ``interface.patientdiary.acceptPhoneContact``)\
\ to pass this validation.Also, when there are several email addresses or phone\
\ numbers, one of them has to be marked primary contact detail, so that it is\
\ clear which contact detail shall be used.<br><br>Then comes an external validation\
\ of the contact details. For this, SORMAS fetches an authentication token as\
\ in 1. Then it sends a GET request to the following URL for each contact detail\
\ to be used in the external journal:<br><tt>GET [interface.patientdiary.probandsurl]/probands?q=[URL-encoded-query-parameter-and-value]'</tt>,\
\ with a header like <tt>'x-access-token: [token]'</tt><br>The [URL-encoded-query-parameter-and-value]\
\ consists of a parameter-value-pair. The parameter is either 'Email' or 'Mobile\
\ phone'. The value holds the contact detail to be validated.<br>An unencoded\
Expand Down Expand Up @@ -159,10 +167,11 @@ info:
\ but the options to open the person in the external journal and to cancel external\
\ follow up. This button can be found when having opened a contact (or a case\
\ if the case follow up feature is enabled in SORMAS) in the top right corner.\
\ If the user choses to open the person in the external journal, SORMAS fetches\
\ an authentication token as described in 1. and opens a new browser tab with\
\ the following URL:<br><tt>[interface.patientdiary.url]/data?q=[personUuid]&queryKey=sicFieldIdentifier&token=[token]</tt><br>SORMAS\
\ expects the external journal to present a view of the person there.<br><br><li><b>Deletion\
\ If the user chooses to open the person in the external journal, SORMAS opens\
\ a new browser tab with the following URL:<br><tt>[interface.patientdiary.url]/data?q=[personUuid]&queryKey=sicFieldIdentifier</tt><br>SORMAS\
\ expects the external journal to present a view of the person there.<br>If the\
\ interface.patientdiary.frontendAuthurl is configured, SORMAS fetches an authentication\
\ token as described in 1, and appends it to the URL:<br><tt>[interface.patientdiary.url]/data?q=[personUuid]&queryKey=sicFieldIdentifier&token=[token]</tt><br><br><li><b>Deletion\
\ of a person from an external journal</b></li><br>As described above, the journal\
\ button can offer the option to cancel external follow up. If a user choses this\
\ option, SORMAS fetches an authentication token as described in 1., and uses\
Expand Down
24 changes: 7 additions & 17 deletions sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.68.3</version>
<version>1.69.0</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -11,22 +11,12 @@

<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/version.txt</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/version.txt</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<properties>
Expand Down
115 changes: 51 additions & 64 deletions sormas-api/src/main/java/de/symeda/sormas/api/AuthProvider.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Expand All @@ -22,84 +19,74 @@
* Authentication provider which can be configured trough the {@link ConfigFacade#getAuthenticationProvider()} property.
* Once initialized it provides Auth Provider specific authentication configs like:
* <ul>
* <li>is user name case sensitive</li>
* <li>is email required</li>
* <li>is user name case sensitive</li>
* <li>is email required</li>
* </ul>
*
* @author Alex Vidrean
* @since 13-Aug-20
*/
public class AuthProvider {

public static final String KEYCLOAK = "KEYCLOAK";
public static final String KEYCLOAK = "KEYCLOAK";

public static final String SORMAS = "SORMAS";
public static final String SORMAS = "SORMAS";

private static AuthProvider provider;
private static AuthProvider provider;

private final boolean isUsernameCaseSensitive;
private final boolean isDefaultProvider;

private final boolean isDefaultProvider;
private final boolean isUserSyncSupported;

private final boolean isUserSyncSupported;
private final boolean isUserSyncAtStartupEnabled;

private final boolean isUserSyncAtStartupEnabled;

private final String name;
private final String name;

private AuthProvider(ConfigFacade configFacade) {
String configuredProvider = configFacade.getAuthenticationProvider();
isUsernameCaseSensitive = SORMAS.equalsIgnoreCase(configuredProvider);
isDefaultProvider = SORMAS.equalsIgnoreCase(configuredProvider);
isUserSyncSupported = KEYCLOAK.equalsIgnoreCase(configuredProvider);
isUserSyncAtStartupEnabled = isUserSyncSupported && configFacade.isAuthenticationProviderUserSyncAtStartupEnabled();
name = configuredProvider;
}
isDefaultProvider = SORMAS.equalsIgnoreCase(configuredProvider);
isUserSyncSupported = KEYCLOAK.equalsIgnoreCase(configuredProvider);
isUserSyncAtStartupEnabled = isUserSyncSupported && configFacade.isAuthenticationProviderUserSyncAtStartupEnabled();
name = configuredProvider;
}

public static AuthProvider getProvider(ConfigFacade configFacade) {
if (provider == null) {
synchronized (AuthProvider.class) {
if (provider == null) {
if (provider == null) {
synchronized (AuthProvider.class) {
if (provider == null) {
provider = new AuthProvider(configFacade);
}
}
}
return provider;
}

/**
* Authentication Provider requires usernames to be case sensitive or insensitive
*/
public boolean isUsernameCaseSensitive() {
return isUsernameCaseSensitive;
}

/**
* Current Authentication Provider is the SORMAS default one.
*/
public boolean isDefaultProvider() {
return isDefaultProvider;
}

/**
* Authentication Provider enables users to be synced from the default provider.
*/
public boolean isUserSyncSupported() {
return isUserSyncSupported;
}

/**
* Even if the Authentication Provider supports user sync, the user sync at startup might be disabled for startup performance reasons.
* If user sync is not supported, this will always return false.
*/
public boolean isUserSyncAtStartupEnabled() {
return isUserSyncAtStartupEnabled;
}

/**
* Name of the active Authentication Provider.
*/
public String getName() {
return name;
}
}
}
}
return provider;
}

/**
* Current Authentication Provider is the SORMAS default one.
*/
public boolean isDefaultProvider() {
return isDefaultProvider;
}

/**
* Authentication Provider enables users to be synced from the default provider.
*/
public boolean isUserSyncSupported() {
return isUserSyncSupported;
}

/**
* Even if the Authentication Provider supports user sync, the user sync at startup might be disabled for startup performance reasons.
* If user sync is not supported, this will always return false.
*/
public boolean isUserSyncAtStartupEnabled() {
return isUserSyncAtStartupEnabled;
}

/**
* Name of the active Authentication Provider.
*/
public String getName() {
return name;
}
}
10 changes: 3 additions & 7 deletions sormas-api/src/main/java/de/symeda/sormas/api/BaseFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
import java.util.Date;
import java.util.List;

import javax.ejb.Remote;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import de.symeda.sormas.api.utils.SortProperty;
import de.symeda.sormas.api.utils.criteria.BaseCriteria;

public interface BaseFacade<DTO extends EntityDto, INDEX_DTO extends Serializable, REF_DTO extends ReferenceDto, CRITERIA extends BaseCriteria> {

DTO save(@Valid DTO dto);

DTO save(@Valid DTO dtoToSave, boolean allowMerge);

void archive(String uuid);

void dearchive(String uuid);
DTO save(@Valid @NotNull DTO dto);

long count(CRITERIA criteria);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public interface ConfigFacade {

int getDaysAfterEventGetsArchived();

int getDaysAfterEventParticipantGetsArchived();

int getDaysAfterSystemEventGetsDeleted();

int getDaysAfterTravelEntryGetsArchived();
Expand All @@ -100,6 +102,10 @@ public interface ConfigFacade {

boolean isMapUseCountryCenter();

String getMapTilersUrl();

String getMapTilersAttribution();

int getMapZoom();

String getGeocodingServiceUrlTemplate();
Expand Down
44 changes: 44 additions & 0 deletions sormas-api/src/main/java/de/symeda/sormas/api/CoreFacade.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2022 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/

package de.symeda.sormas.api;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import de.symeda.sormas.api.deletionconfiguration.AutomaticDeletionInfoDto;
import de.symeda.sormas.api.utils.criteria.BaseCriteria;

public interface CoreFacade<DTO extends EntityDto, INDEX_DTO extends Serializable, REF_DTO extends ReferenceDto, CRITERIA extends BaseCriteria>
extends BaseFacade<DTO, INDEX_DTO, REF_DTO, CRITERIA> {

boolean isArchived(String uuid);

boolean exists(String uuid);

List<DTO> getAllAfter(Date date, Integer batchSize, String lastSynchronizedUuid);

AutomaticDeletionInfoDto getAutomaticDeletionInfo(String uuid);

void archive(String entityUuid, Date endOfProcessingDate);

void archive(List<String> entityUuid);

void dearchive(List<String> entityUuids, String dearchiveReason);

Date calculateEndOfProcessingDate(String entityUuids);
}
Original file line number Diff line number Diff line change
@@ -1,45 +1,23 @@
package de.symeda.sormas.api.campaign;

import java.util.Date;
import java.util.List;

import javax.ejb.Remote;
import javax.validation.Valid;

import de.symeda.sormas.api.CoreFacade;
import de.symeda.sormas.api.campaign.diagram.CampaignDashboardElement;
import de.symeda.sormas.api.utils.SortProperty;

@Remote
public interface CampaignFacade {

List<CampaignIndexDto> getIndexList(CampaignCriteria campaignCriteria, Integer first, Integer max, List<SortProperty> sortProperties);
public interface CampaignFacade extends CoreFacade<CampaignDto, CampaignIndexDto, CampaignReferenceDto, CampaignCriteria> {

List<CampaignReferenceDto> getAllActiveCampaignsAsReference();

CampaignReferenceDto getLastStartedCampaign();

long count(CampaignCriteria campaignCriteria);

CampaignDto saveCampaign(@Valid CampaignDto dto);

CampaignDto getByUuid(String uuid);

List<CampaignDashboardElement> getCampaignDashboardElements(String campaignUuid);

boolean isArchived(String uuid);

void deleteCampaign(String uuid);

void archiveOrDearchiveCampaign(String campaignUuid, boolean archive);

CampaignReferenceDto getReferenceByUuid(String uuid);

boolean exists(String uuid);

List<CampaignDto> getAllAfter(Date campaignChangeDate);

List<CampaignDto> getByUuids(List<String> uuids);

List<String> getAllActiveUuids();

void validate(CampaignReferenceDto campaignReferenceDto);
Expand Down
Loading

0 comments on commit 4943fea

Please sign in to comment.