diff --git a/project-build.xml b/project-build.xml index f8232c9459..9f216bcb98 100644 --- a/project-build.xml +++ b/project-build.xml @@ -7,14 +7,8 @@ - - - - - - - + @@ -90,9 +84,5 @@ - - - - diff --git a/project.properties b/project.properties index 6d354fb696..c4417501cc 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,2 @@ webinf.delete.tomcat=jboss*.xml,portlet*.xml,alfresco-object.xml webinf.lib.delete.jboss=log4j-1.2.8.jar,portlet-api-lib.jar,myfaces-api.jar,myfaces-impl.jar - -files.faces.config=/WEB-INF/faces-config-app.xml,/WEB-INF/faces-config-beans.xml,/WEB-INF/faces-config-navigation.xml,/WEB-INF/faces-config-common.xml,/WEB-INF/faces-config-repo.xml diff --git a/source/java/org/alfresco/web/app/Application.java b/source/java/org/alfresco/web/app/Application.java index 2812dec7bd..f7502318de 100644 --- a/source/java/org/alfresco/web/app/Application.java +++ b/source/java/org/alfresco/web/app/Application.java @@ -62,7 +62,7 @@ public class Application public static final String MESSAGE_BUNDLE = "alfresco.messages.webclient"; - private static boolean inPortalServer = false; + private static ThreadLocal inPortalServer = new ThreadLocal(); private static StoreRef repoStoreRef; private static String rootPath; private static String companyRootId; @@ -87,7 +87,7 @@ public class Application */ public static void setInPortalServer(boolean inPortal) { - inPortalServer = inPortal; + inPortalServer.set(inPortal); } /** @@ -97,7 +97,7 @@ public class Application */ public static boolean inPortalServer() { - return inPortalServer; + return (inPortalServer.get() != null ? inPortalServer.get() : false); } /** diff --git a/source/java/org/alfresco/web/app/ContextListener.java b/source/java/org/alfresco/web/app/ContextListener.java index 5339dadf88..12b2d6e245 100644 --- a/source/java/org/alfresco/web/app/ContextListener.java +++ b/source/java/org/alfresco/web/app/ContextListener.java @@ -174,16 +174,17 @@ public class ContextListener implements ServletContextListener, HttpSessionListe { if (logger.isDebugEnabled()) logger.debug("HTTP session destroyed: " + event.getSession().getId()); - User user; + String userKey; if (Application.inPortalServer() == false) { - user = (User)event.getSession().getAttribute(AuthenticationHelper.AUTHENTICATION_USER); + userKey = AuthenticationHelper.AUTHENTICATION_USER; } else { - user = (User)event.getSession().getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AuthenticationHelper.AUTHENTICATION_USER); + userKey = AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AuthenticationHelper.AUTHENTICATION_USER; } + User user = (User)event.getSession().getAttribute(userKey); if (user != null) { // invalidate ticket and clear the Security context for this thread @@ -191,7 +192,7 @@ public class ContextListener implements ServletContextListener, HttpSessionListe AuthenticationService authService = (AuthenticationService)ctx.getBean("authenticationService"); authService.invalidateTicket(user.getTicket()); authService.clearCurrentSecurityContext(); - event.getSession().removeAttribute(AuthenticationHelper.AUTHENTICATION_USER); + event.getSession().removeAttribute(userKey); } } } diff --git a/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java b/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java index b4c3aac76b..d0806c80bf 100644 --- a/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java +++ b/source/java/org/alfresco/web/app/servlet/AuthenticationHelper.java @@ -107,6 +107,8 @@ public final class AuthenticationHelper } else { + // TODO: this prefix is not consistent between JSR-168 vendors! + // we need a solution for each vendor? user = (User)session.getAttribute(AlfrescoFacesPortlet.MANAGED_BEAN_PREFIX + AUTHENTICATION_USER); } diff --git a/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java b/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java index 13ca6808ba..46cb40b794 100644 --- a/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java +++ b/source/java/org/alfresco/web/app/servlet/TemplateContentServlet.java @@ -168,7 +168,7 @@ public class TemplateContentServlet extends BaseServlet } // create the model - put the supplied noderef in as space/document as appropriate - Object model = getModel(serviceRegistry, req, nodeRef); + Object model = getModel(serviceRegistry, req, templateRef, nodeRef); // process the template against the node content directly to the response output stream // assuming the repo is capable of streaming in chunks, this should allow large files @@ -218,11 +218,12 @@ public class TemplateContentServlet extends BaseServlet * * @param services ServiceRegistry required for TemplateNode construction * @param req Http request - for accessing Session and url args + * @param templateRef NodeRef of the template itself * @param nodeRef NodeRef of the space/document to process template against * * @return an object model ready for executing template against */ - private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef nodeRef) + private Object getModel(ServiceRegistry services, HttpServletRequest req, NodeRef templateRef, NodeRef nodeRef) { // build FreeMarker default model and merge Map root = DefaultModelHelper.buildDefaultModel(services, Application.getCurrentUser(req.getSession())); @@ -231,6 +232,7 @@ public class TemplateContentServlet extends BaseServlet TemplateNode node = new TemplateNode(nodeRef, services, this.imageResolver); root.put("space", node); root.put("document", node); + root.put("template", new TemplateNode(templateRef, services, this.imageResolver)); // add URL arguments as a map called 'args' to the root of the model Map args = new HashMap(8, 1.0f); diff --git a/source/java/org/alfresco/web/app/servlet/command/ExecuteScriptCommand.java b/source/java/org/alfresco/web/app/servlet/command/ExecuteScriptCommand.java index 1d01ed4763..6255c33c4b 100644 --- a/source/java/org/alfresco/web/app/servlet/command/ExecuteScriptCommand.java +++ b/source/java/org/alfresco/web/app/servlet/command/ExecuteScriptCommand.java @@ -87,6 +87,7 @@ public final class ExecuteScriptCommand implements Command personRef, new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId()), (NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER), + scriptRef, docRef, spaceRef, DefaultModelHelper.imageResolver); diff --git a/source/java/org/alfresco/web/bean/LoginBean.java b/source/java/org/alfresco/web/bean/LoginBean.java index 112ed266eb..896d5c117d 100644 --- a/source/java/org/alfresco/web/bean/LoginBean.java +++ b/source/java/org/alfresco/web/bean/LoginBean.java @@ -27,11 +27,9 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.model.SelectItem; import javax.faces.validator.ValidatorException; -import javax.portlet.PortletRequest; import javax.servlet.http.HttpServletRequest; import org.alfresco.config.Config; -import org.alfresco.config.ConfigService; import org.alfresco.model.ContentModel; import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.service.cmr.repository.InvalidNodeRefException; @@ -305,14 +303,14 @@ public class LoginBean // if a redirect URL has been provided then use that // this allows servlets etc. to provide a URL to return too after a successful login - String redirectURL = (String)fc.getExternalContext().getSessionMap().get(LOGIN_REDIRECT_KEY); + String redirectURL = (String)session.get(LOGIN_REDIRECT_KEY); if (redirectURL != null) { if (logger.isDebugEnabled()) logger.debug("Redirect URL found: " + redirectURL); // remove redirect URL from session - fc.getExternalContext().getSessionMap().remove(LOGIN_REDIRECT_KEY); + session.remove(LOGIN_REDIRECT_KEY); try { @@ -355,30 +353,39 @@ public class LoginBean { FacesContext context = FacesContext.getCurrentInstance(); - Map session = context.getExternalContext().getSessionMap(); - User user = (User) session.get(AuthenticationHelper.AUTHENTICATION_USER); - // need to capture this value before invalidating the session boolean externalAuth = isAlfrescoAuth(); // Invalidate Session for this user. - // This causes the sessionDestroyed() event to be processed by ContextListener - // which is responsible for invalidating the ticket and clearing the security context if (Application.inPortalServer() == false) { + // This causes the sessionDestroyed() event to be processed by ContextListener + // which is responsible for invalidating the ticket and clearing the security context HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); request.getSession().invalidate(); } else { - PortletRequest request = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); - request.getPortletSession().invalidate(); + Map session = context.getExternalContext().getSessionMap(); + User user = (User)session.get(AuthenticationHelper.AUTHENTICATION_USER); + if (user != null) + { + // invalidate ticket and clear the Security context for this thread + authenticationService.invalidateTicket(user.getTicket()); + authenticationService.clearCurrentSecurityContext(); + } + // remove all objects from our session by hand + // we do this as invalidating the Portal session would invalidate all other portlets! + for (Object key : session.keySet()) + { + session.remove(key); + } } // Request that the username cookie state is removed - this is not // possible from JSF - so instead we setup a session variable // which will be detected by the login.jsp/Portlet as appropriate. - session = context.getExternalContext().getSessionMap(); + Map session = context.getExternalContext().getSessionMap(); session.put(AuthenticationHelper.SESSION_INVALIDATED, true); // set language to last used diff --git a/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java b/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java index 7f32a07573..4cca5046ee 100644 --- a/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java +++ b/source/java/org/alfresco/web/config/AdvancedSearchConfigElement.java @@ -104,6 +104,14 @@ public class AdvancedSearchConfigElement extends ConfigElementAdapter } } + if (newElement.getFolderTypes() != null) + { + for (String type : newElement.getFolderTypes()) + { + combinedElement.addFolderType(type); + } + } + if (newElement.getCustomProperties() != null) { for (CustomProperty property : newElement.getCustomProperties()) diff --git a/source/web/WEB-INF/faces-config-custom.xml b/source/web/WEB-INF/faces-config-custom.xml new file mode 100644 index 0000000000..82acb532e1 --- /dev/null +++ b/source/web/WEB-INF/faces-config-custom.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/source/web/WEB-INF/web_TEMPLATE.xml b/source/web/WEB-INF/web_TEMPLATE.xml deleted file mode 100644 index de3b94029a..0000000000 --- a/source/web/WEB-INF/web_TEMPLATE.xml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - Alfresco Web Client - - Alfresco Web Client - - - javax.faces.STATE_SAVING_METHOD - server - - - - javax.faces.CONFIG_FILES - @facesconfig@ - - - - org.apache.myfaces.ALLOW_JAVASCRIPT - true - - - - org.apache.myfaces.DETECT_JAVASCRIPT - false - This is an EXPERIMENTAL feature, so leave it off for now! - - - - - org.apache.myfaces.PRETTY_HTML - true - - If true, rendered HTML code will be formatted, so that it is "human readable". - i.e. additional line separators and whitespace will be written, that do not - influence the HTML code. - Default: "true" - - - - - org.apache.myfaces.AUTO_SCROLL - false - - If true, a javascript function will be rendered that is able to restore the - former vertical scroll on every request. Convenient feature if you have pages - with long lists and you do not want the browser page to always jump to the top - if you trigger a link or button action that stays on the same page. - Default: "false" - - - - - contextConfigLocation - - classpath:alfresco/web-client-application-context.xml - classpath:web-services-application-context.xml - classpath:alfresco/application-context.xml - - Spring config file locations - - - - Authentication Filter - org.alfresco.web.app.servlet.AuthenticationFilter - - - - - - - - - - - - WebDAV Authentication Filter - org.alfresco.repo.webdav.auth.AuthenticationFilter - - - - - - - - Authentication Filter - /faces/* - - - - - - - - WebDAV Authentication Filter - /webdav/* - - - - org.apache.myfaces.webapp.StartupServletContextListener - - - - org.springframework.web.context.ContextLoaderListener - - - - org.alfresco.web.app.ContextListener - - - - - Faces Servlet - org.alfresco.web.app.servlet.AlfrescoFacesServlet - 1 - - - - uploadFile - org.alfresco.web.app.servlet.UploadFileServlet - - - - downloadContent - org.alfresco.web.app.servlet.DownloadContentServlet - - - - externalAccess - org.alfresco.web.app.servlet.ExternalAccessServlet - - - - templateContent - org.alfresco.web.app.servlet.TemplateContentServlet - - - - commandServlet - org.alfresco.web.app.servlet.CommandServlet - - - - axis - org.apache.axis.transport.http.AxisServlet - 5 - - - - WebDAV - org.alfresco.repo.webdav.WebDAVServlet - - store - workspace://SpacesStore - - - rootPath - /app:company_home - - 5 - - - - Faces Servlet - /faces/* - - - - uploadFile - /uploadFileServlet - - - - downloadContent - /download/* - - - - externalAccess - /navigate/* - - - - templateContent - /template/* - - - - commandServlet - /command/* - - - - axis - /api/* - - - - WebDAV - /webdav/* - - - - 60 - - - - index.jsp - - -