fix for #577
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:
parent
3d05723743
commit
d179921e63
|
@ -1,5 +1,10 @@
|
||||||
<ReleaseNotes>
|
<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>
|
<Change>First Release</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
</ReleaseNotes>
|
</ReleaseNotes>
|
||||||
|
|
7
pom.xml
7
pom.xml
|
@ -11,9 +11,10 @@
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-mail-servlet</artifactId>
|
<artifactId>social-mail-servlet</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.1.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>
|
<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>
|
<properties>
|
||||||
<java-version>1.7</java-version>
|
<java-version>1.7</java-version>
|
||||||
<liferay-version>6.0.6</liferay-version>
|
<liferay-version>6.0.6</liferay-version>
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class PortalSchedulerService extends HttpServlet {
|
||||||
|
|
||||||
private static final Logger _log = LoggerFactory.getLogger(PortalSchedulerService.class);
|
private static final Logger _log = LoggerFactory.getLogger(PortalSchedulerService.class);
|
||||||
private static final int POP3_MINUTES_DELAY = 1;
|
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;
|
private static DatabookStore store;
|
||||||
|
|
||||||
|
|
|
@ -21,21 +21,25 @@ import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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.PortalException;
|
||||||
import com.liferay.portal.kernel.exception.SystemException;
|
import com.liferay.portal.kernel.exception.SystemException;
|
||||||
import com.liferay.portal.model.Organization;
|
import com.liferay.portal.model.Organization;
|
||||||
import com.liferay.portal.model.User;
|
import com.liferay.portal.model.User;
|
||||||
import com.liferay.portal.service.OrganizationLocalServiceUtil;
|
import com.liferay.portal.service.OrganizationLocalServiceUtil;
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
|
import com.liferay.portal.service.UserServiceUtil;
|
||||||
|
|
||||||
public class LDAPSync implements Runnable {
|
public class LDAPSync implements Runnable {
|
||||||
private static final Logger _log = LoggerFactory.getLogger(LDAPSync.class);
|
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 ldapUrl = "ldap://ldap-liferay.d4science.org";
|
||||||
private static final String filter = "(objectClass=inetOrgPerson)";
|
private static final String filter = "(objectClass=inetOrgPerson)";
|
||||||
|
private static final String ldapPrincipal = "cn=admin,dc=d4science,dc=org";
|
||||||
private static final String ldapPrincipal = "";
|
private static final String ldapPwd = "poiwefhaewfkhj";
|
||||||
private static final String ldapPwd = "";
|
// private static final String ldapPrincipal = "";
|
||||||
|
// private static final String ldapPwd = "";
|
||||||
|
|
||||||
|
|
||||||
public LDAPSync() {
|
public LDAPSync() {
|
||||||
|
@ -49,7 +53,7 @@ public class LDAPSync implements Runnable {
|
||||||
List<User> users = null;
|
List<User> users = null;
|
||||||
try {
|
try {
|
||||||
users = getAllLiferayUsers();
|
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) {
|
} catch (Exception e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -147,11 +151,12 @@ public class LDAPSync implements Runnable {
|
||||||
|
|
||||||
private List<User> getAllLiferayUsers() {
|
private List<User> getAllLiferayUsers() {
|
||||||
String infraName = PortalContext.getConfiguration().getInfrastructureName();
|
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>();
|
List<User> toReturn = new ArrayList<User>();
|
||||||
Organization rootInfra;
|
Organization rootInfra;
|
||||||
try {
|
try {
|
||||||
|
CacheRegistryUtil.clear();
|
||||||
rootInfra = OrganizationLocalServiceUtil.getOrganization(OrganizationsUtil.getCompany().getCompanyId(), infraName);
|
rootInfra = OrganizationLocalServiceUtil.getOrganization(OrganizationsUtil.getCompany().getCompanyId(), infraName);
|
||||||
toReturn = UserLocalServiceUtil.getOrganizationUsers(rootInfra.getOrganizationId());
|
toReturn = UserLocalServiceUtil.getOrganizationUsers(rootInfra.getOrganizationId());
|
||||||
} catch (PortalException | SystemException e) {
|
} catch (PortalException | SystemException e) {
|
||||||
|
|
Loading…
Reference in New Issue