mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
Merge pull request #11301 from DSpace/backport-11263-to-dspace-9_x
[Port dspace-9_x] Add familyName and givenName when creating profile author and fix EPe…
This commit is contained in:
@@ -366,7 +366,7 @@ public class EPerson extends CacheableDSpaceObject implements DSpaceObjectLegacy
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getEmail();
|
||||
return this.getFullName();
|
||||
}
|
||||
|
||||
String getDigestAlgorithm() {
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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)));
|
||||
|
||||
|
Reference in New Issue
Block a user