Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 417e4ab

Browse files
Merge branch 'development' into feature-2528-campaign-diagram-percentages
2 parents 3a6f416 + 987f783 commit 417e4ab

365 files changed

Lines changed: 10796 additions & 1723 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ If you've never submitted an issue to the SORMAS repository before or this is yo
2424
* Device:
2525
* SORMAS version:
2626
* Android version/Browser:
27+
* Server URL:
28+
* User Role:
2729

2830
### Additional Information

SERVER_DEV_SETUP.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ Other steps :
4444
* Adjust the logging configuration in ``${HOME}/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender)
4545
* Build and deploy applications (ear and war) with you IDE.
4646

47+
## Keycloak
48+
49+
See [Keycloak](SERVER_SETUP.md#keycloak-server) for how to install Docker locally.
50+
51+
If you are doing active development on Keycloak (themes, authentication mechanisms, translations, etc.) it's recommended to install the standalone variant.
52+
4753

4854
## Other components
4955

SERVER_SETUP.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [Java 11](#java-11)
99
* [Postgres Database](#postgres-database)
1010
* [SORMAS Server](#sormas-server)
11+
* [Keycloak Server](#keycloak-server)
1112
* [Web Server Setup](#web-server-setup)
1213
* [Apache Web Server](#apache-web-server)
1314
* [Firewall](#firewall)
@@ -18,6 +19,7 @@
1819

1920
## Related
2021
* [Creating an App for a Demo Server](DEMO_APP.md)
22+
* [SORMAS Docker Repository](https://github.com/hzi-braunschweig/SORMAS-Docker)
2123

2224
## Prerequisites
2325

@@ -71,6 +73,62 @@
7173
* Adjust the logging configuration in ``/opt/domains/sormas/config/logback.xml`` based on your needs (e.g. configure and activate email appender)
7274
* Linux: [Update the SORMAS domain](SERVER_UPDATE.md)
7375

76+
## Keycloak Server
77+
78+
By default Keycloak is run as a Docker container, which can be set up in two ways:
79+
* As a Docker container
80+
* As a Standalone installation
81+
82+
### Keycloak as a Docker container
83+
*To be done only in the situation when SORMAS is already installed on the machine as a standalone installation.*
84+
85+
*For complete Docker setup see the [SORMAS-Docker](https://github.com/hzi-braunschweig/SORMAS-Docker/tree/keycloak-integration) repository.*
86+
87+
**Prerequisites**
88+
* SORMAS Server is installed
89+
* PostgreSQL is installed
90+
* Docker is installed
91+
* Open and edit [keycloak-setup.sh](sormas-base/setup/keycloak/keycloak-setup.sh) with your system's actual values
92+
93+
**Setup**
94+
* Run [keycloak-setup.sh](sormas-base/setup/keycloak/keycloak-setup.sh)
95+
* Update `sormas.properties` file in the SORMAS domain with the property `authentication.provider=KEYCLOAK`
96+
97+
98+
### Keycloak as a standalone installation
99+
100+
**Prerequisites**
101+
* SORMAS Server is installed
102+
* PostgreSQL is installed
103+
104+
**Setup**
105+
106+
Setting Keycloak up as a standalone installation [Server Installation and Configuration Guide](https://www.keycloak.org/docs/11.0/server_installation/#installation)
107+
* Make sure to configure Keycloak with PostgreSQL Database [Relational Database Setup](https://www.keycloak.org/docs/11.0/server_installation/#_database)
108+
* Setup an Admin User
109+
* Copy the `themes` folder content to `${KEYCLOAK_HOME}/themes` [Deploying Themes](https://www.keycloak.org/docs/11.0/server_development/#deploying-themes)
110+
* Create the SORMAS Realm by importing [SORMAS.json](sormas-base/setup/keycloak/SORMAS.json) see [Create a New Realm](https://www.keycloak.org/docs/11.0/server_admin/#_create-realm)
111+
* Update the `sormas-*` clients by generating new secrets for them
112+
* Update the realm's email settings to allow sending emails to users
113+
114+
To update the SORMAS Server run the following commands
115+
```shell script
116+
${ASADMIN} set-config-property --propertyName=payara.security.openid.clientSecret --propertyValue=${KEYCLOAK_SORMAS_UI_SECRET} --source=domain
117+
${ASADMIN} set-config-property --propertyName=payara.security.openid.clientId --propertyValue=sormas-ui --source=domain
118+
${ASADMIN} set-config-property --propertyName=payara.security.openid.scope --propertyValue=openid --source=domain
119+
${ASADMIN} set-config-property --propertyName=payara.security.openid.providerURI --propertyValue=http://localhost:${KEYCLOAK_PORT}/keycloak/auth/realms/SORMAS --source=domain
120+
${ASADMIN} set-config-property --propertyName=sormas.rest.security.oidc.json --propertyValue="{\"realm\":\"SORMAS\",\"auth-server-url\":\"http://localhost:${KEYCLOAK_PORT}/auth\",\"ssl-required\":\"external\",\"resource\":\"sormas-rest\",\"credentials\":{\"secret\":\"${KEYCLOAK_SORMAS_REST_SECRET}\"},\"confidential-port\":0,\"principal-attribute\":\"preferred_username\",\"enable-basic-auth\":true}" --source=domain
121+
${ASADMIN} set-config-property --propertyName=sormas.backend.security.oidc.json --propertyValue="{\"realm\":\"SORMAS\",\"auth-server-url\":\"http://localhost:${KEYCLOAK_PORT}/auth/\",\"ssl-required\":\"external\",\"resource\":\"sormas-backend\",\"credentials\":{\"secret\":\"${KEYCLOAK_SORMAS_BACKEND_SECRET}\"},\"confidential-port\":0}" --source=domain
122+
```
123+
where:
124+
* `${ASADMIN}` - represents the location to `${PAYARA_HOME}\bin\asadmin`
125+
* `${KEYCLOAK_PORT}` - the port on which keycloak will run
126+
* `${KEYCLOAK_SORMAS_UI_SECRET}` - is the secret generated in Keycloak for the `sormas-ui` client
127+
* `${KEYCLOAK_SORMAS_REST_SECRET}` - is the secret generated in Keycloack for the `sormas-rest` client
128+
* `${KEYCLOAK_SORMAS_BACKEND_SECRET}` - is the secret generated in Keycloack for the `sormas-backend` client
129+
130+
Then update `sormas.properties` file in the SORMAS domain with the property `authentication.provider=KEYCLOAK`
131+
74132
## Web Server Setup
75133

76134
### Apache Web Server

sormas-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<groupId>de.symeda.sormas</groupId>
44
<artifactId>sormas-base</artifactId>
5-
<version>1.49.0-SNAPSHOT</version>
5+
<version>1.50.0-SNAPSHOT</version>
66
<relativePath>../sormas-base</relativePath>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package de.symeda.sormas.api;
20+
21+
/**
22+
* Authentication provider which can be obtained trough the {@link ConfigFacade#getAuthenticationProvider()} property.
23+
*
24+
* @author Alex Vidrean
25+
* @since 13-Aug-20
26+
*/
27+
public class AuthProvider {
28+
29+
public static final String KEYCLOAK = "KEYCLOAK";
30+
31+
public static final String SORMAS = "SORMAS";
32+
33+
}

sormas-api/src/main/java/de/symeda/sormas/api/ConfigFacade.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,6 @@ public interface ConfigFacade {
103103
void validateExternalUrls();
104104

105105
Sormas2SormasConfig getSormas2SormasConfig();
106+
107+
String getAuthenticationProvider();
106108
}

sormas-api/src/main/java/de/symeda/sormas/api/action/ActionDto.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
import de.symeda.sormas.api.utils.Required;
3030

3131
public class ActionDto extends EntityDto {
32+
3233
private static final long serialVersionUID = 2439546041916003652L;
3334

3435
public static final String I18N_PREFIX = "Action";
36+
public static final String TITLE = "title";
3537
public static final String DESCRIPTION = "description";
3638
public static final String REPLY = "reply";
3739
public static final String PRIORITY = "priority";
@@ -51,6 +53,7 @@ public class ActionDto extends EntityDto {
5153
private Date statusChangeDate;
5254

5355
private UserReferenceDto creatorUser;
56+
private String title;
5457
private String description;
5558
private String reply;
5659
private UserReferenceDto replyingUser;
@@ -119,6 +122,14 @@ public void setCreatorUser(UserReferenceDto creatorUser) {
119122
this.creatorUser = creatorUser;
120123
}
121124

125+
public String getTitle() {
126+
return title;
127+
}
128+
129+
public void setTitle(String title) {
130+
this.title = title;
131+
}
132+
122133
public String getDescription() {
123134
return description;
124135
}

sormas-api/src/main/java/de/symeda/sormas/api/action/ActionFacade.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
import javax.ejb.Remote;
2424

25+
import de.symeda.sormas.api.event.EventActionIndexDto;
26+
import de.symeda.sormas.api.event.EventCriteria;
27+
import de.symeda.sormas.api.utils.SortProperty;
28+
2529
@Remote
2630
public interface ActionFacade {
2731

@@ -40,4 +44,8 @@ public interface ActionFacade {
4044
List<ActionStatEntry> getActionStats(ActionCriteria actionCriteria);
4145

4246
List<ActionDto> getActionList(ActionCriteria criteria, Integer first, Integer max);
47+
48+
List<EventActionIndexDto> getEventActionList(EventCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties);
49+
50+
long countEventAction(EventCriteria criteria);
4351
}

sormas-api/src/main/java/de/symeda/sormas/api/campaign/data/CampaignFormDataDto.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020

2121
package de.symeda.sormas.api.campaign.data;
2222

23+
import java.util.Date;
24+
import java.util.List;
25+
2326
import de.symeda.sormas.api.EntityDto;
27+
import de.symeda.sormas.api.ImportIgnore;
2428
import de.symeda.sormas.api.campaign.CampaignReferenceDto;
2529
import de.symeda.sormas.api.campaign.form.CampaignFormMetaReferenceDto;
2630
import de.symeda.sormas.api.region.CommunityReferenceDto;
@@ -29,9 +33,6 @@
2933
import de.symeda.sormas.api.user.UserReferenceDto;
3034
import de.symeda.sormas.api.utils.DataHelper;
3135

32-
import java.util.Date;
33-
import java.util.List;
34-
3536
public class CampaignFormDataDto extends EntityDto {
3637

3738
private static final long serialVersionUID = -8087195060395038093L;
@@ -71,6 +72,12 @@ public static CampaignFormDataDto build(
7172
return campaignFormData;
7273
}
7374

75+
public static CampaignFormDataDto build() {
76+
CampaignFormDataDto campaignFormData = new CampaignFormDataDto();
77+
campaignFormData.setUuid(DataHelper.createUuid());
78+
return campaignFormData;
79+
}
80+
7481
public List<CampaignFormDataEntry> getFormValues() {
7582
return formValues;
7683
}
@@ -79,6 +86,7 @@ public void setFormValues(List<CampaignFormDataEntry> formValues) {
7986
this.formValues = formValues;
8087
}
8188

89+
@ImportIgnore
8290
public CampaignFormMetaReferenceDto getCampaignFormMeta() {
8391
return campaignFormMeta;
8492
}
@@ -87,6 +95,7 @@ public void setCampaignFormMeta(CampaignFormMetaReferenceDto campaignFormMeta) {
8795
this.campaignFormMeta = campaignFormMeta;
8896
}
8997

98+
@ImportIgnore
9099
public CampaignReferenceDto getCampaign() {
91100
return campaign;
92101
}

sormas-api/src/main/java/de/symeda/sormas/api/campaign/data/CampaignFormDataEntry.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
package de.symeda.sormas.api.campaign.data;
1717

1818
import java.io.Serializable;
19+
import java.util.Collection;
20+
import java.util.Iterator;
21+
import java.util.List;
1922

2023
import de.symeda.sormas.api.i18n.I18nProperties;
2124
import de.symeda.sormas.api.i18n.Strings;
@@ -83,4 +86,15 @@ public String toString() {
8386

8487
return value.toString();
8588
}
89+
90+
public static void removeNullValueEntries(Collection<CampaignFormDataEntry> entries) {
91+
92+
Iterator<CampaignFormDataEntry> iterator = entries.iterator();
93+
while (iterator.hasNext()) {
94+
CampaignFormDataEntry entry = iterator.next();
95+
if (entry.value == null) {
96+
iterator.remove();
97+
}
98+
}
99+
}
86100
}

0 commit comments

Comments
 (0)