|
|
|
@ -37,6 +37,7 @@ import com.liferay.portal.security.permission.PermissionChecker;
|
|
|
|
|
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
|
|
|
|
|
import com.liferay.portal.security.permission.PermissionThreadLocal;
|
|
|
|
|
import com.liferay.portal.service.GroupLocalServiceUtil;
|
|
|
|
|
import com.liferay.portal.service.ImageLocalServiceUtil;
|
|
|
|
|
import com.liferay.portal.service.MembershipRequestLocalServiceUtil;
|
|
|
|
|
import com.liferay.portal.service.RoleLocalServiceUtil;
|
|
|
|
|
import com.liferay.portal.service.RoleServiceUtil;
|
|
|
|
@ -94,7 +95,7 @@ public class LiferayUserManager implements UserManager {
|
|
|
|
|
for (EmailAddress e : u.getEmailAddresses()) {
|
|
|
|
|
emails.add(new Email(e.getAddress(), e.getType().toString(), e.isPrimary()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new GCubeUser(
|
|
|
|
|
u.getUserId(),
|
|
|
|
|
u.getScreenName(),
|
|
|
|
@ -177,7 +178,8 @@ public class LiferayUserManager implements UserManager {
|
|
|
|
|
reminderQuestion,
|
|
|
|
|
reminderAnswer,
|
|
|
|
|
false,
|
|
|
|
|
false);
|
|
|
|
|
false,
|
|
|
|
|
null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -186,7 +188,33 @@ public class LiferayUserManager implements UserManager {
|
|
|
|
|
@Override
|
|
|
|
|
public GCubeUser createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName,
|
|
|
|
|
String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset)
|
|
|
|
|
throws UserManagementSystemException {
|
|
|
|
|
throws UserManagementSystemException {
|
|
|
|
|
return createUserBody(
|
|
|
|
|
autoScreenName,
|
|
|
|
|
username,
|
|
|
|
|
email,
|
|
|
|
|
firstName,
|
|
|
|
|
middleName,
|
|
|
|
|
lastName,
|
|
|
|
|
jobTitle,
|
|
|
|
|
backgroundSummary,
|
|
|
|
|
location_industry,
|
|
|
|
|
male,
|
|
|
|
|
reminderQuestion,
|
|
|
|
|
reminderAnswer,
|
|
|
|
|
sendEmail,
|
|
|
|
|
forcePasswordReset,
|
|
|
|
|
null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* {@inheritDoc}
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public GCubeUser createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName,
|
|
|
|
|
String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset,
|
|
|
|
|
byte[] portraitBytes)
|
|
|
|
|
throws UserManagementSystemException {
|
|
|
|
|
return createUserBody(
|
|
|
|
|
autoScreenName,
|
|
|
|
|
username,
|
|
|
|
@ -201,13 +229,14 @@ public class LiferayUserManager implements UserManager {
|
|
|
|
|
reminderQuestion,
|
|
|
|
|
reminderAnswer,
|
|
|
|
|
sendEmail,
|
|
|
|
|
forcePasswordReset);
|
|
|
|
|
forcePasswordReset,
|
|
|
|
|
portraitBytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private GCubeUser createUserBody(boolean autoScreenName, String username,
|
|
|
|
|
String email, String firstName, String middleName, String lastName,
|
|
|
|
|
String jobTitle, String location_industry, String backgroundSummary, boolean male,
|
|
|
|
|
String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset){
|
|
|
|
|
String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, byte[] portraitBytes){
|
|
|
|
|
|
|
|
|
|
GCubeUser toReturn = null;
|
|
|
|
|
try {
|
|
|
|
@ -264,6 +293,23 @@ public class LiferayUserManager implements UserManager {
|
|
|
|
|
UserLocalServiceUtil.updateReminderQuery(added.getUserId(), reminderQuestion, reminderAnswer);
|
|
|
|
|
_log.debug("User " + lastName + " has agreed to ToU");
|
|
|
|
|
_log.debug("User " + lastName + " updatePasswordReset & updateReminderQuery");
|
|
|
|
|
|
|
|
|
|
// try to change user's avatar
|
|
|
|
|
if(portraitBytes != null){
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
_log.debug("Updating user's avatar");
|
|
|
|
|
UserLocalServiceUtil.updatePortrait(added.getUserId(), portraitBytes);
|
|
|
|
|
_log.debug("User's avatar set OK");
|
|
|
|
|
}catch(PortalException e1){
|
|
|
|
|
_log.debug("Unable to set user's avatar", e1);
|
|
|
|
|
}
|
|
|
|
|
catch(SystemException e1){
|
|
|
|
|
_log.debug("Unable to set user's avatar", e1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mapLRUser(added);
|
|
|
|
|
} catch (SystemException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -734,5 +780,29 @@ public class LiferayUserManager implements UserManager {
|
|
|
|
|
_log.debug("Delete user with email " + email);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public byte[] getUserAvatarBytes(String screenName) {
|
|
|
|
|
try {
|
|
|
|
|
User user = UserLocalServiceUtil.getUserByScreenName(ManagementUtils.getCompany().getCompanyId(), screenName);
|
|
|
|
|
return ImageLocalServiceUtil.getImage(user.getPortraitId()).getTextObj();
|
|
|
|
|
} catch (PortalException e) {
|
|
|
|
|
_log.debug("Unable to retrieve user's avatar", e);
|
|
|
|
|
} catch (SystemException e) {
|
|
|
|
|
_log.debug("Unable to retrieve user's avatar", e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getUserOpenId(String screenName) {
|
|
|
|
|
try {
|
|
|
|
|
User user = UserLocalServiceUtil.getUserByScreenName(ManagementUtils.getCompany().getCompanyId(), screenName);
|
|
|
|
|
return user.getOpenId();
|
|
|
|
|
} catch (PortalException e) {
|
|
|
|
|
_log.debug("Unable to retrieve user's openId", e);
|
|
|
|
|
} catch (SystemException e) {
|
|
|
|
|
_log.debug("Unable to retrieve user's openId", e);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|