Skip to content

Commit cce40c4

Browse files
committed
Merge branch 'develop' into 11573-print-datasettype
2 parents 2165d6b + 54f19d9 commit cce40c4

File tree

78 files changed

+1802
-291
lines changed

Some content is hidden

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

78 files changed

+1802
-291
lines changed

CITATION.cff

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cff-version: 1.2.0
2+
title: Dataverse
3+
message: >-
4+
If you use this software, please cite it using the
5+
metadata from this file.
6+
type: software
7+
authors:
8+
- given-names: Gary
9+
family-names: King
10+
orcid: 'https://orcid.org/0000-0002-5327-7631'
11+
affiliation: Harvard University
12+
identifiers:
13+
- type: doi
14+
value: 10.1177/0049124107306660
15+
repository-code: 'https://github.com/IQSS/dataverse'
16+
url: 'https://dataverse.org'
17+
abstract: >-
18+
Dataverse is an open source software platform designed for
19+
sharing, finding, citing, and preserving research data.
20+
license: Apache-2.0

conf/keycloak/builtin-users-spi/src/main/java/edu/harvard/iq/keycloak/auth/spi/providers/DataverseUserStorageProvider.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public class DataverseUserStorageProvider implements
3131
public DataverseUserStorageProvider(KeycloakSession session, ComponentModel model) {
3232
this.session = session;
3333
this.model = model;
34-
this.dataverseUserService = new DataverseUserService(session);
34+
35+
String datasource = model.getConfig().getFirst("datasource");
36+
logger.debugf("Using datasource: %s", datasource);
37+
this.dataverseUserService = new DataverseUserService(session, datasource);
3538
}
3639

3740
@Override

conf/keycloak/builtin-users-spi/src/main/java/edu/harvard/iq/keycloak/auth/spi/providers/DataverseUserStorageProviderFactory.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
import org.jboss.logging.Logger;
44
import org.keycloak.component.ComponentModel;
55
import org.keycloak.models.KeycloakSession;
6+
import org.keycloak.provider.ProviderConfigProperty;
67
import org.keycloak.storage.UserStorageProviderFactory;
78

9+
import java.util.ArrayList;
10+
import java.util.List;
11+
812
public class DataverseUserStorageProviderFactory implements UserStorageProviderFactory<DataverseUserStorageProvider> {
913

1014
public static final String PROVIDER_ID = "dv-builtin-users-authenticator";
@@ -30,4 +34,19 @@ public String getHelpText() {
3034
public void close() {
3135
logger.debug("<<<<<< Closing factory");
3236
}
37+
38+
@Override
39+
public List<ProviderConfigProperty> getConfigProperties() {
40+
List<ProviderConfigProperty> configProperties = new ArrayList<>();
41+
42+
ProviderConfigProperty mySetting = new ProviderConfigProperty();
43+
mySetting.setName("datasource");
44+
mySetting.setLabel("Datasource");
45+
mySetting.setHelpText("This specifies the target datasource used by the SPI.");
46+
mySetting.setType(ProviderConfigProperty.STRING_TYPE);
47+
48+
configProperties.add(mySetting);
49+
50+
return configProperties;
51+
}
3352
}

conf/keycloak/builtin-users-spi/src/main/java/edu/harvard/iq/keycloak/auth/spi/services/DataverseUserService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class DataverseUserService {
1717

1818
private final EntityManager em;
1919

20-
public DataverseUserService(KeycloakSession session) {
21-
this.em = session.getProvider(JpaConnectionProvider.class, "user-store").getEntityManager();
20+
public DataverseUserService(KeycloakSession session, String datasource) {
21+
this.em = session.getProvider(JpaConnectionProvider.class, datasource).getEntityManager();
2222
}
2323

2424
public DataverseUser getUserById(String id) {

conf/keycloak/builtin-users-spi/src/main/resources/META-INF/persistence.xml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,26 @@
1313
<!-- JDBC connection settings -->
1414
<property name="hibernate.connection.datasource" value="user-store"/>
1515

16-
<!-- Database connection properties for PostgreSQL -->
17-
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
18-
<property name="hibernate.connection.url" value="jdbc:postgresql://postgres:5432/dataverse"/>
19-
<property name="hibernate.connection.username" value="${DATAVERSE_DB_USER}"/>
20-
<property name="hibernate.connection.password" value="secret"/>
16+
<!-- Transaction management settings -->
17+
<property name="jakarta.persistence.transactionType" value="JTA"/>
18+
19+
<!-- Automatically update database schema -->
20+
<property name="hibernate.hbm2ddl.auto" value="none"/>
21+
22+
<!-- Disable SQL logging -->
23+
<property name="hibernate.show_sql" value="false"/>
24+
</properties>
25+
</persistence-unit>
26+
27+
<persistence-unit name="user-store-qa" transaction-type="JTA">
28+
<class>edu.harvard.iq.keycloak.auth.spi.models.DataverseBuiltinUser</class>
29+
<class>edu.harvard.iq.keycloak.auth.spi.models.DataverseAuthenticatedUser</class>
30+
<properties>
31+
<!-- Set the Hibernate dialect for PostgreSQL -->
32+
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
33+
34+
<!-- JDBC connection settings -->
35+
<property name="hibernate.connection.datasource" value="user-store-qa"/>
2136

2237
<!-- Transaction management settings -->
2338
<property name="jakarta.persistence.transactionType" value="JTA"/>

conf/keycloak/builtin-users-spi/src/test/java/edu/harvard/iq/keycloak/auth/spi/services/DataverseUserServiceTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
class DataverseUserServiceTest {
2020

21+
private static final String TEST_USER_STORE = "user-store";
22+
2123
private EntityManager entityManagerMock;
2224
private DataverseUserService sut;
2325

@@ -27,10 +29,10 @@ void setUp() {
2729
KeycloakSession sessionMock = mock(KeycloakSession.class);
2830

2931
JpaConnectionProvider jpaConnectionProviderMock = mock(JpaConnectionProvider.class);
30-
when(sessionMock.getProvider(JpaConnectionProvider.class, "user-store")).thenReturn(jpaConnectionProviderMock);
32+
when(sessionMock.getProvider(JpaConnectionProvider.class, TEST_USER_STORE)).thenReturn(jpaConnectionProviderMock);
3133
when(jpaConnectionProviderMock.getEntityManager()).thenReturn(entityManagerMock);
3234

33-
sut = new DataverseUserService(sessionMock);
35+
sut = new DataverseUserService(sessionMock, TEST_USER_STORE);
3436
}
3537

3638
@Test

conf/keycloak/setup-spi.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ curl -X POST "http://keycloak:8090/admin/realms/test/components" \
3535
"name": "Dataverse built-in users authentication",
3636
"providerId": "dv-builtin-users-authenticator",
3737
"providerType": "org.keycloak.storage.UserStorageProvider",
38-
"parentId": null
38+
"parentId": null,
39+
"config": {
40+
"datasource": ["user-store"]
41+
}
3942
}'
4043

4144
echo "Keycloak SPI configured in realm."
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
It is now possible to link draft datasets to other Dataverse collections. As usual, the datasets will only become publicly visible in the linked collection(s) after they have been published. To publish a linked dataset, your account must have the "Publish Dataset" permission for the Dataverse collection in which the dataset was originally created. Permissions in the linked Dataverse collections do not apply.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Files attached to a Dataset can now be limited by count
2+
3+
Added the ability to set a limit on the number of files that can be uploaded to a Dataset. Limits can be set globally through a JVM setting or set per Collection or Dataset.
4+
5+
See also [the guides](https://dataverse-guide--11359.org.readthedocs.build/en/11359/api/native-api.html#imposing-a-limit-to-the-number-of-files-allowed-to-be-uploaded-to-a-dataset), #11275, and #11359.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Reduced chance of losing metadata on Edit Dataset Metadata page
2+
3+
The remedy for the problem consists of two parts:
4+
* Do not show the _host dataverse_ field when there is nothing to choose. This mimics the behaviour for templates.
5+
* When you accidentally start typing in the _host dataverse_ field, undo the change with backspace, fill in the other metadata fields and save the draft, the page used to get blocked due to an exception. Reloading the page would erase all your input. The exception (caused by an invalid argument) is remedied returning the currently selected value.

0 commit comments

Comments
 (0)