Trying to fix the support of clientID

This commit is contained in:
Luca Frosini 2022-03-23 14:10:57 +01:00
parent e7a2c2edd4
commit d39350aedf
1 changed files with 8 additions and 2 deletions

View File

@ -121,13 +121,19 @@ public class CKANUser extends CKAN {
* @return true if the display name and the full name has been updated
*/
private boolean checkAndSetEmail(ObjectNode objectNode) {
String portalEmail = SecretManagerProvider.instance.get().getUser().getEmail();
User user = SecretManagerProvider.instance.get().getUser();
String portalEmail = user.getEmail();
String ckanEmail = "";
if(objectNode.has(EMAIL)) {
ckanEmail = objectNode.get(EMAIL).asText();
}
if(portalEmail!= null && portalEmail.compareTo(ckanEmail) != 0) {
if(portalEmail==null) {
String username = user.getUsername();
String eMail = username + "@d4science.org";
objectNode.put(EMAIL, eMail);
return true;
} else if(portalEmail.compareTo(ckanEmail) != 0) {
objectNode.put(EMAIL, portalEmail);
return true;
}