added ClientScopeHandler to help prevent the back button cache problem in Chrome and Firefox
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gcube-loggedin@102001 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ecccd2a67c
commit
3d2f743533
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/gcube-loggedin-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/gcube-loggedin-2.5.1-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"/>
|
||||||
|
@ -31,5 +31,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/gcube-loggedin-2.5.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/gcube-loggedin-2.5.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
jarsExcludedFromWebInfLib=
|
jarsExcludedFromWebInfLib=
|
||||||
lastWarOutDir=/Users/massi/Documents/workspace/gcube-loggedin/target/gcube-loggedin-2.5.0-SNAPSHOT
|
lastWarOutDir=/Users/massi/Documents/workspace/gcube-loggedin/target/gcube-loggedin-2.5.1-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
<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"/>
|
||||||
|
<dependent-module archiveName="gcube-widgets-1.9.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
<dependent-module archiveName="session-checker-0.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
<dependent-module archiveName="session-checker-0.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -13,7 +13,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-loggedin</artifactId>
|
<artifactId>gcube-loggedin</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.5.0-SNAPSHOT</version>
|
<version>2.5.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>gCube Loggedin Portlet</name>
|
<name>gCube Loggedin Portlet</name>
|
||||||
<description>
|
<description>
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>gcube-widgets</artifactId>
|
<artifactId>gcube-widgets</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.Window.Location;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
@ -35,7 +36,7 @@ public class GCubeLoggedin implements EntryPoint {
|
||||||
// Associate the new panel with the HTML host page.
|
// Associate the new panel with the HTML host page.
|
||||||
RootPanel.get("LoggedinDiv").add(main_panel);
|
RootPanel.get("LoggedinDiv").add(main_panel);
|
||||||
|
|
||||||
loggedinService.getSelectedRE(new AsyncCallback<VObject>() {
|
loggedinService.getSelectedRE(Location.getHref(), new AsyncCallback<VObject>() {
|
||||||
public void onFailure(Throwable caught) { }
|
public void onFailure(Throwable caught) { }
|
||||||
|
|
||||||
public void onSuccess(VObject result) {
|
public void onSuccess(VObject result) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
@RemoteServiceRelativePath("LoggedinServiceImpl")
|
@RemoteServiceRelativePath("LoggedinServiceImpl")
|
||||||
public interface LoggedinService extends RemoteService {
|
public interface LoggedinService extends RemoteService {
|
||||||
|
|
||||||
VObject getSelectedRE();
|
VObject getSelectedRE(String portalURL);
|
||||||
|
|
||||||
String getDefaultCommunityURL();
|
String getDefaultCommunityURL();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
public interface LoggedinServiceAsync {
|
public interface LoggedinServiceAsync {
|
||||||
|
|
||||||
|
|
||||||
void getSelectedRE(AsyncCallback<VObject> callback);
|
void getSelectedRE(String portalURL, AsyncCallback<VObject> callback);
|
||||||
|
|
||||||
|
|
||||||
void getDefaultCommunityURL(AsyncCallback<String> callback);
|
void getDefaultCommunityURL(AsyncCallback<String> callback);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.gcube.portlets.user.gcubeloggedin.client.LoggedinService;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VObject.UserBelongingClient;
|
import org.gcube.portlets.user.gcubeloggedin.shared.VObject.UserBelongingClient;
|
||||||
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
|
import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
|
||||||
|
import org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
|
@ -46,6 +47,7 @@ import com.liferay.portal.security.permission.PermissionChecker;
|
||||||
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
|
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
|
||||||
import com.liferay.portal.security.permission.PermissionThreadLocal;
|
import com.liferay.portal.security.permission.PermissionThreadLocal;
|
||||||
import com.liferay.portal.service.GroupLocalServiceUtil;
|
import com.liferay.portal.service.GroupLocalServiceUtil;
|
||||||
|
import com.liferay.portal.service.OrganizationLocalServiceUtil;
|
||||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
import com.liferay.portal.theme.ThemeDisplay;
|
import com.liferay.portal.theme.ThemeDisplay;
|
||||||
|
|
||||||
|
@ -94,19 +96,33 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
* return the current selected VRE
|
* return the current selected VRE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public VObject getSelectedRE() {
|
public VObject getSelectedRE(String portalURL) {
|
||||||
ASLSession aslSession = getASLSession();
|
ASLSession aslSession = getASLSession();
|
||||||
String username = aslSession.getUsername();
|
String username = aslSession.getUsername();
|
||||||
if (! isWithinPortal()) {
|
String friendlyURL = ScopeServiceImpl.extractOrgFriendlyURL(portalURL);
|
||||||
|
|
||||||
|
if (friendlyURL == null) {//the URL is not a portal URL, we are in devmode.
|
||||||
return new VREClient("Test", "", "" +
|
return new VREClient("Test", "", "" +
|
||||||
"Fishery and Aquaculture Resources Management (FARM) Virtual Organisation</b> The FARM Virtual Organisation is the <b><i>dynamic group of individuals</i></b> and/or <b><i>institutions</i></b> defined around a set of <b><i>sharing rules</i></b> in which <b><i>resource providers</i></b> and <b><i>consumers</i></b> specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the <b><i>Fisheries and Aquaculture Resources Management</i></b>. This VO is conceived to support various application scenarios arising in the FARM Community including the production of Fisheries and Aquaculture Country Profiles, the management of catch statistics including harmonisation, the dynamic generation of biodiversity maps and species distribution maps. This Virtual Organisation currently consists of:<ul> <li> approximately <b><i>13 gCube nodes</i></b>, i.e. machines dedicated to run the gCube system;</li> <li> approximately <b><i>89 running instances</i></b>, i.e. running gCube services supporting the operation of the infrastructure;</li> <li> approximately <b><i>25 collections</i></b>, i.e. set of D4Science Information Objects including Earth images, AquaMaps, Graphs on catch statistics;</li> <li> approximately <b><i>66 metadata collections</i></b>, i.e. set of Metadata Objects describing the Information Objects through various features and schemas;</li> <li> approximately <b><i>58 other resources</i></b> including transformation programs, index types, etc.</li></ul></div>" +
|
"Fishery and Aquaculture Resources Management (FARM) Virtual Organisation</b> The FARM Virtual Organisation is the <b><i>dynamic group of individuals</i></b> and/or <b><i>institutions</i></b> defined around a set of <b><i>sharing rules</i></b> in which <b><i>resource providers</i></b> and <b><i>consumers</i></b> specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the <b><i>Fisheries and Aquaculture Resources Management</i></b>. This VO is conceived to support various application scenarios arising in the FARM Community including the production of Fisheries and Aquaculture Country Profiles, the management of catch statistics including harmonisation, the dynamic generation of biodiversity maps and species distribution maps. This Virtual Organisation currently consists of:<ul> <li> approximately <b><i>13 gCube nodes</i></b>, i.e. machines dedicated to run the gCube system;</li> <li> approximately <b><i>89 running instances</i></b>, i.e. running gCube services supporting the operation of the infrastructure;</li> <li> approximately <b><i>25 collections</i></b>, i.e. set of D4Science Information Objects including Earth images, AquaMaps, Graphs on catch statistics;</li> <li> approximately <b><i>66 metadata collections</i></b>, i.e. set of Metadata Objects describing the Information Objects through various features and schemas;</li> <li> approximately <b><i>58 other resources</i></b> including transformation programs, index types, etc.</li></ul></div>" +
|
||||||
"", "", "", UserBelongingClient.BELONGING, false, true);
|
"", "", "", UserBelongingClient.BELONGING, false, true);
|
||||||
}
|
}
|
||||||
_log.trace("getting Selected Research Environment");
|
_log.trace("getting Selected Research Environment");
|
||||||
|
Organization currOrg = null;
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
try {
|
||||||
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
List<Group> groups = GroupLocalServiceUtil.getGroups(0, GroupLocalServiceUtil.getGroupsCount());
|
||||||
Organization currOrg = (Organization) session.getAttribute("CURR_RE_NAME");
|
for (Group g : groups) {
|
||||||
|
if (g.isOrganization() || g.isCommunity())
|
||||||
|
if (g.getFriendlyURL().compareTo(friendlyURL) == 0) {
|
||||||
|
long organizationId = g.getClassPK();
|
||||||
|
currOrg = OrganizationLocalServiceUtil.getOrganization(organizationId);
|
||||||
|
String scopeToSet = ScopeServiceImpl.buildScope(g);
|
||||||
|
getASLSession().setScope(scopeToSet);
|
||||||
|
_log.info("GOT Selected Research Environment: " + scopeToSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the current ORG bean in session
|
* set the current ORG bean in session
|
||||||
|
@ -120,6 +136,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
|
|
||||||
String name = currOrg.getName();
|
String name = currOrg.getName();
|
||||||
long logoId = currOrg.getLogoId();
|
long logoId = currOrg.getLogoId();
|
||||||
|
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
||||||
String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
|
String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
|
||||||
String desc = "";
|
String desc = "";
|
||||||
//set the description for the vre
|
//set the description for the vre
|
||||||
|
@ -320,7 +337,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeUserFromHLGroup(String username, String group) {
|
private void removeUserFromHLGroup(String username, String group) {
|
||||||
try {
|
try {
|
||||||
org.gcube.common.homelibrary.home.workspace.usermanager.UserManager um = HomeLibrary.getHomeManagerFactory().getUserManager();
|
org.gcube.common.homelibrary.home.workspace.usermanager.UserManager um = HomeLibrary.getHomeManagerFactory().getUserManager();
|
||||||
um.removeUserFromGroup(group, username, getASLSession().getUsername());
|
um.removeUserFromGroup(group, username, getASLSession().getUsername());
|
||||||
} catch (InternalErrorException e) {
|
} catch (InternalErrorException e) {
|
||||||
|
@ -432,7 +449,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
||||||
//catch exception in case properties file does not exist
|
//catch exception in case properties file does not exist
|
||||||
catch(IOException e) {
|
catch(IOException e) {
|
||||||
_log.warn("$CATALINA_HOME/conf/gcube-data.properties not found, Returning gateway name: " + gatewayLabel);
|
_log.warn("$CATALINA_HOME/conf/gcube-data.properties not found, Returning gateway name: " + gatewayLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return gatewayLabel;
|
return gatewayLabel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<!-- Inherit the core Web Toolkit stuff. -->
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
<inherits name='com.google.gwt.user.User' />
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
<set-property name="user.agent" value="gecko1_8,safari" />
|
<!-- <set-property name="user.agent" value="gecko1_8,safari" /> -->
|
||||||
|
|
||||||
|
|
||||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||||
|
|
|
@ -5,20 +5,20 @@
|
||||||
|
|
||||||
<web-app>
|
<web-app>
|
||||||
|
|
||||||
<!-- Servlets -->
|
<!-- Servlets -->
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>LoggedinServiceImpl</servlet-name>
|
<servlet-name>LoggedinServiceImpl</servlet-name>
|
||||||
<servlet-class>org.gcube.portlets.user.gcubeloggedin.server.LoggedinServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.user.gcubeloggedin.server.LoggedinServiceImpl</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>LoggedinServiceImpl</servlet-name>
|
<servlet-name>LoggedinServiceImpl</servlet-name>
|
||||||
<url-pattern>/gcubeloggedin/LoggedinServiceImpl</url-pattern>
|
<url-pattern>/gcubeloggedin/LoggedinServiceImpl</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<!-- Default page to serve -->
|
<!-- Default page to serve -->
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>GCubeLoggedin.html</welcome-file>
|
<welcome-file>GCubeLoggedin.html</welcome-file>
|
||||||
</welcome-file-list>
|
</welcome-file-list>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
Loading…
Reference in New Issue