git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-mail-servlet@118972 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-09-22 15:34:58 +00:00
parent 3d05723743
commit d179921e63
4 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,10 @@
<ReleaseNotes>
<Changeset component="org.gcube.portal.social-mail-servlet.1-0-0" date="2015-07-07">
<Changeset component="org.gcube.portal.social-mail-servlet.1-1-0"
date="2015-09-22">
<Change>Fix for #577</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-0-0"
date="2015-07-07">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

View File

@ -11,9 +11,10 @@
<groupId>org.gcube.portal</groupId>
<artifactId>social-mail-servlet</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>social-mail-servlet Maven Webapp</name>
<description>This component read periodically email replies from user wanting to reply to a post via email</description>
<version>1.1.0-SNAPSHOT</version>
<name>social-mail-servlet Webapp</name>
<description>This component read periodically email replies from user wanting to reply to a post via email and exports users in LDAP</description>
<properties>
<java-version>1.7</java-version>
<liferay-version>6.0.6</liferay-version>

View File

@ -34,7 +34,7 @@ public class PortalSchedulerService extends HttpServlet {
private static final Logger _log = LoggerFactory.getLogger(PortalSchedulerService.class);
private static final int POP3_MINUTES_DELAY = 1;
private static final int LDAP_MINUTES_DELAY = 10;
private static final int LDAP_MINUTES_DELAY = 15;
private static DatabookStore store;

View File

@ -21,21 +21,25 @@ import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.User;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.service.UserServiceUtil;
public class LDAPSync implements Runnable {
private static final Logger _log = LoggerFactory.getLogger(LDAPSync.class);
//TODO_ Move it to Runtime Resource
//TODO Move it to Runtime Resource
private static final String ldapUrl = "ldap://ldap-liferay.d4science.org";
private static final String filter = "(objectClass=inetOrgPerson)";
private static final String ldapPrincipal = "";
private static final String ldapPwd = "";
private static final String ldapPrincipal = "cn=admin,dc=d4science,dc=org";
private static final String ldapPwd = "poiwefhaewfkhj";
// private static final String ldapPrincipal = "";
// private static final String ldapPwd = "";
public LDAPSync() {
@ -49,7 +53,7 @@ public class LDAPSync implements Runnable {
List<User> users = null;
try {
users = getAllLiferayUsers();
_log.debug("Read " + users.size() + " from LR DB");
_log.debug("\n\n\n ******** Read " + users.size() + " from LR DB\n\n");
} catch (Exception e1) {
e1.printStackTrace();
}
@ -147,11 +151,12 @@ public class LDAPSync implements Runnable {
private List<User> getAllLiferayUsers() {
String infraName = PortalContext.getConfiguration().getInfrastructureName();
_log.info("Reading users belonging to: /" + infraName);
_log.info("TRY Reading non chached users belonging to: /" + infraName);
List<User> toReturn = new ArrayList<User>();
Organization rootInfra;
try {
CacheRegistryUtil.clear();
rootInfra = OrganizationLocalServiceUtil.getOrganization(OrganizationsUtil.getCompany().getCompanyId(), infraName);
toReturn = UserLocalServiceUtil.getOrganizationUsers(rootInfra.getOrganizationId());
} catch (PortalException | SystemException e) {