Hi, I have been working in a simple solution to redirect users to their "default sites". It is not a perfect solution, but it works. However I would thank your collaboration to improve it.This is my tomcat/webapps/share/site-index.jsp modified file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page import="org.alfresco.web.site.*" %>
<%@ page import="org.springframework.extensions.surf.*" %>
<%@ page import="org.springframework.extensions.surf.site.*" %>
<%@ page import="org.springframework.extensions.surf.util.*" %>
<%@ page import="java.util.*" %>
<%@ page import="org.springframework.extensions.webscripts.connector.*" %>
<%
String redirection = "";
// retrieve user name from the session
String userid = (String)session.getAttribute(SlingshotUserFactory.SESSION_ATTRIBUTE_KEY_USER_ID);
// test user dashboard page exists?
RequestContext context = (RequestContext)request.getAttribute(RequestContext.ATTR_REQUEST_CONTEXT);
if (context.getObjectService().getPage("user/" + userid + "/dashboard") == null)
{
// no site found! create initial dashboard for this user…
Map<String, String> tokens = new HashMap<String, String>();
tokens.put("userid", userid);
FrameworkUtil.getServiceRegistry().getPresetsManager().constructPreset("user-dashboard", tokens);
}
User user = context.getUser();
//user.setProperty( "defaultSite", "central" ); // this property was not perisistent so it was disscarded
//user.setSkype("central");// use skype property instead
//user.save();
String defaultSite = user.getSkype();//here "defaultSite" is stored
if( defaultSite == null )
{
// forward to user specific dashboard page
redirection = request.getContextPath() + "/page/user/" + URLEncoder.encode(userid) + "/dashboard";
}
else
{
redirection = request.getContextPath() + "/page/site/" + defaultSite + "/documentlibrary" ;
}
response.sendRedirect( redirection );
%>
(Temporary it uses "Skype" property to store default site. )Suggestions and comments are welcome.