Feature #16194, Isolate Gateway user list in Messages

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/message-conversations@178377 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2019-02-28 15:42:30 +00:00
parent 3cd5a30c1b
commit c5976d8938
5 changed files with 19 additions and 20 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/messages-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/messages-2.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/messages-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/messages-2.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -22,7 +22,7 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/messages-2.1.0-SNAPSHOT/WEB-INF/classes" path="target/generated-sources/gwt"> <classpathentry kind="src" output="target/messages-2.3.0-SNAPSHOT/WEB-INF/classes" path="target/generated-sources/gwt">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/messages-2.1.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/messages-2.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -5,12 +5,6 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="workspace-explorer-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-explorer-TRUNK-1.5.0-SNAPSHOT/workspace-explorer-TRUNK-1.5.0-SNAPSHOT">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="storagehub-icons-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/storagehub-icons-library/storagehub-icons-library">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="client-context-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/client-context-library/client-context-library"> <dependent-module archiveName="client-context-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/client-context-library/client-context-library">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>

View File

@ -1,4 +1,8 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-user.messages.2-3-0"
date="2019-02-28">
<Change>Feature #16194, Isolate Gateway user list in Messages</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.messages.2-1-0" <Changeset component="org.gcube.portlets-user.messages.2-1-0"
date="2018-06-14"> date="2018-06-14">
<Change>Updated Workspace Explorer dependency</Change> <Change>Updated Workspace Explorer dependency</Change>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portets.user</groupId> <groupId>org.gcube.portets.user</groupId>
<artifactId>messages</artifactId> <artifactId>messages</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>2.1.0-SNAPSHOT</version> <version>2.3.0-SNAPSHOT</version>
<description> <description>
gCube Messages Portlet for exchanging messages with other users. gCube Messages Portlet for exchanging messages with other users.
</description> </description>
@ -60,6 +60,10 @@
<artifactId>workspace-explorer</artifactId> <artifactId>workspace-explorer</artifactId>
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version> <version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId> <artifactId>aslsocial</artifactId>

View File

@ -43,11 +43,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
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.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil;
import com.liferay.portal.model.User; import com.liferay.portal.model.User;
import com.liferay.portal.service.GroupLocalServiceUtil; import com.liferay.portal.service.GroupLocalServiceUtil;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
@ -340,14 +337,14 @@ public class ConvServiceImpl extends RemoteServiceServlet implements MessageServ
public ArrayList<WSUser> searchUsers(String keyword) { public ArrayList<WSUser> searchUsers(String keyword) {
ArrayList<WSUser> toReturn = new ArrayList<>(); ArrayList<WSUser> toReturn = new ArrayList<>();
if (isWithinPortal()) { if (isWithinPortal()) {
OrderByComparator comparator = OrderByComparatorFactoryUtil.create("User_", "screenname", true); long gatewayGroupId = pContext.getCurrentGroupId(this.getThreadLocalRequest());
try { try {
_log.debug("Searching " + keyword); _log.debug("Searching " + keyword);
List<User> lrUsers = UserLocalServiceUtil.search(ManagementUtils.getCompany().getCompanyId(), keyword, 0, null, QueryUtil.ALL_POS, QueryUtil.ALL_POS, comparator); List<GCubeUser> users = um.searchUsersByGroup(keyword, gatewayGroupId);
for (User user : lrUsers) { for (GCubeUser user : users) {
toReturn.add(new WSUser(""+user.getUserId(), user.getScreenName(), user.getFullName(), extractDomainFromEmail(user.getEmailAddress()))); toReturn.add(new WSUser(""+user.getUserId(), user.getUsername(), user.getFullname(), extractDomainFromEmail(user.getEmail())));
} }
} catch (SystemException | PortalException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} else { //development } else { //development