Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses duplicate user_registration rows being created for the same EPerson during import/usage in CLARIN-DSpace (DSpace 7 REST backend), by enforcing uniqueness at both the application and database layers and adding integration tests to validate the behavior.
Changes:
- Prevent duplicate registrations by updating an existing registration when
eperson_idmatches (service-layer guard). - Ensure the EPerson import endpoint does not leave behind an automatically created “Unknown” registration.
- Add DB migrations introducing a unique index on
user_registration.eperson_idand expand DAO email lookup to support semicolon-separated email values.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
dspace-api/src/main/java/org/dspace/content/clarin/ClarinUserRegistrationServiceImpl.java |
Updates create() to update an existing registration when eperson_id already exists. |
dspace-api/src/main/java/org/dspace/content/dao/impl/clarin/ClarinUserRegistrationDAOImpl.java |
Expands findByEmail matching to handle semicolon-separated email strings. |
dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/ClarinEPersonImportController.java |
Removes auto-created registrations during EPerson import so registrations are managed by the dedicated endpoint. |
dspace-api/src/main/resources/.../postgres/V7.6_2026.03.10__user_registration_unique_eperson_id.sql |
Adds a (partial) unique index on eperson_id in PostgreSQL. |
dspace-api/src/main/resources/.../h2/V7.6_2026.03.10__user_registration_unique_eperson_id.sql |
Adds a unique index on eperson_id in H2 for tests/dev. |
dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinUserRegistrationServiceImplIT.java |
Adds integration tests covering dedup/update behavior and null-eperson cases. |
dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinEPersonImportControllerIT.java |
Adds an integration test asserting EPerson import does not create a user registration. |
| -- | ||
| -- http://www.dspace.org/license/ | ||
| -- | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem description
After the import and during DSpace usage, multiple user registrations were created for a single EPerson.
Problem: If an EPerson already existed and was not newly created during the process, a new user registration was still created.
Manual Testing (if applicable)
Copilot review