Merge pull request #11263 from lareferencia/fix-unable-to-select-researcher-profile-as-author

Add familyName and givenName when creating profile author and fix EPe…
This commit is contained in:
Tim Donohue
2025-09-10 14:22:42 -05:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@@ -366,7 +366,7 @@ public class EPerson extends CacheableDSpaceObject implements DSpaceObjectLegacy
@Override
public String getName() {
return getEmail();
return this.getFullName();
}
String getDigestAlgorithm() {

View File

@@ -283,6 +283,8 @@ public class ResearcherProfileServiceImpl implements ResearcherProfileService {
itemService.addMetadata(context, item, "dc", "title", null, null, fullName);
itemService.addMetadata(context, item, "person", "email", null, null, ePerson.getEmail());
itemService.addMetadata(context, item, "dspace", "object", "owner", null, fullName, id, CF_ACCEPTED);
itemService.addMetadata(context, item, "person", "familyName", null, null, ePerson.getLastName());
itemService.addMetadata(context, item, "person", "givenName", null, null, ePerson.getFirstName());
item = installItemService.installItem(context, workspaceItem);

View File

@@ -144,6 +144,7 @@ public class ResearcherProfileRestRepositoryIT extends AbstractControllerIntegra
user = EPersonBuilder.createEPerson(context)
.withEmail("user@example.com")
.withNameInMetadata("Example", "User")
.withPassword(password)
.build();
@@ -323,7 +324,7 @@ public class ResearcherProfileRestRepositoryIT extends AbstractControllerIntegra
public void testCreateAndReturn() throws Exception {
String id = user.getID().toString();
String name = user.getName();
String name = user.getFullName();
String authToken = getAuthToken(user.getEmail(), password);
@@ -342,6 +343,8 @@ public class ResearcherProfileRestRepositoryIT extends AbstractControllerIntegra
.andExpect(status().isOk())
.andExpect(jsonPath("$.type", is("item")))
.andExpect(jsonPath("$.metadata", matchMetadata("dspace.object.owner", name, id, 0)))
.andExpect(jsonPath("$.metadata", matchMetadata("person.givenName", user.getFirstName(), 0)))
.andExpect(jsonPath("$.metadata", matchMetadata("person.familyName", user.getLastName(), 0)))
.andExpect(jsonPath("$.metadata", matchMetadata("dspace.entity.type", "Person", 0)));
getClient(authToken).perform(get("/api/eperson/profiles/{id}/eperson", id))
@@ -391,7 +394,7 @@ public class ResearcherProfileRestRepositoryIT extends AbstractControllerIntegra
public void testCreateAndReturnWithAdmin() throws Exception {
String id = user.getID().toString();
String name = user.getName();
String name = user.getFullName();
configurationService.setProperty("researcher-profile.collection.uuid", null);
@@ -412,6 +415,8 @@ public class ResearcherProfileRestRepositoryIT extends AbstractControllerIntegra
getClient(authToken).perform(get("/api/eperson/profiles/{id}/item", id))
.andExpect(status().isOk())
.andExpect(jsonPath("$.type", is("item")))
.andExpect(jsonPath("$.metadata", matchMetadata("person.givenName", user.getFirstName(), 0)))
.andExpect(jsonPath("$.metadata", matchMetadata("person.familyName", user.getLastName(), 0)))
.andExpect(jsonPath("$.metadata", matchMetadata("dspace.object.owner", name, id, 0)))
.andExpect(jsonPath("$.metadata", matchMetadata("dspace.entity.type", "Person", 0)));