Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. if (_log.isDebugEnabled()) {
  2. _log.debug("Adding user " + ldapUser.getEmailAddress());
  3. }
  4.  
  5. boolean autoPassword = ldapUser.isAutoPassword();
  6.  
  7. if (!PropsValues.LDAP_IMPORT_USER_PASSWORD_ENABLED) {
  8. autoPassword = PropsValues.LDAP_IMPORT_USER_PASSWORD_AUTOGENERATED
  9. && !PropsValues.AUTH_PIPELINE_ENABLE_LIFERAY_CHECK;
  10.  
  11. if (!autoPassword) {
  12. String defaultPassword = PropsValues.LDAP_IMPORT_USER_PASSWORD_DEFAULT;
  13.  
  14. if (StringUtil.equalsIgnoreCase(defaultPassword,
  15. _USER_PASSWORD_SCREEN_NAME)) {
  16.  
  17. defaultPassword = ldapUser.getScreenName();
  18. }
  19.  
  20. password = defaultPassword;
  21. }
  22. }
  23.  
  24. Calendar birthdayCal = CalendarFactoryUtil.getCalendar();
  25.  
  26. birthdayCal.setTime(ldapUser.getBirthday());
  27.  
  28. int birthdayMonth = birthdayCal.get(Calendar.MONTH);
  29. int birthdayDay = birthdayCal.get(Calendar.DAY_OF_MONTH);
  30. int birthdayYear = birthdayCal.get(Calendar.YEAR);
  31.  
  32. User user = UserLocalServiceUtil.addUser(ldapUser.getCreatorUserId(),
  33. companyId, autoPassword, password, password,
  34. ldapUser.isAutoScreenName(), ldapUser.getScreenName(),
  35. ldapUser.getEmailAddress(), 0, StringPool.BLANK,
  36. ldapUser.getLocale(), ldapUser.getFirstName(),
  37. ldapUser.getMiddleName(), ldapUser.getLastName(), 0, 0,
  38. ldapUser.isMale(), birthdayMonth, birthdayDay, birthdayYear,
  39. StringPool.BLANK, ldapUser.getGroupIds(),
  40. ldapUser.getOrganizationIds(), ldapUser.getRoleIds(),
  41. ldapUser.getUserGroupIds(), ldapUser.isSendEmail(),
  42. ldapUser.getServiceContext());
  43. _log.info("-----------------------------------------User||||Added----------------------------------------");
  44.  
  45. if (ldapUser.isUpdatePortrait()) {
  46. byte[] portraitBytes = ldapUser.getPortraitBytes();
  47.  
  48. if (ArrayUtil.isNotEmpty(portraitBytes)) {
  49. user = UserLocalServiceUtil.updatePortrait(user.getUserId(),
  50. portraitBytes);
  51. }
  52. }
  53.  
  54. return user;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement