Skip to content

Commit b839079

Browse files
committed
Merge branch 'hotfix-1.5.8'
2 parents b0baf70 + aad48a9 commit b839079

Some content is hidden

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

44 files changed

+2220
-690
lines changed

.github/workflows/build.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2.3.4
11+
- uses: actions/checkout@v4.1.1
1212
with:
1313
lfs: true
1414
- name: Setup Java JDK
15-
uses: actions/setup-java@v1.4.3
15+
uses: actions/setup-java@v3.13.0
1616
with:
17-
java-version: 1.8
17+
distribution: temurin
18+
java-version: '8'
1819
- name: Setup Node.js
19-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v3.8.2
2021
with:
2122
node-version: 16
2223
- name: Test code with Maven

.readthedocs.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
build:
3+
os: ubuntu-22.04
4+
tools:
5+
python: "3.12"
6+
mkdocs:
7+
configuration: mkdocs.yml
8+
python:
9+
install:
10+
- requirements: docs/requirements.txt

docker-compose.yml

+38-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
mysql56:
2-
image: mysql:5.6
3-
ports:
4-
- "3306:3306"
5-
environment:
6-
- MYSQL_USER=springuser
7-
- MYSQL_PASSWORD=ThePassword
8-
- MYSQL_DATABASE=db_example
9-
- MYSQL_RANDOM_ROOT_PASSWORD=true
10-
mysql57:
11-
image: mysql:5.7
12-
ports:
13-
- "3306:3306"
14-
environment:
15-
- MYSQL_USER=springuser
16-
- MYSQL_PASSWORD=ThePassword
17-
- MYSQL_DATABASE=db_example
18-
- MYSQL_RANDOM_ROOT_PASSWORD=true
19-
mysql:
20-
image: mysql:8.0
21-
ports:
22-
- "3306:3306"
23-
environment:
24-
- MYSQL_USER=springuser
25-
- MYSQL_PASSWORD=ThePassword
26-
- MYSQL_DATABASE=db_example
27-
- MYSQL_RANDOM_ROOT_PASSWORD=true
28-
mariadb:
29-
image: mariadb:10.6
30-
ports:
31-
- "3306:3306"
32-
environment:
33-
- MARIADB_USER=springuser
34-
- MARIADB_PASSWORD=ThePassword
35-
- MARIADB_DATABASE=db_example
36-
- MARIADB_RANDOM_ROOT_PASSWORD=true
1+
version: "3.8"
2+
services:
3+
mysql56:
4+
image: mysql:5.6
5+
ports:
6+
- "3306:3306"
7+
environment:
8+
- MYSQL_USER=springuser
9+
- MYSQL_PASSWORD=ThePassword
10+
- MYSQL_DATABASE=db_example
11+
- MYSQL_RANDOM_ROOT_PASSWORD=true
12+
mysql57:
13+
image: mysql:5.7
14+
ports:
15+
- "3306:3306"
16+
environment:
17+
- MYSQL_USER=springuser
18+
- MYSQL_PASSWORD=ThePassword
19+
- MYSQL_DATABASE=db_example
20+
- MYSQL_RANDOM_ROOT_PASSWORD=true
21+
mysql:
22+
image: mysql:8.0
23+
ports:
24+
- "3306:3306"
25+
environment:
26+
- MYSQL_USER=springuser
27+
- MYSQL_PASSWORD=ThePassword
28+
- MYSQL_DATABASE=db_example
29+
- MYSQL_RANDOM_ROOT_PASSWORD=true
30+
mariadb:
31+
image: mariadb:10.6
32+
ports:
33+
- "3306:3306"
34+
environment:
35+
- MARIADB_USER=springuser
36+
- MARIADB_PASSWORD=ThePassword
37+
- MARIADB_DATABASE=db_example
38+
- MARIADB_RANDOM_ROOT_PASSWORD=true

docs/customization.md

+79-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# Customize your instance
22

3+
This section contains instruction to customize your RDP registry.
4+
5+
## Allowed email providers (new in 1.5.8)
6+
7+
You may restrict which email providers can be used for creating new accounts by specifying a list or a file
8+
containing allowed domains. Matches are performed in a case-insensitive manner. Only printable ASCII characters are
9+
allowed.
10+
11+
```ini
12+
rdp.settings.allowed-email-domains=example.com
13+
rdp.settings.allowed-email-domains-file=file:swot.txt
14+
rdp.settings.allowed-email-domains-file-refresh-delay=3600
15+
```
16+
17+
The default refresh delay is set to one hour. Disable it by setting it to an empty value. A value of `0` will cause a
18+
refresh on every validation.
19+
20+
This feature is disabled by default.
21+
22+
### Internationalized domain names
23+
24+
To use [internationalized domain names](https://en.wikipedia.org/wiki/Internationalized_domain_name) in email addresses,
25+
add their Punycode to the list or file and set the following setting:
26+
27+
```ini
28+
rdp.settings.allow-internationalized-email-domains=true
29+
```
30+
31+
For example, to allow users from `universität.example.com` to register, add `xn--universitt-y5a.example.com` to the
32+
file.
33+
34+
## reCAPTCHA (new in 1.5.8)
35+
36+
RDP supports [reCAPTCHA v2](https://www.google.com/recaptcha/about/) to mitigate the registration of accounts by bots.
37+
To enable it, add the reCAPTCHA token and secret to your configuration.
38+
39+
```ini
40+
rdp.site.recaptcha-token=mytoken
41+
rdp.site.recaptcha-secret=mysecret
42+
```
43+
44+
This feature is disabled by default.
45+
46+
## Cached data
47+
348
Most of the data used by the application is retrieved remotely at startup and subsequently updated on a monthly basis.
449

550
To prevent data from being loaded on startup and/or recurrently, set the following parameter in
@@ -12,6 +57,8 @@ rdp.settings.cache.enabled=false
1257
You should deploy your RDP instance at least once to have initial data before setting this property and whenever you
1358
update the software.
1459

60+
The following sections will cover in details individual data sources that can be imported in your registry.
61+
1562
## Gene information and GO terms
1663

1764
By default, RDP will retrieve the latest gene information from NCBI, and GO terms
@@ -40,6 +87,8 @@ GO terms, on the other hand, are obtained from Ontobee:
4087
rdp.settings.cache.term-file=http://purl.obolibrary.org/obo/go.obo
4188
```
4289

90+
gene2go associations will only be populated for active taxa (new in 1.5.8).
91+
4392
## Gene Tiers
4493

4594
Users' genes are categorized in tiers based on their familiarity and experience with the gene. This is explained in
@@ -67,6 +116,29 @@ where taxon_id = 10090;
67116

68117
Every time new model systems are added to the application, they will have to be activated in this manner.
69118

119+
## GO term recommendation
120+
121+
Users can receive recommended terms based on the TIER1 and TIER2 genes they have added to their profiles.
122+
123+
The recommendation algorithm works as follows:
124+
125+
1. Retrieve GO terms associated to all TIER1 and TIER2 genes
126+
2. Retrieve all the descendants of these terms
127+
3. For each term, compute how many TIER1 or TIER2 genes they are associated either directly or indirectly via their
128+
descendants
129+
4. Keep terms that are not already on the user profile and that mention at least 2 TIER1 or TIER2 genes
130+
5. Exclude terms with more than 50 associated genes
131+
6. Retain terms that have at least one novel gene that is not on the user's profile
132+
7. Retain most specific terms if a given term and its descendant is recommended
133+
134+
You can adjust the number of overlapping TIER1 or TIER2 genes and the maximum size of a GO term by setting the
135+
following:
136+
137+
```ini
138+
rdp.settings.go-term-min-overlap=2 # new in 1.5.8
139+
rdp.settings.go-term-size-limit=50
140+
```
141+
70142
### Customizing taxon appearance (new in 1.5.5)
71143

72144
By default, taxon are rendered using the common name in title case. The only exception is for *Homo sapiens* which
@@ -269,19 +341,20 @@ The page lists some basic stats at the very top and provides few action buttons:
269341

270342
![Actions available for simple categories.](images/simple-category-actions.png)
271343

272-
- "Deactivate" (or "Deactivate All Terms" in the case of an ontology category): this will remove the category from the Profile and Search pages. This action is reversible, as the category can be easily re-activated. This action is recommended in cases where a category cannot be deleted because it has already been used by some users.
344+
- "Deactivate" (or "Deactivate All Terms" in the case of an ontology category): this will remove the category from the
345+
Profile and Search pages. This action is reversible, as the category can be easily re-activated. This action is
346+
recommended in cases where a category cannot be deleted because it has already been used by some users.
273347

274348
- Update from "source": Update the ontology category using the original URL (if available)
275349

276350
- Download as OBO: Download the category as an OBO file
277351

278-
279-
280352
The number of used terms indicate how many terms in the ontology have been associated with associated with users.
281353

282354
In the Edit window on the Manage Profile Category page, you can add a definition/description of the category, which
283355
is used in a tooltip on the Profile Page. You can also specify if this category will be used as a filter on the Gene
284-
Search page. While all active categories will be available on the Researcher Search page, only categories that have "Available for gene search?" checked will be displayed on the Gene Search page.
356+
Search page. While all active categories will be available on the Researcher Search page, only categories that have "
357+
Available for gene search?" checked will be displayed on the Gene Search page.
285358

286359
![Interface for editing the properties of an ontology.](images/edit-an-ontology.png)
287360

@@ -346,8 +419,6 @@ values. A warning will be displayed in the admin section if this is the case.
346419
Read more about configuring messages in [Customizing the application messages](#customizing-the-applications-messages)
347420
section of this page.
348421

349-
350-
351422
### Resolving external URLs
352423

353424
By default, ontologies and terms are resolved from [OLS](https://www.ebi.ac.uk/ols/index). Reactome pathways get a
@@ -400,7 +471,6 @@ settings will retrieve all the necessary files relative to the working directory
400471
#this setting relates only to gene info files. Files for all taxons will be stord under gene/
401472
rdp.settings.cache.load-from-disk=true
402473
rdp.settings.cache.gene-files-location=file:genes/
403-
404474
#file for GO ontology
405475
rdp.settings.cache.term-file=file:go.obo
406476
#file for gene GO annotation
@@ -535,7 +605,8 @@ rdp.faq.questions.<q_key>=A relevant question.
535605
rdp.faq.answers.<q_key>=A plausible answer.
536606
```
537607

538-
The provided default file can be found in [faq.properties](https://github.com/PavlidisLab/rdp/tree/{{ config.extra.git_ref }}/src/main/resources/faq.properties).
608+
The provided default file can be found in [faq.properties](https://github.com/PavlidisLab/rdp/tree/{{
609+
config.extra.git_ref }}/src/main/resources/faq.properties).
539610

540611
### Ordering FAQ entries
541612

mkdocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ plugins:
1414
markdown_extensions:
1515
- admonition
1616
extra:
17-
rdp_version: 1.5.5
17+
rdp_version: 1.5.8
1818
git_ref: master

pom.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<name>Rare Disease Project</name>
77
<groupId>ubc.pavlab</groupId>
88
<artifactId>rdp</artifactId>
9-
<version>1.5.7</version>
9+
<version>1.5.8</version>
1010

1111
<description>
1212
Registry for model organism/system researchers, developed for the Canadian Rare Disease Models &amp; Mechanisms Network.
@@ -140,7 +140,7 @@
140140
<dependency>
141141
<groupId>commons-io</groupId>
142142
<artifactId>commons-io</artifactId>
143-
<version>2.13.0</version>
143+
<version>2.15.0</version>
144144
</dependency>
145145

146146
<dependency>
@@ -152,14 +152,14 @@
152152
<dependency>
153153
<groupId>org.apache.commons</groupId>
154154
<artifactId>commons-text</artifactId>
155-
<version>1.10.0</version>
155+
<version>1.11.0</version>
156156
</dependency>
157157

158158
<!-- User-Agent header parsing -->
159159
<dependency>
160160
<groupId>nl.basjes.parse.useragent</groupId>
161161
<artifactId>yauaa</artifactId>
162-
<version>7.22.0</version>
162+
<version>7.24.0</version>
163163
</dependency>
164164

165165
<!-- Testing Support -->
@@ -205,7 +205,7 @@
205205
<dependency>
206206
<groupId>org.json</groupId>
207207
<artifactId>json</artifactId>
208-
<version>20230618</version>
208+
<version>20231013</version>
209209
<scope>test</scope>
210210
</dependency>
211211
</dependencies>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package ubc.pavlab.rdp;
2+
3+
import lombok.extern.apachecommons.CommonsLog;
4+
import org.springframework.beans.factory.annotation.Value;
5+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6+
import org.springframework.boot.convert.DurationUnit;
7+
import org.springframework.context.annotation.Bean;
8+
import org.springframework.context.annotation.Configuration;
9+
import org.springframework.core.io.Resource;
10+
import org.springframework.http.converter.FormHttpMessageConverter;
11+
import org.springframework.web.client.RestTemplate;
12+
import ubc.pavlab.rdp.validation.*;
13+
14+
import java.io.IOException;
15+
import java.time.Duration;
16+
import java.time.temporal.ChronoUnit;
17+
import java.util.ArrayList;
18+
import java.util.List;
19+
import java.util.Set;
20+
21+
/**
22+
* This configuration provides a few {@link org.springframework.validation.Validator} beans.
23+
*/
24+
@CommonsLog
25+
@Configuration
26+
public class ValidationConfig {
27+
28+
@Bean
29+
public EmailValidator emailValidator(
30+
@Value("${rdp.settings.allowed-email-domains}") List<String> allowedEmailDomains,
31+
@Value("${rdp.settings.allowed-email-domains-file}") Resource allowedEmailDomainsFile,
32+
@Value("${rdp.settings.allowed-email-domains-file-refresh-delay}") @DurationUnit(ChronoUnit.SECONDS) Duration refreshDelay,
33+
@Value("${rdp.settings.allow-internationalized-email-domains}") boolean allowIdn ) throws IOException {
34+
List<AllowedDomainStrategy> strategies = new ArrayList<>();
35+
if ( allowedEmailDomains != null && !allowedEmailDomains.isEmpty() ) {
36+
SetBasedAllowedDomainStrategy strategy = new SetBasedAllowedDomainStrategy( allowedEmailDomains );
37+
strategies.add( strategy );
38+
log.info( String.format( "Email validation is configured to accept addresses from: %s.", String.join( ", ",
39+
strategy.getAllowedDomains() ) ) );
40+
}
41+
if ( allowedEmailDomainsFile != null ) {
42+
log.info( "Reading allowed email domains from " + allowedEmailDomainsFile + "..." );
43+
if ( refreshDelay.isZero() ) {
44+
log.warn( "The refresh delay for reading " + allowedEmailDomainsFile + " is set to zero: the file will be re-read for every email domain validation." );
45+
}
46+
ResourceBasedAllowedDomainStrategy strategy = new ResourceBasedAllowedDomainStrategy( allowedEmailDomainsFile, refreshDelay );
47+
strategy.refresh();
48+
Set<String> allowedDomains = strategy.getAllowedDomains();
49+
strategies.add( strategy );
50+
if ( strategy.getAllowedDomains().size() <= 5 ) {
51+
log.info( String.format( "Email validation is configured to accept addresses from: %s.", String.join( ", ", allowedDomains ) ) );
52+
} else {
53+
log.info( String.format( "Email validation is configured to accept addresses from a list of %d domains.", allowedDomains.size() ) );
54+
}
55+
}
56+
AllowedDomainStrategy strategy;
57+
if ( strategies.isEmpty() ) {
58+
strategy = ( domain ) -> true;
59+
log.warn( "No allowed email domains file specified, all domains will be allowed for newly registered users." );
60+
} else if ( strategies.size() == 1 ) {
61+
strategy = strategies.iterator().next();
62+
} else {
63+
strategy = domain -> strategies.stream().anyMatch( s -> s.allows( domain ) );
64+
}
65+
return new EmailValidator( strategy, allowIdn );
66+
}
67+
68+
@Bean
69+
@ConditionalOnProperty("rdp.site.recaptcha-secret")
70+
public RecaptchaValidator recaptchaValidator( @Value("${rdp.site.recaptcha-secret}") String secret ) {
71+
RestTemplate rt = new RestTemplate();
72+
rt.getMessageConverters().add( new FormHttpMessageConverter() );
73+
return new RecaptchaValidator( rt, secret );
74+
}
75+
}

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

+5
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ public class AdminController {
9898
@Qualifier("adminTaskExecutor")
9999
private AsyncTaskExecutor taskExecutor;
100100

101+
@InitBinder("user")
102+
public void configureUserInitBinder( WebDataBinder dataBinder ) {
103+
dataBinder.setAllowedFields( "email", "profile.name" );
104+
}
105+
101106
/**
102107
* List all users
103108
*/

0 commit comments

Comments
 (0)