Skip to content

Commit bd76947

Browse files
committed
Merge branch 'hotfix-1.4.11'
2 parents 23002b4 + 07ab96d commit bd76947

Some content is hidden

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

53 files changed

+715
-251
lines changed

docs/customization.md

+9
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,15 @@ rdp.faq.answers.<q_key>=A plausible answer.
305305
The provided default file can be found
306306
in [faq.properties](https://github.com/PavlidisLab/rgr/tree/master/src/main/resources/faq.properties).
307307

308+
## Terms of service and privacy policy
309+
310+
The terms of service and privacy policy can be added to the `messages.properties` by editing the following entries:
311+
312+
```ini
313+
rdp.terms-of-service=Your terms of service
314+
rdp.privacy-policy=Your privacy policy
315+
```
316+
308317
## Style and static resources
309318

310319
Static resources can be selectively replaced by including a search directory for Spring static resources.

docs/installation.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ file that contains at least the following entries:
4141
```ini
4242
spring.profiles.active=prod
4343

44-
spring.datasource.url=jdbc:mysql://<database host>:3306/<database name>
45-
spring.datasource-driver-class-name=com.mysql.cj.jdbc.Driver
44+
spring.datasource.url=jdbc:mysql://<database host>/<database name>
45+
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
4646
spring.datasource.username=<database username>
4747
spring.datasource.password=<database password>
4848

@@ -52,6 +52,18 @@ spring.mail.username=<mail username>
5252
spring.mail.password=<mail password>
5353
spring.mail.properties.mail.smtp.auth=true
5454
spring.mail.properties.mail.smtp.starttls.enable=true
55+
56+
# Adjust this to your own network name
57+
rdp.site.fullname=Rare Disease Model & Mechanism Network
58+
rdp.site.shortname=RDMM
59+
60+
# This is very important for generating URLs
61+
rdp.host=https://register.example.com
62+
rdp.context=
63+
rdp.mainsite=https://example.com/
64+
65+
rdp.site.contact-email[email protected]
66+
rdp.site.admin-email[email protected]
5567
```
5668

5769
This file contains the database and SMTP credentials and various runtime configurations. Make sure it's only readable by

pom.xml

+8-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
<groupId>ubc.pavlab</groupId>
77
<artifactId>rdp</artifactId>
8-
<version>1.4.10</version>
8+
<version>1.4.11</version>
9+
10+
<description>
11+
Registry for model organism researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network.
12+
</description>
913

1014
<developers>
1115
<developer>
@@ -171,11 +175,11 @@
171175

172176
<properties>
173177
<java.version>1.8</java.version>
174-
<mysql.version>8.0.28</mysql.version>
178+
<mysql.version>8.0.29</mysql.version>
175179
<spring.version>4.3.30.RELEASE</spring.version>
176180
<!-- This specific version is hardened against JNDI-based attacks -->
177181
<logback.version>1.2.9</logback.version>
178-
<tomcat.version>8.5.75</tomcat.version>
182+
<tomcat.version>8.5.81</tomcat.version>
179183
</properties>
180184

181185
<build>
@@ -195,7 +199,7 @@
195199
<plugin>
196200
<groupId>com.amashchenko.maven.plugin</groupId>
197201
<artifactId>gitflow-maven-plugin</artifactId>
198-
<version>1.15.1</version>
202+
<version>1.16.0</version>
199203
<configuration>
200204
<!-- Do not push to remote -->
201205
<pushRemote>false</pushRemote>
@@ -214,11 +218,6 @@
214218
</gitFlowConfig>
215219
</configuration>
216220
</plugin>
217-
<plugin>
218-
<groupId>org.flywaydb</groupId>
219-
<artifactId>flyway-maven-plugin</artifactId>
220-
<version>${flyway.version}</version>
221-
</plugin>
222221
</plugins>
223222
</build>
224223

src/main/java/ubc/pavlab/rdp/ApiConfig.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
import io.swagger.v3.oas.models.info.Contact;
55
import io.swagger.v3.oas.models.info.Info;
66
import io.swagger.v3.oas.models.servers.Server;
7+
import org.apache.commons.lang3.StringUtils;
78
import org.springframework.beans.factory.annotation.Autowired;
89
import org.springframework.boot.info.BuildProperties;
910
import org.springframework.context.MessageSource;
1011
import org.springframework.context.annotation.Bean;
1112
import org.springframework.context.annotation.Configuration;
12-
import ubc.pavlab.rdp.controllers.ApiController;
13-
import ubc.pavlab.rdp.settings.ApplicationSettings;
13+
import org.springframework.web.util.UriComponentsBuilder;
1414
import ubc.pavlab.rdp.settings.SiteSettings;
1515

16+
import javax.servlet.ServletContext;
1617
import java.util.Collections;
1718
import java.util.Locale;
1819

@@ -29,7 +30,7 @@ public class ApiConfig {
2930
private BuildProperties buildProperties;
3031

3132
@Bean
32-
public OpenAPI openAPI( MessageSource messageSource ) {
33+
public OpenAPI openAPI( MessageSource messageSource, ServletContext servletContext ) {
3334
// FIXME: retrieve that from the request context
3435
Locale locale = Locale.getDefault();
3536
String shortname = messageSource.getMessage( "rdp.site.shortname", null, locale );
@@ -38,6 +39,8 @@ public OpenAPI openAPI( MessageSource messageSource ) {
3839
.title( messageSource.getMessage( "ApiConfig.title", new String[]{ shortname }, locale ) )
3940
.description( messageSource.getMessage( "ApiConfig.description", new String[]{ shortname }, locale ) )
4041
.contact( new Contact().email( siteSettings.getContactEmail() ) )
42+
.termsOfService( StringUtils.isEmpty( messageSource.getMessage( "rdp.privacy-policy", null, locale ) ) ?
43+
null : UriComponentsBuilder.fromPath( servletContext.getContextPath() ).path( "/terms-of-service" ).toUriString() )
4144
.version( buildProperties.getVersion() ) )
4245
.servers( Collections.singletonList( new Server().url( siteSettings.getHostUri().toString() ) ) );
4346

src/main/java/ubc/pavlab/rdp/controllers/ApiController.java

+55-54
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import lombok.extern.apachecommons.CommonsLog;
44
import org.springframework.beans.factory.annotation.Autowired;
55
import org.springframework.context.MessageSource;
6+
import org.springframework.data.domain.Page;
67
import org.springframework.data.domain.Pageable;
78
import org.springframework.http.HttpHeaders;
89
import org.springframework.http.HttpStatus;
@@ -108,10 +109,10 @@ public Object getStats() {
108109
* Results that cannot be displayed are anonymized.
109110
*/
110111
@GetMapping(value = "/api/users", produces = MediaType.APPLICATION_JSON_VALUE)
111-
public Object getUsers( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
112-
@Deprecated @RequestParam(required = false) String auth,
113-
Pageable pageable,
114-
Locale locale ) {
112+
public Page<User> getUsers( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
113+
@Deprecated @RequestParam(required = false) String auth,
114+
Pageable pageable,
115+
Locale locale ) {
115116
checkAuth( authorizationHeader, auth );
116117
if ( applicationSettings.getPrivacy().isEnableAnonymizedSearchResults() ) {
117118
final Authentication auth2 = SecurityContextHolder.getContext().getAuthentication();
@@ -130,10 +131,10 @@ public Object getUsers( @RequestHeader(value = HttpHeaders.AUTHORIZATION, requir
130131
* Results that cannot be displayed are anonymized.
131132
*/
132133
@GetMapping(value = "/api/genes", produces = MediaType.APPLICATION_JSON_VALUE)
133-
public Object getGenes( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
134-
@Deprecated @RequestParam(required = false) String auth,
135-
Pageable pageable,
136-
Locale locale ) {
134+
public Page<UserGene> getGenes( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
135+
@Deprecated @RequestParam(required = false) String auth,
136+
Pageable pageable,
137+
Locale locale ) {
137138
checkAuth( authorizationHeader, auth );
138139
if ( applicationSettings.getPrivacy().isEnableAnonymizedSearchResults() ) {
139140
final Authentication auth2 = SecurityContextHolder.getContext().getAuthentication();
@@ -146,14 +147,14 @@ public Object getGenes( @RequestHeader(value = HttpHeaders.AUTHORIZATION, requir
146147
}
147148

148149
@GetMapping(value = "/api/users/search", params = { "nameLike" }, produces = MediaType.APPLICATION_JSON_VALUE)
149-
public Object searchUsersByName( @RequestParam String nameLike,
150-
@RequestParam Boolean prefix,
151-
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
152-
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
153-
@RequestParam(required = false) Set<String> organUberonIds,
154-
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
155-
@Deprecated @RequestParam(required = false) String auth,
156-
Locale locale ) {
150+
public List<User> searchUsersByName( @RequestParam String nameLike,
151+
@RequestParam Boolean prefix,
152+
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
153+
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
154+
@RequestParam(required = false) Set<String> organUberonIds,
155+
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
156+
@Deprecated @RequestParam(required = false) String auth,
157+
Locale locale ) {
157158
checkEnabled();
158159
checkAuth( authorizationHeader, auth );
159160
if ( prefix ) {
@@ -164,13 +165,13 @@ public Object searchUsersByName( @RequestParam String nameLike,
164165
}
165166

166167
@GetMapping(value = "/api/users/search", params = { "descriptionLike" }, produces = MediaType.APPLICATION_JSON_VALUE)
167-
public Object searchUsersByDescription( @RequestParam String descriptionLike,
168-
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
169-
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
170-
@RequestParam(required = false) Set<String> organUberonIds,
171-
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
172-
@Deprecated @RequestParam(required = false) String auth,
173-
Locale locale ) {
168+
public List<User> searchUsersByDescription( @RequestParam String descriptionLike,
169+
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
170+
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
171+
@RequestParam(required = false) Set<String> organUberonIds,
172+
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
173+
@Deprecated @RequestParam(required = false) String auth,
174+
Locale locale ) {
174175
checkEnabled();
175176
checkAuth( authorizationHeader, auth );
176177
return initUsers( userService.findByDescription( descriptionLike, researcherPositions, researcherCategories, organsFromUberonIds( organUberonIds ) ), locale );
@@ -180,16 +181,16 @@ public Object searchUsersByDescription( @RequestParam String descriptionLike,
180181
* Search for genes by symbol, taxon, tier, orthologs and organ systems.
181182
*/
182183
@GetMapping(value = "/api/genes/search", params = { "symbol", "taxonId" }, produces = MediaType.APPLICATION_JSON_VALUE)
183-
public Object searchUsersByGeneSymbol( @RequestParam String symbol,
184-
@RequestParam Integer taxonId,
185-
@RequestParam(required = false) Set<TierType> tiers,
186-
@RequestParam(required = false) Integer orthologTaxonId,
187-
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
188-
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
189-
@RequestParam(required = false) Set<String> organUberonIds,
190-
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
191-
@Deprecated @RequestParam(required = false) String auth,
192-
Locale locale ) {
184+
public List<UserGene> searchUsersByGeneSymbol( @RequestParam String symbol,
185+
@RequestParam Integer taxonId,
186+
@RequestParam(required = false) Set<TierType> tiers,
187+
@RequestParam(required = false) Integer orthologTaxonId,
188+
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
189+
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
190+
@RequestParam(required = false) Set<String> organUberonIds,
191+
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
192+
@Deprecated @RequestParam(required = false) String auth,
193+
Locale locale ) {
193194
checkEnabled();
194195
checkAuth( authorizationHeader, auth );
195196

@@ -230,16 +231,16 @@ public Object searchUsersByGeneSymbol( @RequestParam String symbol,
230231
*/
231232
@Deprecated
232233
@GetMapping(value = "/api/genes/search", params = { "symbol", "taxonId", "tier" }, produces = MediaType.APPLICATION_JSON_VALUE)
233-
public Object searchUsersByGeneSymbol( @RequestParam String symbol,
234-
@RequestParam Integer taxonId,
235-
@RequestParam String tier,
236-
@RequestParam(required = false) Integer orthologTaxonId,
237-
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
238-
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
239-
@RequestParam(required = false) Set<String> organUberonIds,
240-
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
241-
@Deprecated @RequestParam(required = false) String auth,
242-
Locale locale ) {
234+
public List<UserGene> searchUsersByGeneSymbol( @RequestParam String symbol,
235+
@RequestParam Integer taxonId,
236+
@RequestParam String tier,
237+
@RequestParam(required = false) Integer orthologTaxonId,
238+
@RequestParam(required = false) Set<ResearcherPosition> researcherPositions,
239+
@RequestParam(required = false) Set<ResearcherCategory> researcherCategories,
240+
@RequestParam(required = false) Set<String> organUberonIds,
241+
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
242+
@Deprecated @RequestParam(required = false) String auth,
243+
Locale locale ) {
243244
Set<TierType> tiers;
244245
if ( tier.equals( "ANY" ) ) {
245246
tiers = TierType.ANY;
@@ -249,7 +250,7 @@ public Object searchUsersByGeneSymbol( @RequestParam String symbol,
249250
try {
250251
tiers = EnumSet.of( TierType.valueOf( tier ) );
251252
} catch ( IllegalArgumentException e ) {
252-
log.error( "Could not parse tier type.", e );
253+
log.error( String.format( "Could not parse tier type: %s.", e.getMessage() ) );
253254
throw new ApiException( HttpStatus.BAD_REQUEST, String.format( locale, "Unknown tier: %s.", tier ), e );
254255
}
255256
}
@@ -258,10 +259,10 @@ public Object searchUsersByGeneSymbol( @RequestParam String symbol,
258259
}
259260

260261
@GetMapping(value = "/api/users/{userId}", produces = MediaType.APPLICATION_JSON_VALUE)
261-
public Object getUserById( @PathVariable Integer userId,
262-
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
263-
@RequestParam(name = "auth", required = false) String auth,
264-
Locale locale ) {
262+
public User getUserById( @PathVariable Integer userId,
263+
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
264+
@RequestParam(name = "auth", required = false) String auth,
265+
Locale locale ) {
265266
checkEnabled();
266267
checkAuth( authorizationHeader, auth );
267268
User user = userService.findUserById( userId );
@@ -272,10 +273,10 @@ public Object getUserById( @PathVariable Integer userId,
272273
}
273274

274275
@GetMapping(value = "/api/users/by-anonymous-id/{anonymousId}")
275-
public Object getUserByAnonymousId( @PathVariable UUID anonymousId,
276-
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
277-
@RequestParam(name = "auth", required = false) String auth,
278-
Locale locale ) {
276+
public User getUserByAnonymousId( @PathVariable UUID anonymousId,
277+
@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authorizationHeader,
278+
@RequestParam(name = "auth", required = false) String auth,
279+
Locale locale ) {
279280
checkEnabled();
280281
checkAnonymousResultsEnabled();
281282
checkAuth( authorizationHeader, auth );
@@ -338,7 +339,7 @@ private void checkAuth( String authorizationHeader, String authToken ) throws Au
338339
new UsernamePasswordAuthenticationToken( principle, null, principle.getAuthorities() ) );
339340
}
340341

341-
private Collection<UserGene> initUserGenes( Collection<UserGene> genes, Locale locale ) {
342+
private List<UserGene> initUserGenes( List<UserGene> genes, Locale locale ) {
342343
for ( UserGene gene : genes ) {
343344
initUserGene( gene, locale );
344345
}
@@ -353,7 +354,7 @@ private UserGene initUserGene( UserGene gene, Locale locale ) {
353354
return gene;
354355
}
355356

356-
private Collection<User> initUsers( Collection<User> users, Locale locale ) {
357+
private List<User> initUsers( List<User> users, Locale locale ) {
357358
for ( User user : users ) {
358359
this.initUser( user, locale );
359360
}

0 commit comments

Comments
 (0)