Author will be in the form <Surname Name> #21479
This commit is contained in:
parent
1d81da329a
commit
dfe711f419
|
@ -254,12 +254,13 @@ public class CKANPackage extends CKAN {
|
||||||
objectNode.remove(CAPACITY_KEY);
|
objectNode.remove(CAPACITY_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
String authorName = ckanUser.getPortalUser().getFullName();
|
PortalUser portalUser = ckanUser.getPortalUser();
|
||||||
|
String authorName = String.format("%s %s", portalUser.getSurname(), portalUser.getName());
|
||||||
if(authorName==null || authorName.compareTo("")==0) {
|
if(authorName==null || authorName.compareTo("")==0) {
|
||||||
authorName = ckanUser.getName();
|
authorName = ckanUser.getName();
|
||||||
}
|
}
|
||||||
objectNode.put(AUTHOR_KEY, authorName);
|
objectNode.put(AUTHOR_KEY, authorName);
|
||||||
String authorEmail = ckanUser.getPortalUser().getEMail();
|
String authorEmail = portalUser.getEMail();
|
||||||
objectNode.put(AUTHOR_EMAIL_KEY, authorEmail);
|
objectNode.put(AUTHOR_EMAIL_KEY, authorEmail);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class CKANUser extends CKAN {
|
||||||
* @return true if the display name and the full name has been updated in objectNode
|
* @return true if the display name and the full name has been updated in objectNode
|
||||||
*/
|
*/
|
||||||
private boolean checkAndSetFullName(ObjectNode objectNode) {
|
private boolean checkAndSetFullName(ObjectNode objectNode) {
|
||||||
String portalFullname = getPortalUser().getFullName();
|
String portalFullname = getPortalUser().getSurnameName();
|
||||||
|
|
||||||
String ckanFullname = "";
|
String ckanFullname = "";
|
||||||
if(objectNode.has(FULL_NAME)) {
|
if(objectNode.has(FULL_NAME)) {
|
||||||
|
|
|
@ -30,7 +30,11 @@ public class PortalUser {
|
||||||
protected static final String SOCIAL_SERVICE_GET_OAUTH_USER_PROFILE_PATH = "2/users/get-oauth-profile";
|
protected static final String SOCIAL_SERVICE_GET_OAUTH_USER_PROFILE_PATH = "2/users/get-oauth-profile";
|
||||||
|
|
||||||
// This key contains the fullname
|
// This key contains the fullname
|
||||||
protected static final String OAUTH_USER_PROFILE_NAME_KEY = "name";
|
//protected static final String OAUTH_USER_PROFILE_FULLNAME_KEY = "name";
|
||||||
|
|
||||||
|
protected static final String OAUTH_USER_PROFILE_NAME_KEY = "given_name";
|
||||||
|
protected static final String OAUTH_USER_PROFILE_SURNAME_KEY = "family_name";
|
||||||
|
|
||||||
protected static final String OAUTH_USER_PROFILE_EMAIL_KEY = "email";
|
protected static final String OAUTH_USER_PROFILE_EMAIL_KEY = "email";
|
||||||
protected static final String OAUTH_USER_PROFILE_JOB_TITLE_KEY = "job_title";
|
protected static final String OAUTH_USER_PROFILE_JOB_TITLE_KEY = "job_title";
|
||||||
protected static final String OAUTH_USER_PROFILE_ROLES_KEY = "roles";
|
protected static final String OAUTH_USER_PROFILE_ROLES_KEY = "roles";
|
||||||
|
@ -40,7 +44,9 @@ public class PortalUser {
|
||||||
// private JsonNode gCubeUserProfile;
|
// private JsonNode gCubeUserProfile;
|
||||||
protected JsonNode oAuthUserProfile;
|
protected JsonNode oAuthUserProfile;
|
||||||
|
|
||||||
protected String fullName;
|
protected String name;
|
||||||
|
protected String surname;
|
||||||
|
|
||||||
protected String eMail;
|
protected String eMail;
|
||||||
protected String jobTitle;
|
protected String jobTitle;
|
||||||
|
|
||||||
|
@ -95,11 +101,26 @@ public class PortalUser {
|
||||||
return oAuthUserProfile;
|
return oAuthUserProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFullName() {
|
public String getSurnameName() {
|
||||||
if(fullName == null) {
|
return String.format("%s %s", getSurname(), getName());
|
||||||
fullName = getOAuthUserProfile().get(OAUTH_USER_PROFILE_NAME_KEY).asText();
|
}
|
||||||
|
|
||||||
|
public String getNameSurname() {
|
||||||
|
return String.format("%s %s", getName(), getSurname());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
if(name == null) {
|
||||||
|
name = getOAuthUserProfile().get(OAUTH_USER_PROFILE_NAME_KEY).asText();
|
||||||
}
|
}
|
||||||
return fullName;
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
if(surname == null) {
|
||||||
|
surname = getOAuthUserProfile().get(OAUTH_USER_PROFILE_SURNAME_KEY).asText();
|
||||||
|
}
|
||||||
|
return surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEMail() {
|
public String getEMail() {
|
||||||
|
|
|
@ -128,7 +128,8 @@ public class SocialPost extends Thread {
|
||||||
public void sendSocialPost(boolean notifyUsers) {
|
public void sendSocialPost(boolean notifyUsers) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String fullName = CKANUserCache.getCurrrentCKANUser().getPortalUser().getFullName();
|
PortalUser portalUser = CKANUserCache.getCurrrentCKANUser().getPortalUser();
|
||||||
|
String fullName = portalUser.getNameSurname();
|
||||||
|
|
||||||
String basePath = SocialService.getSocialService().getServiceBasePath();
|
String basePath = SocialService.getSocialService().getServiceBasePath();
|
||||||
if(basePath == null) {
|
if(basePath == null) {
|
||||||
|
|
Loading…
Reference in New Issue