added skipping email not having feedid

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-mail-servlet@117406 82a268e6-3cf1-43bd-a215-b396298e98cf
Feature/21689
Massimiliano Assante 9 years ago
parent eb38012be0
commit f62d01ed69

@ -64,7 +64,7 @@ public class LDAPSync implements Runnable {
DirContext ctx = new InitialDirContext(env);
_log.debug("Initiating LDAP Sync ...");
for (User user : users) {
updateUserInLDAP(user.getScreenName(), user.getFirstName(), user.getLastName(), user.getEmailAddress(), "{SHA}"+user.getPassword(), ctx, filter);
updateUserInLDAP(user.getScreenName(), user.getFirstName(), user.getLastName(), user.getFullName(), user.getEmailAddress(), "{SHA}"+user.getPassword(), ctx, filter);
//_log.debug("Updated " + user.getScreenName());
}
_log.debug("LDAP Sync cycle done");
@ -104,19 +104,22 @@ public class LDAPSync implements Runnable {
* @param ctx
* @throws NamingException
*/
private void updateUserInLDAP(String username, String name, String lastName, String email, String passwd, DirContext ctx, String filter) throws NamingException {
private void updateUserInLDAP(String username, String name, String lastName, String fullName, String email, String passwd, DirContext ctx, String filter) throws NamingException {
Attributes attributes=new BasicAttributes();
Attribute objectClass=new BasicAttribute("objectClass");
objectClass.add("inetOrgPerson");
attributes.put(objectClass);
Attribute sn = new BasicAttribute("sn");
//the main ldap server uses 'givenName' for the First name, 'cn' for "first name last name', 'sn' for the last name
Attribute givenName = new BasicAttribute("givenName");
Attribute cn = new BasicAttribute("cn");
Attribute sn = new BasicAttribute("sn");
Attribute mail = new BasicAttribute("mail");
Attribute userPassword = new BasicAttribute("userPassword");
sn.add(name);
cn.add(lastName);
givenName.add(name);
cn.add(fullName);
sn.add(lastName);
mail.add(email);
userPassword.add(passwd);

@ -105,7 +105,7 @@ public class PeriodicTask implements Runnable {
_log.debug("Created fakesession for user " + username + " email="+emailAddress);
} catch (PortalException | SystemException e) {
e.printStackTrace();
_log.error("Exception while trying to get the user from email address: " + e.getMessage());
}
@ -206,6 +206,12 @@ public class PeriodicTask implements Runnable {
* @param fakeSession
*/
private void favoriteFeed(String feedId, ASLSession fakeSession) {
if (feedId == null || feedId.compareTo("") == 0) {
_log.warn("Found email with no feedId from " + fakeSession.getUserEmailAddress() + ". Going to trash it");
return;
}
Like like = new Like(UUID.randomUUID().toString(), fakeSession.getUsername(),
new Date(), feedId, fakeSession.getUserFullName(), fakeSession.getUserAvatarId());

Loading…
Cancel
Save