[CST-5669] Minor changes

This commit is contained in:
Luca Giamminonni
2022-05-09 13:41:03 +02:00
parent 92e8a2fb25
commit a19d31da67
7 changed files with 11 additions and 14 deletions

View File

@@ -230,9 +230,6 @@ public class OrcidSynchronizationServiceImpl implements OrcidSynchronizationServ
.filter(metadata -> metadataField.equals(metadata.getMetadataField().toString('.'))); .filter(metadata -> metadataField.equals(metadata.getMetadataField().toString('.')));
} }
private String getProfileType() {
return configurationService.getProperty("researcher-profile.type", "Person");
}
private void updateItem(Context context, Item item) throws SQLException { private void updateItem(Context context, Item item) throws SQLException {
try { try {

View File

@@ -48,10 +48,6 @@ public class ResearcherProfile {
return UUIDUtils.fromString(dspaceObjectOwner.getAuthority()); return UUIDUtils.fromString(dspaceObjectOwner.getAuthority());
} }
public String getFullName() {
return dspaceObjectOwner.getValue();
}
/** /**
* A profile is considered visible if accessible by anonymous users. This method * A profile is considered visible if accessible by anonymous users. This method
* returns true if the given item has a READ policy related to ANONYMOUS group, * returns true if the given item has a READ policy related to ANONYMOUS group,

View File

@@ -206,12 +206,16 @@ public class OrcidAuthenticationBean implements AuthenticationMethod {
try { try {
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
String email = getEmail(person)
.orElseThrow(() -> new IllegalStateException("The email is configured private on orcid"));
String orcid = token.getOrcid(); String orcid = token.getOrcid();
EPerson eperson = ePersonService.create(context); EPerson eperson = ePersonService.create(context);
eperson.setNetid(orcid); eperson.setNetid(orcid);
eperson.setEmail(getEmail(person).orElse(orcid));
eperson.setEmail(email);
eperson.setFirstName(context, getFirstName(person)); eperson.setFirstName(context, getFirstName(person));
eperson.setLastName(context, getLastName(person)); eperson.setLastName(context, getLastName(person));
eperson.setCanLogIn(true); eperson.setCanLogIn(true);

View File

@@ -576,10 +576,10 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
@Override @Override
public EPerson findByProfileItem(Context context, Item profile) throws SQLException { public EPerson findByProfileItem(Context context, Item profile) throws SQLException {
List<MetadataValue> crisOwners = itemService.getMetadata(profile, "dspace", "object", "owner", ANY); List<MetadataValue> owners = itemService.getMetadata(profile, "dspace", "object", "owner", ANY);
if (CollectionUtils.isEmpty(crisOwners)) { if (CollectionUtils.isEmpty(owners)) {
return null; return null;
} }
return find(context, UUIDUtils.fromString(crisOwners.get(0).getAuthority())); return find(context, UUIDUtils.fromString(owners.get(0).getAuthority()));
} }
} }

View File

@@ -31,7 +31,7 @@ import org.springframework.stereotype.Component;
* Implementation for ResearcherProfile ORCID disconnection. * Implementation for ResearcherProfile ORCID disconnection.
* *
* Example: <code><br/> * Example: <code><br/>
* curl -X PATCH http://${dspace.server.url}/api/cris/profiles/<:id-eperson> -H " * curl -X PATCH http://${dspace.server.url}/api/eperson/profiles/<:id-eperson> -H "
* Content-Type: application/json" -d '[{ "op": "remove", "path": "/orcid" }]' * Content-Type: application/json" -d '[{ "op": "remove", "path": "/orcid" }]'
* </code> * </code>
*/ */

View File

@@ -36,7 +36,7 @@ import org.springframework.stereotype.Component;
* patches. * patches.
* *
* Example: * Example:
* <code> curl -X PATCH http://${dspace.server.url}/api/cris/profiles/<:id-eperson> -H " * <code> curl -X PATCH http://${dspace.server.url}/api/eperson/profiles/<:id-eperson> -H "
* Content-Type: application/json" -d '[{ * Content-Type: application/json" -d '[{
* "op": "replace", * "op": "replace",
* "path": "/orcid/publications", * "path": "/orcid/publications",

View File

@@ -26,7 +26,7 @@
# Configuration file: authentication-x509.cfg # Configuration file: authentication-x509.cfg
# ORCID certificate authentication. # ORCID certificate authentication.
# plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.OrcidAuthenticationDelegator # plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.OrcidAuthentication
# * OIDC Authentication # * OIDC Authentication
# Plugin class: org.dspace.authenticate.OidcAuthentication # Plugin class: org.dspace.authenticate.OidcAuthentication