removed ASL Session
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/vre-members@134787 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0a8221c38c
commit
98b5009b1f
|
@ -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/vre-members-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/vre-members-2.2.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/vre-members-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/vre-members-2.2.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>
|
||||||
|
@ -39,5 +39,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/vre-members-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/vre-members-2.2.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -4,11 +4,9 @@
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
<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="/src/test/resources"/>
|
<dependent-module archiveName="gcube-widgets-2.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
<dependent-module archiveName="gcube-widgets-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
|
</dependent-module>
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="vre-members"/>
|
<property name="context-root" value="vre-members"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlet.user.vre-members.2-2-0"
|
||||||
|
date="2016-11-25">
|
||||||
|
<Change>Removed ASL Session</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlet.user.vre-members.2-1-0"
|
<Changeset component="org.gcube.portlet.user.vre-members.2-1-0"
|
||||||
date="2016-10-03">
|
date="2016-10-03">
|
||||||
<Change>Added possibility to display VRE Groups and VRE Managers</Change>
|
<Change>Added possibility to display VRE Groups and VRE Managers</Change>
|
||||||
|
|
14
pom.xml
14
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>vre-members</artifactId>
|
<artifactId>vre-members</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<name>gCube VRE Members Portlet</name>
|
<name>gCube VRE Members Portlet</name>
|
||||||
<description>
|
<description>
|
||||||
VRE Members display the members of the current VRE
|
VRE Members display the members of the current VRE
|
||||||
|
@ -77,12 +77,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-widgets</artifactId>
|
<artifactId>gcube-widgets</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.portal</groupId>
|
|
||||||
<artifactId>custom-portal-handler</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google</groupId>
|
<groupId>com.google</groupId>
|
||||||
<artifactId>gwt-jsonmaker</artifactId>
|
<artifactId>gwt-jsonmaker</artifactId>
|
||||||
|
@ -92,11 +87,6 @@
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
|
||||||
<artifactId>aslcore</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-networking-library</artifactId>
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package org.gcube.portlets.user.vremembers.client;
|
package org.gcube.portlets.user.vremembers.client;
|
||||||
|
|
||||||
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
|
|
||||||
import org.gcube.portlets.user.vremembers.client.panels.VREMembersPanel;
|
import org.gcube.portlets.user.vremembers.client.panels.VREMembersPanel;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.user.client.Window.Location;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,15 +11,6 @@ import com.google.gwt.user.client.ui.RootPanel;
|
||||||
public class VreMembers implements EntryPoint {
|
public class VreMembers implements EntryPoint {
|
||||||
|
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
ClientScopeHelper.getService().setScope(Location.getHref(), new AsyncCallback<Boolean>() {
|
RootPanel.get("VRE-Members-Container").add(new VREMembersPanel());
|
||||||
@Override
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
RootPanel.get("VRE-Members-Container").add(new VREMembersPanel());
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
|
||||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
||||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||||
import org.gcube.portlets.user.vremembers.client.MembersService;
|
import org.gcube.portlets.user.vremembers.client.MembersService;
|
||||||
import org.gcube.portlets.user.vremembers.shared.BelongingUser;
|
import org.gcube.portlets.user.vremembers.shared.BelongingUser;
|
||||||
|
@ -40,29 +36,6 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
public class MembersServiceImpl extends RemoteServiceServlet implements MembersService {
|
public class MembersServiceImpl extends RemoteServiceServlet implements MembersService {
|
||||||
private static final Logger _log = LoggerFactory.getLogger(MembersServiceImpl.class);
|
private static final Logger _log = LoggerFactory.getLogger(MembersServiceImpl.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* the current ASLSession
|
|
||||||
* @return the session
|
|
||||||
*/
|
|
||||||
private ASLSession getASLSession() {
|
|
||||||
String sessionID = this.getThreadLocalRequest().getSession().getId();
|
|
||||||
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
|
||||||
if (user == null) {
|
|
||||||
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
|
|
||||||
user = getDevelopmentUser();
|
|
||||||
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube");
|
|
||||||
}
|
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* when packaging test will fail if the user is not set to test.user
|
|
||||||
* @return .
|
|
||||||
*/
|
|
||||||
public String getDevelopmentUser() {
|
|
||||||
String user = "test.user";
|
|
||||||
//user = "massimiliano.assante";
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return true if you're running into the portal, false if in development
|
* @return true if you're running into the portal, false if in development
|
||||||
|
@ -110,7 +83,7 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
|
||||||
user.getLocation_industry(), getUserProfileLink(user.getUsername() ), true));
|
user.getLocation_industry(), getUserProfileLink(user.getUsername() ), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { //developmennt mode
|
} else { //development mode
|
||||||
_log.info("Returning test team members with id = " + groupId );
|
_log.info("Returning test team members with id = " + groupId );
|
||||||
return new VREGroup(teamId, "TestTeam Name", "parent VRE", "Test Team Description", getTestUsers());
|
return new VREGroup(teamId, "TestTeam Name", "parent VRE", "Test Team Description", getTestUsers());
|
||||||
}
|
}
|
||||||
|
@ -120,7 +93,7 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
|
||||||
@Override
|
@Override
|
||||||
public VREGroup getVREManagers() {
|
public VREGroup getVREManagers() {
|
||||||
ArrayList<BelongingUser> vreManagers = new ArrayList<BelongingUser>();
|
ArrayList<BelongingUser> vreManagers = new ArrayList<BelongingUser>();
|
||||||
long currGroupId = getCurrentGroupID();
|
long currGroupId = PortalContext.getConfiguration().getCurrentGroupId(getThreadLocalRequest());
|
||||||
try {
|
try {
|
||||||
long roleId = new LiferayRoleManager().getRole(GCubeRole.VRE_MANAGER_LABEL, currGroupId).getRoleId();
|
long roleId = new LiferayRoleManager().getRole(GCubeRole.VRE_MANAGER_LABEL, currGroupId).getRoleId();
|
||||||
for (GCubeUser user : new LiferayUserManager().listUsersByGroupAndRole(currGroupId, roleId)) {
|
for (GCubeUser user : new LiferayUserManager().listUsersByGroupAndRole(currGroupId, roleId)) {
|
||||||
|
@ -149,30 +122,27 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<BelongingUser> getSiteUsers() {
|
public ArrayList<BelongingUser> getSiteUsers() {
|
||||||
ArrayList<BelongingUser> portalUsers = new ArrayList<BelongingUser>();
|
ArrayList<BelongingUser> portalUsers = new ArrayList<BelongingUser>();
|
||||||
String scope = getASLSession().getScope();
|
String scope = PortalContext.getConfiguration().getCurrentScope(getThreadLocalRequest());
|
||||||
if (scope == null)
|
if (scope == null)
|
||||||
return portalUsers;
|
return portalUsers;
|
||||||
try {
|
try {
|
||||||
if (isWithinPortal()) {
|
if (isWithinPortal()) {
|
||||||
UserManager um = new LiferayUserManager();
|
UserManager um = new LiferayUserManager();
|
||||||
GroupManager gm = new LiferayGroupManager();
|
GroupManager gm = new LiferayGroupManager();
|
||||||
ScopeBean sb = new ScopeBean(scope);
|
|
||||||
List<GCubeUser> users = null;
|
List<GCubeUser> users = null;
|
||||||
|
|
||||||
if (sb.is(Type.INFRASTRUCTURE)) {
|
if (isInfrastructureScope()) {
|
||||||
users = new ArrayList<GCubeUser>();
|
users = new ArrayList<GCubeUser>();
|
||||||
return new ArrayList<BelongingUser>();
|
return new ArrayList<BelongingUser>();
|
||||||
}
|
}
|
||||||
else if (sb.is(Type.VRE)) { //must be in VRE
|
else { //must be in VRE
|
||||||
//get the name from the scope
|
//get the name from the scope
|
||||||
String orgName = scope.substring(scope.lastIndexOf("/")+1, scope.length());
|
String orgName = scope.substring(scope.lastIndexOf("/")+1, scope.length());
|
||||||
//ask the users
|
//ask the users
|
||||||
users = um.listUsersByGroup(gm.getGroupId(orgName));
|
users = um.listUsersByGroup(gm.getGroupId(orgName));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
_log.error("Error, you must be in SCOPE VRE OR INFRASTRUCTURE, you are in VO SCOPE returning no users");
|
|
||||||
return portalUsers;
|
|
||||||
}
|
|
||||||
for (GCubeUser user : users) {
|
for (GCubeUser user : users) {
|
||||||
if (user.getUsername().compareTo("test.user") != 0) { //skip test.user
|
if (user.getUsername().compareTo("test.user") != 0) { //skip test.user
|
||||||
portalUsers.add(
|
portalUsers.add(
|
||||||
|
@ -220,22 +190,17 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
|
||||||
return portalUsers;
|
return portalUsers;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the current group ID
|
* Indicates whether the scope is the whole infrastructure.
|
||||||
*
|
* @return <code>true</code> if it is, <code>false</code> otherwise.
|
||||||
* @return the current group ID or null if an exception is thrown
|
|
||||||
* @throws Exception
|
|
||||||
* @throws CurrentGroupRetrievalException
|
|
||||||
*/
|
*/
|
||||||
private long getCurrentGroupID(){
|
private boolean isInfrastructureScope() {
|
||||||
GroupManager groupM = new LiferayGroupManager();
|
long currGroupId = PortalContext.getConfiguration().getCurrentGroupId(getThreadLocalRequest());
|
||||||
ASLSession session = getASLSession();
|
|
||||||
_log.debug("The current group NAME is --> " + session.getGroupName());
|
|
||||||
try {
|
try {
|
||||||
return groupM.getGroupId(session.getGroupName());
|
return new LiferayGroupManager().isRootVO(currGroupId);
|
||||||
} catch (Exception e) {
|
} catch (UserManagementSystemException | GroupRetrievalFault e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
|
|
||||||
package org.gcube.portlets.user.vremembers.server.portlet;
|
package org.gcube.portlets.user.vremembers.server.portlet;
|
||||||
|
|
||||||
import javax.portlet.GenericPortlet;
|
|
||||||
import javax.portlet.ActionRequest;
|
|
||||||
import javax.portlet.RenderRequest;
|
|
||||||
import javax.portlet.ActionResponse;
|
|
||||||
import javax.portlet.RenderResponse;
|
|
||||||
import javax.portlet.PortletException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.portlet.PortletRequestDispatcher;
|
|
||||||
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import javax.portlet.ActionRequest;
|
||||||
|
import javax.portlet.ActionResponse;
|
||||||
|
import javax.portlet.GenericPortlet;
|
||||||
|
import javax.portlet.PortletException;
|
||||||
|
import javax.portlet.PortletRequestDispatcher;
|
||||||
|
import javax.portlet.RenderRequest;
|
||||||
|
import javax.portlet.RenderResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -19,7 +18,6 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
public class VREMembersPortlet extends GenericPortlet {
|
public class VREMembersPortlet extends GenericPortlet {
|
||||||
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||||
response.setContentType("text/html");
|
response.setContentType("text/html");
|
||||||
ScopeHelper.setContext(request);
|
|
||||||
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/VREMembers_view.jsp");
|
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/VREMembers_view.jsp");
|
||||||
dispatcher.include(request, response);
|
dispatcher.include(request, response);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue