JBoss Portal SVN: r12091 - branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/control/portal.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-20 03:52:54 -0400 (Mon, 20 Oct 2008)
New Revision: 12091
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java
Log:
JBPORTAL-2200
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java 2008-10-20 07:52:13 UTC (rev 12090)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/control/portal/DefaultPortalControlPolicy.java 2008-10-20 07:52:54 UTC (rev 12091)
@@ -28,6 +28,7 @@
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerRequestDispatcher;
import org.jboss.portal.core.controller.ControllerResponse;
+import org.jboss.portal.core.controller.AccessDeniedException;
import org.jboss.portal.core.controller.command.response.ErrorResponse;
import org.jboss.portal.core.controller.command.response.SecurityErrorResponse;
import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
@@ -126,7 +127,14 @@
//
if (cause != null)
{
- log.error("Rendering portlet window " + "" + " produced an error", cause);
+ if (cause instanceof AccessDeniedException)
+ {
+ log.debug("Rendering portlet window " + "" + " produced an error", cause);
+ }
+ else
+ {
+ log.error("Rendering portlet window " + "" + " produced an error", cause);
+ }
}
//
17 years, 9 months
JBoss Portal SVN: r12090 - branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-20 03:52:13 -0400 (Mon, 20 Oct 2008)
New Revision: 12090
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/createRole.xhtml
Log:
sync from 2.7 branch (forgotten commit?)
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/createRole.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/createRole.xhtml 2008-10-20 02:26:24 UTC (rev 12089)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/createRole.xhtml 2008-10-20 07:52:13 UTC (rev 12090)
@@ -29,8 +29,10 @@
<h:message for="rolename" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ROLE_DISPLAY}"/>
- <h:inputText id="roledisplayname" value="#{createrolemgr.uiRole.displayName}"/>
- </h:panelGrid>
+ <h:inputText id="roledisplayname" value="#{createrolemgr.uiRole.displayName}" required="true"/>
+ <h:message for="roledisplayname" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+
+ </h:panelGrid>
<hr/>
<p style="text-align: right;">
<h:commandButton id="submit" value="#{bundle.IDENTITY_BUTTON_SUBMIT}" action="#{createrolemgr.createRole}" styleClass="portlet-form-button"/>
17 years, 9 months
JBoss Portal SVN: r12089 - branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-19 22:26:24 -0400 (Sun, 19 Oct 2008)
New Revision: 12089
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
JBPORTAL-2156 - Use localized date/time format in CMS admin portlet
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-20 01:56:32 UTC (rev 12088)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-20 02:26:24 UTC (rev 12089)
@@ -163,6 +163,7 @@
ResourceBundle bundle = this.getPortletConfig().getResourceBundle(rReq.getLocale());
String datePattern = bundle.getString(CMSAdminConstants.CMS_DATE_PATTERN);
dateFormat = new SimpleDateFormat(datePattern, rReq.getLocale());
+ rReq.getPortletSession().setAttribute(CMSAdminConstants.DATE_FORMAT, dateFormat);
}
rReq.setAttribute(CMSAdminConstants.DATE_FORMAT, dateFormat);
17 years, 9 months
JBoss Portal SVN: r12088 - in branches/JBoss_Portal_Branch_2_6/core-cms/src: resources/portal-cms-war/WEB-INF/classes and 2 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-19 21:56:32 -0400 (Sun, 19 Oct 2008)
New Revision: 12088
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_de.properties
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
Log:
JBPORTAL-2156 - Use localized date/time format in CMS admin portlet
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2008-10-20 01:56:32 UTC (rev 12088)
@@ -117,4 +117,8 @@
public static final String CMS_FILENAME_INVALID = "CMS_FILENAME_INVALID";
public static final String CMS_FOLDERNAME_INVALID = "CMS_FOLDERNAME_INVALID";
+
+ public static final String CMS_DATE_PATTERN = "CMS_DATE_PATTERN";
+
+ public static final String DATE_FORMAT = "dateFormat";
}
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-20 01:56:32 UTC (rev 12088)
@@ -78,7 +78,6 @@
import javax.portlet.UnavailableException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -89,6 +88,8 @@
import java.util.Set;
import java.util.Vector;
import java.util.ResourceBundle;
+import java.text.SimpleDateFormat;
+import java.text.Format;
/**
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
@@ -155,6 +156,17 @@
protected void doView(final JBossRenderRequest rReq, final JBossRenderResponse rRes)
throws PortletException, IOException, UnavailableException
{
+ //SetUp the properly localized Date Formatter to be used by the View JSPs
+ Format dateFormat = (Format)rReq.getPortletSession().getAttribute(CMSAdminConstants.DATE_FORMAT);
+ if(dateFormat == null)
+ {
+ ResourceBundle bundle = this.getPortletConfig().getResourceBundle(rReq.getLocale());
+ String datePattern = bundle.getString(CMSAdminConstants.CMS_DATE_PATTERN);
+ dateFormat = new SimpleDateFormat(datePattern, rReq.getLocale());
+ }
+ rReq.setAttribute(CMSAdminConstants.DATE_FORMAT, dateFormat);
+
+
//check and make sure the CMSAdminPortlet is accessible to the current user
if (!this.isPortletAccessible(rReq))
{
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-20 01:56:32 UTC (rev 12088)
@@ -146,4 +146,6 @@
CMS_MSG_DESTINATION_ALREADY_EXISTS=The command was not performed, because the destination already exists.
+CMS_DATE_PATTERN=MM/dd/yy HH:mm
+
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_de.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_de.properties 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_de.properties 2008-10-20 01:56:32 UTC (rev 12088)
@@ -130,3 +130,4 @@
CMS_MISSING_DOCUMENT=404 - Seite nicht gefunden
CMS_MISSING_DOCUMENT_DESCRIPTION=Das von ihnen angeforderte Dokument ist nicht verf�gbar
+CMS_DATE_PATTERN=dd/MM/yy HH:mm
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp 2008-10-20 01:56:32 UTC (rev 12088)
@@ -2,7 +2,6 @@
<%@ page import="org.jboss.portal.cms.model.Folder" %>
<%@ page import="org.jboss.portal.core.cms.ui.admin.CMSAdminConstants" %>
<%@ page import="java.text.Format" %>
-<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
@@ -22,6 +21,7 @@
String modifiedDate = "";
Boolean manageWorkflowAccessible = (Boolean)request.getAttribute("manageWorkflowAccessible");
List<String> messages = (List<String>)request.getAttribute("messages");
+ Format dateFormat = (Format)request.getAttribute("dateFormat");
%>
<div class="admin-ui">
@@ -239,10 +239,8 @@
<td>
<%
if (folder.getCreationDate() != null)
- {
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- createDate = formatter.format(folder.getCreationDate());
+ {
+ createDate = dateFormat.format(folder.getCreationDate());
}
%>
<%= createDate %>
@@ -251,9 +249,7 @@
<%
if (folder.getLastModified() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- modifiedDate = formatter.format(folder.getLastModified());
+ modifiedDate = dateFormat.format(folder.getLastModified());
}
%>
<%= modifiedDate %>
@@ -300,9 +296,7 @@
<%
if (file.getCreationDate() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- createDate = formatter.format(file.getCreationDate());
+ createDate = dateFormat.format(file.getCreationDate());
}
%>
<%= createDate %>
@@ -311,9 +305,7 @@
<%
if (file.getLastModified() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- modifiedDate = formatter.format(file.getLastModified());
+ modifiedDate = dateFormat.format(file.getLastModified());
}
%>
<%= modifiedDate %>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2008-10-20 01:56:32 UTC (rev 12088)
@@ -1,13 +1,16 @@
<%@ page import="org.jboss.portal.cms.model.File" %>
<%@ page import="org.jboss.portal.core.cms.ui.admin.CMSAdminConstants" %>
<%@ page import="java.text.Format" %>
-<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
<%@ page isELIgnored="false" %>
+<%
+Format dateFormat = (Format)request.getAttribute("dateFormat");
+%>
+
<portlet:defineObjects/>
<link rel="stylesheet" type="text/css" href="/portal-admin/css/style.css" media="screen"/>
@@ -96,9 +99,7 @@
<%
if (file.getCreationDate() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- createDate = formatter.format(file.getCreationDate());
+ createDate = dateFormat.format(file.getCreationDate());
}
%>
<%= createDate %>
@@ -107,9 +108,7 @@
<%
if (file.getLastModified() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- modifiedDate = formatter.format(file.getLastModified());
+ modifiedDate = dateFormat.format(file.getLastModified());
}
%>
<%= modifiedDate %>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2008-10-20 01:56:32 UTC (rev 12088)
@@ -7,7 +7,6 @@
<%@ page import="org.jboss.portal.cms.util.NodeUtil" %>
<%@ page import="org.jboss.portal.core.cms.ui.admin.CMSAdminConstants" %>
<%@ page import="java.text.Format" %>
-<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
@@ -48,6 +47,8 @@
String exception = request.getParameter("exception");
Boolean manageWorkflowAccessible = (Boolean)request.getAttribute("manageWorkflowAccessible");
+
+ Format dateFormat = (Format)request.getAttribute("dateFormat");
%>
@@ -307,9 +308,7 @@
<%
if (version.getCreationDate() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- createDate = formatter.format(version.getCreationDate());
+ createDate = dateFormat.format(version.getCreationDate());
}
%>
<%= createDate %>
@@ -318,9 +317,7 @@
<%
if (version.getLastModified() != null)
{
- Format formatter;
- formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
- modifiedDate = formatter.format(version.getLastModified());
+ modifiedDate = dateFormat.format(version.getLastModified());
}
%>
<%= modifiedDate %>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp 2008-10-18 20:14:56 UTC (rev 12087)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/editor/main.jsp 2008-10-20 01:56:32 UTC (rev 12088)
@@ -3,7 +3,6 @@
<%@ page import="org.jboss.portal.cms.model.Content" %>
<%@ page import="org.jboss.portal.core.cms.ui.admin.CMSAdminConstants" %>
<%@ page import="java.text.Format" %>
-<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="javax.portlet.PortletURL" %>
@@ -22,6 +21,7 @@
PortletURL url = renderResponse.createRenderURL();
url.setParameter("op", CMSAdminConstants.OP_MAIN);
url.setParameter("path", "/");
+ Format dateFormat = (Format)request.getAttribute("dateFormat");
%>
<!-- Currently browsing -->
17 years, 9 months
JBoss Portal SVN: r12087 - in branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF: jsp/cms/admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-18 16:14:56 -0400 (Sat, 18 Oct 2008)
New Revision: 12087
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/exportarchive_pickup_error.jsp
Log:
JBPORTAL-2100 - Export of empty folders: provide a more meaningful, localized error message
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-18 19:45:12 UTC (rev 12086)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-18 20:14:56 UTC (rev 12087)
@@ -105,6 +105,7 @@
CMS_REQUIRED=Required
CMS_LINK_TO_RESOURCES=Links to resources within this portal should be absolute. For example: A link to an image located in default/images/back.gif should be typed in exactly as shown here. Do not prefix a slash (/) to the path of the resource. You can verify the link is correct by clicking on the preview button in the editor
CMS_ERROR_PROCESSING=ERROR processing export request
+CMS_ERROR_EXPORT=An error occurred during the Export operation. Please make sure the Folder being exported is not empty
CMS_YOUR_EXPORT_0=Your export of
CMS_YOUR_EXPORT_1=is ready for download
CMS_CLICK_TO_DOWNLOAD=Click to Download
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/exportarchive_pickup_error.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/exportarchive_pickup_error.jsp 2008-10-18 19:45:12 UTC (rev 12086)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/exportarchive_pickup_error.jsp 2008-10-18 20:14:56 UTC (rev 12087)
@@ -19,7 +19,7 @@
<td align="left">
<table width="100%">
<tr>
- <td align="center"><font color="red">${n:i18n("CMS_ERROR_PROCESSING")}!</font></td>
+ <td align="center"><font color="red">${n:i18n("CMS_ERROR_EXPORT")}!</font></td>
</tr>
<tr>
<td align="center"><input class="portlet-form-button" type="button"
17 years, 9 months
JBoss Portal SVN: r12086 - in branches/JBoss_Portal_Branch_2_6: cms/src/main/org/jboss/portal/cms/impl/jcr and 2 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-18 15:45:12 -0400 (Sat, 18 Oct 2008)
New Revision: 12086
Added:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/DownloadArchiveCommand.java
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSExportServlet.java
Log:
JBPORTAL-2181 - Exporting folder on CMS slave node results in HTTP 404
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2008-10-18 01:53:52 UTC (rev 12085)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2008-10-18 19:45:12 UTC (rev 12086)
@@ -86,9 +86,11 @@
Command createFileGetListCommand(String sFilePath);
- Command createGetArchiveCommand(String sRootPath, String sLanguage);
+ Command createGetArchiveCommand(String sRootPath, String sLanguage);
Command createSearchCommand(JCRQuery query);
Command createMakeLiveVersionCommand(String filePath, String language, String version);
+
+ Command createDownloadArchiveCommand(String filePath);
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2008-10-18 01:53:52 UTC (rev 12085)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2008-10-18 19:45:12 UTC (rev 12086)
@@ -45,6 +45,7 @@
import org.jboss.portal.cms.impl.jcr.command.RenameCommand;
import org.jboss.portal.cms.impl.jcr.command.SearchCommand;
import org.jboss.portal.cms.impl.jcr.command.StoreArchiveCommand;
+import org.jboss.portal.cms.impl.jcr.command.DownloadArchiveCommand;
import org.jboss.portal.cms.impl.jcr.composite.NewFileCommand;
import org.jboss.portal.cms.impl.jcr.composite.UpdateFileCommand;
import org.jboss.portal.cms.model.Content;
@@ -56,6 +57,7 @@
import org.jboss.portal.cms.impl.jcr.command.AsyncStoreArchiveCommand;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.List;
import java.util.Locale;
@@ -197,5 +199,10 @@
public Command createMakeLiveVersionCommand(String filePath, String language, String version)
{
return new MakeLiveVersionCommand(filePath, language, version);
- }
+ }
+
+ public Command createDownloadArchiveCommand(String filePath)
+ {
+ return new DownloadArchiveCommand(filePath);
+ }
}
Added: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/DownloadArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/DownloadArchiveCommand.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/DownloadArchiveCommand.java 2008-10-18 19:45:12 UTC (rev 12086)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.impl.jcr.command;
+
+import java.util.Locale;
+import java.io.FileInputStream;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.model.Content;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.ContentImpl;
+import org.jboss.portal.cms.impl.jcr.JCRCommand;
+import org.jboss.portal.cms.impl.jcr.JCRCommandContext;
+
+/**
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class DownloadArchiveCommand extends JCRCommand
+{
+ private static final long serialVersionUID = 1L;
+ private static Logger log = Logger.getLogger(DownloadArchiveCommand.class);
+
+ String filePath = null;
+
+ JCRCommandContext mContext;
+
+ public DownloadArchiveCommand(String filePath)
+ {
+ this.filePath = filePath;
+ }
+
+ public Object execute()
+ {
+ java.io.File file = null;
+ try
+ {
+ file = new java.io.File(this.filePath);
+
+ //Create the Content
+ File downloadFile = new FileImpl();
+ downloadFile.setName(file.getName());
+
+ Content downloadFileContent = new ContentImpl();
+ downloadFileContent.setSize(file.length());
+ downloadFileContent.setStream(new FileInputStream(file));
+
+ //Locale does not matter. Just honoring the contract exposed by the File Object
+ downloadFile.setContent(Locale.getDefault(), downloadFileContent);
+
+
+ return downloadFile;
+ }
+ catch(Exception e)
+ {
+ log.error(this, e);
+ throw new CMSException(e);
+ }
+ finally
+ {
+ //File cleanup
+ if(file != null)
+ {
+ if (!file.delete())
+ {
+ file.deleteOnExit();
+ }
+ }
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java 2008-10-18 01:53:52 UTC (rev 12085)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java 2008-10-18 19:45:12 UTC (rev 12086)
@@ -52,9 +52,6 @@
private static final int BUFFER_SIZE = 1024;
- /** Root folder in finished zip file that contains all nodes. */
- private String rootFolderName = "contents";
-
public GetArchiveCommand(String sRootPath, String sLanguage)
{
this.msRootPath = sRootPath;
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSExportServlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSExportServlet.java 2008-10-18 01:53:52 UTC (rev 12085)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/servlet/CMSExportServlet.java 2008-10-18 19:45:12 UTC (rev 12086)
@@ -22,17 +22,29 @@
******************************************************************************/
package org.jboss.portal.core.cms.servlet;
-import org.jboss.portal.common.io.IOTools;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
-import javax.servlet.ServletOutputStream;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.FileInputStream;
+import javax.servlet.UnavailableException;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.model.File;
+
+
/**
* Used for archive export in CMS.
*
@@ -42,27 +54,59 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = 9192970961535895941L;
+
+ private static Logger log = Logger.getLogger(CMSExportServlet.class);
+
+ /**
+ *
+ */
+ private CMS cmsService = null;
+
+ /**
+ *
+ */
+ public void init() throws ServletException
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ this.cmsService = (CMS)MBeanProxy.get(CMS.class, new ObjectName("portal:service=CMS"), mbeanServer);
+ if(this.cmsService == null)
+ {
+ throw new CMSException("CMS Service was not found!!");
+ }
+ }
+ catch(Exception e)
+ {
+ throw new UnavailableException(e.getMessage());
+ }
+ }
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException
{
String sPickupFile = (String)request.getSession().getAttribute("pickupfile");
-
- File file = new File(sPickupFile);
try
{
- //response.setContentType(getServletContext().getMimeType(file.getName()));
+ //Get the file to be downloaded
+ Command downloadCommand = this.cmsService.getCommandFactory().createDownloadArchiveCommand(sPickupFile);
+ File file = (File)this.cmsService.execute(downloadCommand);
+
+ //SetUp the response header
response.setContentType("application/zip");
- response.setContentLength((int)file.length());
+ response.setContentLength((int)file.getSize());
response.setHeader("Content-Disposition", "attachment; filename=" + file.getName());
-
- InputStream in = IOTools.safeBufferedWrapper(new FileInputStream(file));
- ServletOutputStream sout = response.getOutputStream();
+
+ //Write the contents
+ InputStream in = IOTools.safeBufferedWrapper(file.getContent().getStream());
+ OutputStream sout = response.getOutputStream();
byte[] buf = new byte[2048];
int len;
while ((len = in.read(buf)) > 0)
{
sout.write(buf, 0, len);
}
+
+ //Cleanup
in.close();
sout.flush();
sout.close();
@@ -75,16 +119,9 @@
}
catch (IOException e1)
{
- e1.printStackTrace();
+ log.error(this, e1);
}
- }
- finally
- {
- if (!file.delete())
- {
- file.deleteOnExit();
- }
- }
+ }
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
17 years, 9 months
JBoss Portal SVN: r12085 - in branches/JBoss_Portal_Branch_2_7/core-admin/src: bin/portal-admin-war/img/jbp-icon-set and 3 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-10-17 21:53:52 -0400 (Fri, 17 Oct 2008)
New Revision: 12085
Added:
branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_dest.gif
branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_dest_window.gif
branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_source.gif
branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_source_window.gif
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/basestyles.css
branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/style.css
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
Log:
JBPORTAL-1919 event wiring ui
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/basestyles.css
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/basestyles.css 2008-10-17 21:48:54 UTC (rev 12084)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/basestyles.css 2008-10-18 01:53:52 UTC (rev 12085)
@@ -99,6 +99,10 @@
padding: 10px
}
+.margin10 {
+ margin: 10px;
+}
+
.grey-border {
border: 1px solid #B3C0C7;
}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/style.css
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/style.css 2008-10-17 21:48:54 UTC (rev 12084)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/css/style.css 2008-10-18 01:53:52 UTC (rev 12085)
@@ -768,6 +768,61 @@
margin: 4px 0 0 0;
}
+ul.sourceWindowList,
+ul.sourceEventList,
+ul.destEventList,
+ul.destWindowList {
+ margin: 0;
+ padding: 0;
+}
+
+ul.sourceWindowList li {
+ list-style-image: url( "../img/jbp-icon-set/event_source_window.gif" );
+ list-style-type: none;
+ list-style-position: inside;
+ padding: 3px 0 0 5px;
+}
+
+ul.sourceEventList li {
+ list-style-image: url( "../img/jbp-icon-set/event_source.gif" );
+ list-style-type: none;
+ list-style-position: inside;
+ padding: 3px 0 0 5px;
+}
+
+ul.destEventList li {
+ list-style-image: url( "../img/jbp-icon-set/event_dest.gif" );
+ list-style-type: none;
+ list-style-position: inside;
+ padding: 3px 0 0 5px;
+}
+
+ul.destWindowList li {
+ list-style-image: url( "../img/jbp-icon-set/event_dest_window.gif" );
+ list-style-type: none;
+ list-style-position: inside;
+ padding: 3px 0 0 5px;
+}
+
+div.event-wiring-preview {
+ text-align: left;
+ padding: 15px 0 0 10px;
+ border-left: 1px solid #ececec;
+}
+
+div.event-wiring-preview p.source-event-text {
+ background-image: url( "../img/jbp-icon-set/event_source.gif" );
+ padding: 0 0 0 23px;
+ background-repeat: no-repeat;
+}
+
+div.event-wiring-preview div.createwiring-box {
+ background-color: #fff3c4;
+ border: 2px solid #e1d39c;
+ padding: 0;
+ margin: 15px 0 0 0;
+}
+
/*--------------------------- Coordination admin end */
h3.blue {
padding: 2px 2px 2px 5px;
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_dest.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_dest.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_dest_window.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_dest_window.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_source.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_source.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_source_window.gif
===================================================================
(Binary files differ)
Property changes on: branches/JBoss_Portal_Branch_2_7/core-admin/src/bin/portal-admin-war/img/jbp-icon-set/event_source_window.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java 2008-10-17 21:48:54 UTC (rev 12084)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/ParameterBindingManagerBean.java 2008-10-18 01:53:52 UTC (rev 12085)
@@ -272,7 +272,7 @@
private QName name;
public static final int PARAM_NAME = 0;
public static final int WINDOW_NAME = 1;
- private static final String SEP = " <-> ";
+ private static final String SEP = " ⇔ ";
public ParameterWindowPair(ParameterInfo info, Window window)
{
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2008-10-17 21:48:54 UTC (rev 12084)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2008-10-18 01:53:52 UTC (rev 12085)
@@ -274,7 +274,7 @@
COORDINATION_PARAMETER_MANAGE_EXISTING=Manage existing parameter bindings:
COORDINATION_PARAMETER_EXISTING_NONE=No existing parameter bindings.
COORDINATION_PARAMETER_EXISTING_NAME=Name
-COORDINATION_PARAMETER_EXISTING_PAIRS=Window <-> parameter pairs
+COORDINATION_PARAMETER_EXISTING_PAIRS=Window ⇔ parameter pairs
COORDINATION_PARAMETER_EXISTING_ACTIONS=Actions
COORDINATION_PARAMETER_CREATE=Create new parameter binding:
COORDINATION_PARAMETER_CREATE_NO_PAIRS=No available public render parameters. Cannot create new parameter bindings.
@@ -309,9 +309,9 @@
COORDINATION_EVENT_CREATE=Create new event wiring:
COORDINATION_EVENT_CREATE_NO_EVENTS=No available events. Cannot create new event wirings.
COORDINATION_EVENT_CREATE_STEP1=1. Select source event:
-COORDINATION_EVENT_CREATE_STEP2=2. Select source windows producing event ''{0}'':
+COORDINATION_EVENT_CREATE_STEP2=2. Select source windows producing event:
COORDINATION_EVENT_CREATE_STEP3=3. Select destination event:
-COORDINATION_EVENT_CREATE_STEP4=4. Select destination windows consuming event ''{0}'':
+COORDINATION_EVENT_CREATE_STEP4=4. Select destination windows consuming event:
COORDINATION_EVENT_CREATE_STEP5=5. Name wiring:
COORDINATION_EVENT_CREATE_CREATE=Create wiring
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-10-17 21:48:54 UTC (rev 12084)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/resources/portal-admin-war/jsf/editCoordination.xhtml 2008-10-18 01:53:52 UTC (rev 12085)
@@ -19,13 +19,12 @@
else
e.style.display = '';
}
+
//-->
</script>
<br/>
- <ul class="clear coord-nav">
- <li><a href="javascript:toggle_visibility('aliasBindings');toggle_visibility('parameterBindings');toggle_visibility('eventWirings');void(0);">Expand/Collapse All</a></li>
- </ul>
+
<div class="tenpx-top-bottom">
<h2 class="portlet-area-header" onclick="toggle_visibility('aliasBindings');" style="cursor: pointer"><a name="#{bundle.COORDINATION_ALIAS_BINDINGS}"/>#{bundle.COORDINATION_ALIAS_BINDINGS}</h2>
@@ -231,49 +230,105 @@
<h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_CREATE}</h3>
<h:outputText value="#{bundle.COORDINATION_EVENT_CREATE_NO_EVENTS}" rendered="#{empty eventManager.sourceEvents}"/>
<h:form rendered="#{!empty eventManager.sourceEvents}">
- <h:panelGroup>
+ <div class="half-width float-left">
+ <div class="full-width pad5">
<h4>#{bundle.COORDINATION_EVENT_CREATE_STEP1}</h4>
<h:selectOneListbox id="sourceEvent" size="5" value="#{eventManager.selectedSourceEvent}" immediate="true"
onchange="this.form.submit()">
<f:selectItems value="#{eventManager.sourceEvents}"/>
</h:selectOneListbox>
- </h:panelGroup>
+ </div>
- <h:panelGroup rendered="#{!empty eventManager.selectedSourceEvent}">
- <h4>#{eventManager.step2Message}</h4> <!-- this uses bundle.COORDINATION_EVENT_CREATE_STEP2 -->
+ <f:subview id="COORDINATION_EVENT_CREATE_STEP2" rendered="#{!empty eventManager.selectedSourceEvent}">
+ <div class="full-width pad5">
+ <h4>#{bundle.COORDINATION_EVENT_CREATE_STEP2}</h4>
+ <div class="pad5"><h:graphicImage url="/img/jbp-icon-set/event_source.gif"/> #{eventManager.selectedSourceEvent}</div>
<h:selectManyListbox id="sourceWindows" size="5" value="#{eventManager.selectedSourceWindows}" immediate="true"
onchange="this.form.submit()">
<f:selectItems value="#{eventManager.sourceWindows}"/>
</h:selectManyListbox>
- </h:panelGroup>
+ </div>
+ </f:subview>
- <h:panelGroup rendered="#{!empty eventManager.selectedSourceWindows}">
+ <f:subview id="COORDINATION_EVENT_CREATE_STEP3" rendered="#{!empty eventManager.selectedSourceWindows}">
+ <div class="full-width pad5">
<h4>#{bundle.COORDINATION_EVENT_CREATE_STEP3}</h4>
<h:selectOneListbox id="destEvent" size="5" value="#{eventManager.selectedDestinationEvent}" immediate="true"
onchange="this.form.submit()">
<f:selectItems value="#{eventManager.destinationEvents}"/>
</h:selectOneListbox>
- </h:panelGroup>
+ </div>
+ </f:subview>
- <h:panelGroup rendered="#{!empty eventManager.selectedDestinationEvent}">
- <h4>#{eventManager.step4Message}</h4> <!-- this uses bundle.COORDINATION_EVENT_CREATE_STEP4 -->
+ <f:subview id="COORDINATION_EVENT_CREATE_STEP4" rendered="#{!empty eventManager.selectedDestinationEvent}">
+ <div class="full-width pad5">
+ <h4>#{bundle.COORDINATION_EVENT_CREATE_STEP4}</h4>
+ <div class="pad5"><h:graphicImage url="/img/jbp-icon-set/event_dest.gif"/>#{eventManager.selectedDestinationEvent}</div>
<h:selectManyListbox id="destWindows" size="5" value="#{eventManager.selectedDestinationWindows}" immediate="true"
onchange="this.form.submit()">
<f:selectItems value="#{eventManager.destinationWindows}"/>
</h:selectManyListbox>
- </h:panelGroup>
+ </div>
+ </f:subview>
- <h:panelGroup rendered="#{!empty eventManager.selectedDestinationWindows}">
- <h4>#{bundle.COORDINATION_EVENT_CREATE_STEP5}</h4>
+
+ <br class="clear"/>
+ </div>
+
+ <div class="half-width float-left event-wiring-preview">
+ <h4>New Event Wiring Preview:</h4>
+ <f:subview id="sourceEventUI" rendered="#{!empty eventManager.selectedSourceEvent}">
+ <p class="source-event-text"><b>#{eventManager.selectedSourceEvent}</b> is the selected source event.</p>
+ </f:subview>
+ <f:subview id="sourceWindowUI" rendered="#{!empty eventManager.selectedSourceWindows}" >
+ <p>The following windows will produce the <b>#{eventManager.selectedSourceEvent}</b> event.</p>
+ <ul class="sourceWindowList">
+ <ui:repeat var="window" value="#{eventManager.selectedSourceWindows}">
+ <li>
+ #{window}
+ </li>
+ </ui:repeat>
+ </ul>
+ </f:subview>
+ <f:subview id="destEventUI" rendered="#{!empty eventManager.selectedDestinationEvent}">
+ <p>The producing Window Events will be wired to the following destination events.</p>
+ <ul class="destEventList">
+ <ui:repeat var="event" value="#{eventManager.selectedDestinationEvent}">
+ <li>#{event}</li>
+ </ui:repeat>
+ </ul>
+ </f:subview>
+ <f:subview id="destWindowUI" rendered="#{!empty eventManager.selectedDestinationWindows}">
+ <p>And the following windows will consume the above listed destination events.</p>
+ <ul class="destWindowList">
+ <ui:repeat var="window" value="#{eventManager.selectedDestinationWindows}">
+ <li>
+ #{window}
+ </li>
+ </ui:repeat>
+ </ul>
+ </f:subview>
+
+ <f:subview id="COORDINATION_EVENT_CREATE_STEP5" rendered="#{!empty eventManager.selectedDestinationWindows}">
+ <div class="full-width createwiring-box">
+ <div class="margin10">
+ <h4>5. Name and create this wiring:</h4>
<h:inputText id="wiringName" value="#{eventManager.wiringName}"/>
<h:commandButton value="#{bundle.COORDINATION_EVENT_CREATE_CREATE}" action="#{eventManager.create}"
styleClass="portlet-form-button"/>
<h:commandButton value="#{bundle.COMMON_CANCEL}" action="#{eventManager.cancel}"
styleClass="portlet-form-button"/>
- </h:panelGroup>
+ </div>
+ </div>
+ </f:subview>
+
+ <br class="clear"/>
+
+ </div>
+
</h:form>
<hr/>
-
+ <br class="clear"/>
<!-- Manage existing wirings -->
<h3 class="sectionTitle tenpx-top-bottom">#{bundle.COORDINATION_EVENT_MANAGE_EXISTING}</h3>
<h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_NONE}" rendered="#{empty eventManager.displayEventWirings}"/>
@@ -281,20 +336,20 @@
<h:dataTable var="wiring" value="#{eventManager.displayEventWirings}"
styleClass="objectList datatable"
rowClasses="portlet-section-body,portlet-section-alternate-blue"
- columnClasses="objectNameColumn, objectActionColumn"
+ columnClasses="ten-percent-width,quarter-width,quarter-width,ten-percent-width"
headerClass="portlet-section-header">
<h:column>
<f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_NAME}"/>
+ <h4>#{bundle.COORDINATION_EVENT_EXISTING_NAME}</h4>
</f:facet>
#{wiring.name}
</h:column>
<h:column>
<f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_WINDOWS}"/>
+ #{bundle.COORDINATION_EVENT_EXISTING_SOURCE_WINDOWS} / #{bundle.COORDINATION_EVENT_EXISTING_SOURCE_EVENTS}
</f:facet>
- <ul>
+ <ul class="sourceWindowList">
<ui:repeat var="window" value="#{wiring.sourceWindows}">
<li>
<h:commandLink action="#{portalobjectmgr.selectObject}" styleClass="objectName">
@@ -304,35 +359,31 @@
</li>
</ui:repeat>
</ul>
- </h:column>
-
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_EVENTS}"/>
- </f:facet>
- <ul>
+ <hr/>
+ <ul class="sourceEventList">
<ui:repeat var="event" value="#{wiring.sourceEvents}">
<li>#{event}</li>
</ui:repeat>
</ul>
</h:column>
-
+ <ui:remove>
+ <!--<h:column>-->
+ <!--<f:facet name="header">-->
+ <!--<h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_SOURCE_EVENTS}"/>-->
+ <!--</f:facet>-->
+ <!--<ul class="sourceEventList">-->
+ <!--<ui:repeat var="event" value="#{wiring.sourceEvents}">-->
+ <!--<li>#{event}</li>-->
+ <!--</ui:repeat>-->
+ <!--</ul>-->
+ <!--</h:column>-->
+ </ui:remove>
<h:column>
<f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_EVENTS}"/>
+ #{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_WINDOWS} / #{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_EVENTS}
</f:facet>
- <ul>
- <ui:repeat var="event" value="#{wiring.destinationEvents}">
- <li>#{event}</li>
- </ui:repeat>
- </ul>
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_WINDOWS}"/>
- </f:facet>
- <ul>
+ <ul class="destWindowList">
<ui:repeat var="window" value="#{wiring.destinationWindows}">
<li>
<h:commandLink action="#{portalobjectmgr.selectObject}" styleClass="objectName">
@@ -342,11 +393,35 @@
</li>
</ui:repeat>
</ul>
+ <hr/>
+ <ul class="destEventList">
+ <ui:repeat var="event" value="#{wiring.destinationEvents}">
+ <li>#{event}</li>
+ </ui:repeat>
+ </ul>
+
+
</h:column>
-
+ <ui:remove>
+ <!--<h:column>-->
+ <!--<f:facet name="header">-->
+ <!--<h:outputText value="#{bundle.COORDINATION_EVENT_EXISTING_DESTINATION_WINDOWS}"/>-->
+ <!--</f:facet>-->
+ <!--<ul class="destEventList">-->
+ <!--<ui:repeat var="window" value="#{wiring.destinationWindows}">-->
+ <!--<li>-->
+ <!--<h:commandLink action="#{portalobjectmgr.selectObject}" styleClass="objectName">-->
+ <!--<f:param name="id" value="#{window.id}"/>-->
+ <!--#{window.name}-->
+ <!--</h:commandLink>-->
+ <!--</li>-->
+ <!--</ui:repeat>-->
+ <!--</ul>-->
+ <!--</h:column>-->
+ </ui:remove>
<h:column>
<f:facet name="header">
- #{bundle.COORDINATION_EVENT_EXISTING_ACTIONS}"
+ #{bundle.COORDINATION_EVENT_EXISTING_ACTIONS}
</f:facet>
<h:panelGrid columns="2" cellpadding="0" cellspacing="0" border="0">
<h:commandLink action="renameCoordination" actionListener="#{coordinationManager.select}">
17 years, 9 months
JBoss Portal SVN: r12084 - in branches/JBoss_Portal_Branch_2_6: cms/src/main/org/jboss/portal/cms/impl/jcr and 9 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-10-17 17:48:54 -0400 (Fri, 17 Oct 2008)
New Revision: 12084
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CMSException.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/ha/HAJCRCMS.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/domain.hbm.xml
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/hibernate.cfg.xml
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/accessdenied.jsp
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp
branches/JBoss_Portal_Branch_2_6/core/build.xml
Log:
JBPORTAL-2109 - CMS Security Issue with LDAP/Clustered mode
JBPORTAL-2193 - Copy and Move functions create dummy files if destination exists
JBPORTAL-2161 - Special character in filename generates NullPointerException
JBPORTAL-2172 - Path inconsistency for import/export archive
JBPORTAL-2169 - CMS security console offers no way back if access is denied
JBPORTAL-2162 - Special character in foldername throws RepositoryException
JBPORTAL-2155 - Any CMS user can access secured cms items through preview function
JBPORTAL-2159 - ApprovePublish workflow throws exception when updated content exceeds column width of JBPM_VARIABLEINSTANCE.STRINGVALUE_ (255 bytes)
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CMSException.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CMSException.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/CMSException.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -49,4 +49,16 @@
{
super(cause);
}
+
+ public boolean hasPathFormatFailure()
+ {
+ boolean pathFormatFailure = false;
+
+ if(this.getMessage().indexOf("is not a legal path element")!=-1)
+ {
+ pathFormatFailure = true;
+ }
+
+ return pathFormatFailure;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -68,6 +68,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
+import java.util.Set;
/**
@@ -114,15 +115,13 @@
/** Used for storing the logged in user information */
protected static ThreadLocal userInfo = new ThreadLocal();
-
public static ThreadLocal getUserInfo()
{
return JCRCMS.userInfo;
- }
+ }
/** This is used to turnoff workflow triggering only for this particular request through the CMS commands */
protected static ThreadLocal turnOffWorkflow = new ThreadLocal();
-
public static void turnOffWorkflow()
{
turnOffWorkflow.set(new Boolean(true));
@@ -156,6 +155,21 @@
return isUISecurityFilterActive;
}
+
+ /**
+ * Used for propagating user's role information from different nodes of a cluster to the
+ * HASingleton Master Node currently processing CMS requests
+ */
+ protected static ThreadLocal userRoles = new ThreadLocal();
+ public static Set<String> getRoles()
+ {
+ return (Set<String>)userRoles.get();
+ }
+ public static void setRoles(Set<String> roles)
+ {
+ userRoles.set(roles);
+ }
+
public JCRCMS()
{
@@ -582,6 +596,11 @@
{
JCRCMS.enableUISecurityFilter();
}
+ Set<String> roles = (Set<String>)propagatedContext.getClusterContextInfo("roles");
+ if(roles != null)
+ {
+ JCRCMS.setRoles(roles);
+ }
}
// .... add new nodes & properties and save them
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/GetArchiveCommand.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -26,6 +26,7 @@
import org.jboss.portal.cms.impl.jcr.JCRCommandContext;
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.util.NodeUtil;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
@@ -99,17 +100,23 @@
while (ni.hasNext())
{
Node node = ni.nextNode();
- NodeType nt = node.getPrimaryNodeType();
+ NodeType nt = node.getPrimaryNodeType();
if (nt.getName().equals("portalcms:folder"))
{
this.zipFiles(node.getPath(), zos);
}
else if (nt.getName().equals("portalcms:file"))
{
+ String diff = node.getPath();
+ if(!this.msRootPath.equals("/"))
+ {
+ diff = node.getPath().substring(NodeUtil.getParentPath(this.msRootPath).length());
+ }
+
JCRCommand fileList = (JCRCommand)this.mContext.getCommandFactory().createFileGetCommand(node.getPath(), new Locale(this.msLanguage));
File childFile = (File)this.mContext.execute(fileList);
- ZipEntry entry = new ZipEntry(this.rootFolderName + node.getPath());
+ ZipEntry entry = new ZipEntry(diff);
zos.putNextEntry(entry);
Content content = childFile.getContent();
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ItemExistsCommand.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -24,6 +24,7 @@
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.util.FileUtil;
+import org.jboss.portal.cms.CMSException;
import javax.jcr.Session;
@@ -58,7 +59,7 @@
catch (Exception e)
{
e.printStackTrace();
+ throw new CMSException(e);
}
- return null;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/command/StoreArchiveCommand.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -38,6 +38,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
+import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
@@ -90,84 +91,14 @@
String itemName = zipEntry.getName();
if (!zipEntry.isDirectory())
{
- long fileSize = zipEntry.getSize();
- byte[] zipBytes = new byte[(int)fileSize];
- InputStream zipDataStream = zipFile.getInputStream(zipEntry);
- long bytesRead = 0;
-
- while (bytesRead < fileSize)
- {
- bytesRead += zipDataStream.read(zipBytes, (int)bytesRead, (int)(fileSize - bytesRead));
- }
-
- org.jboss.portal.cms.model.File file = new FileImpl();
-
- String sBasePath = FileUtil.cleanDoubleSlashes("/" + this.msRootPath + "/" + itemName);
- sBasePath = FileUtil.cleanDoubleSlashes(sBasePath); // hackish, but necessary for root path uploads.
- file.setBasePath(sBasePath);
-
- Content content = new ContentImpl();
- content.setEncoding("UTF-8");
- content.setTitle(itemName);
- content.setDescription(itemName);
- content.setBasePath(sBasePath + "/" + this.msLanguage);
- content.setBytes(zipBytes);
- file.setContent(new Locale(this.msLanguage), content);
-
- //Store the file
- JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(file.getBasePath());
- Boolean bExists = (Boolean)context.execute(nodeExists);
- if (!bExists.booleanValue())
- {
- //Create new file
- JCRCommand newFile = (JCRCommand)context.getCommandFactory().createNewFileCommand(file, content);
- context.execute(newFile);
- }
- else
- {
- //Update the existing one, and make the new version created
- //in return as live
- JCRCommand updateFile = (JCRCommand)context.getCommandFactory().createUpdateFileCommand(file, content, true);
- context.execute(updateFile);
- }
+ this.addFile(zipFile, zipEntry);
}
else // isDirectory
{
- // trim trailing slash.
- if (itemName.endsWith("/"))
- {
- itemName = itemName.substring(0, itemName.length() - 1);
- }
-
- if (!"".equals(itemName))
- {
- String sBasePath = FileUtil.cleanDoubleSlashes("/" + this.msRootPath + "/" + itemName);
- sBasePath = FileUtil.cleanDoubleSlashes(sBasePath); // hackish, but necessary for root path uploads.
- String sParentPath = NodeUtil.getParentPath(sBasePath);
- JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(sParentPath);
- Boolean bExists = (Boolean)context.execute(nodeExists);
- if (!bExists.booleanValue())
- {
- this.createParentHierarchy(sParentPath);
- }
-
- JCRCommand nodeExists2 = (JCRCommand)context.getCommandFactory().createItemExistsCommand(sBasePath);
- Boolean bExists2 = (Boolean)context.execute(nodeExists2);
- if (!bExists2.booleanValue())
- {
- Folder folder = new FolderImpl();
- folder.setName(itemName);
- folder.setDescription(itemName);
- folder.setTitle(itemName);
- folder.setLastModified(new Date());
- folder.setBasePath(sBasePath);
-
- JCRCommand folderSave = (JCRCommand)context.getCommandFactory().createFolderSaveCommand(folder);
- context.execute(folderSave);
- }
- }
+ this.addFolder(zipEntry);
}
}
+
return null;
}
catch (Exception e)
@@ -182,6 +113,112 @@
}
}
}
+
+ /**
+ *
+ * @param zipFile
+ * @param zipEntry
+ * @throws IOException
+ */
+ private void addFile(ZipFile zipFile, ZipEntry zipEntry) throws IOException
+ {
+ try
+ {
+ String itemName = zipEntry.getName();
+ long fileSize = zipEntry.getSize();
+ byte[] zipBytes = new byte[(int)fileSize];
+ InputStream zipDataStream = zipFile.getInputStream(zipEntry);
+ long bytesRead = 0;
+
+ while (bytesRead < fileSize)
+ {
+ bytesRead += zipDataStream.read(zipBytes, (int)bytesRead, (int)(fileSize - bytesRead));
+ }
+
+ org.jboss.portal.cms.model.File file = new FileImpl();
+
+ String sBasePath = FileUtil.cleanDoubleSlashes("/" + this.msRootPath + "/" + itemName);
+ sBasePath = FileUtil.cleanDoubleSlashes(sBasePath); // hackish, but necessary for root path uploads.
+ file.setBasePath(sBasePath);
+
+ Content content = new ContentImpl();
+ content.setEncoding("UTF-8");
+ content.setTitle(itemName);
+ content.setDescription(itemName);
+ content.setBasePath(sBasePath + "/" + this.msLanguage);
+ content.setBytes(zipBytes);
+ file.setContent(new Locale(this.msLanguage), content);
+
+ //Store the file
+ JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(file.getBasePath());
+ Boolean bExists = (Boolean)context.execute(nodeExists);
+ if (!bExists.booleanValue())
+ {
+ //Create new file
+ JCRCommand newFile = (JCRCommand)context.getCommandFactory().createNewFileCommand(file, content);
+ context.execute(newFile);
+ }
+ else
+ {
+ //Update the existing one, and make the new version created
+ //in return as live
+ JCRCommand updateFile = (JCRCommand)context.getCommandFactory().createUpdateFileCommand(file, content, true);
+ context.execute(updateFile);
+ }
+ }
+ catch(CMSException e)
+ {
+ //Log the error, but don't fail creation of other resources in the archive
+ log.error(this, e);
+ }
+ }
+
+ private void addFolder(ZipEntry zipEntry)
+ {
+ try
+ {
+ String itemName = zipEntry.getName();
+
+ //trim trailing slash.
+ if (itemName.endsWith("/"))
+ {
+ itemName = itemName.substring(0, itemName.length() - 1);
+ }
+
+ if (!"".equals(itemName))
+ {
+ String sBasePath = FileUtil.cleanDoubleSlashes("/" + this.msRootPath + "/" + itemName);
+ sBasePath = FileUtil.cleanDoubleSlashes(sBasePath); // hackish, but necessary for root path uploads.
+ String sParentPath = NodeUtil.getParentPath(sBasePath);
+ JCRCommand nodeExists = (JCRCommand)context.getCommandFactory().createItemExistsCommand(sParentPath);
+ Boolean bExists = (Boolean)context.execute(nodeExists);
+ if (!bExists.booleanValue())
+ {
+ this.createParentHierarchy(sParentPath);
+ }
+
+ JCRCommand nodeExists2 = (JCRCommand)context.getCommandFactory().createItemExistsCommand(sBasePath);
+ Boolean bExists2 = (Boolean)context.execute(nodeExists2);
+ if (!bExists2.booleanValue())
+ {
+ Folder folder = new FolderImpl();
+ folder.setName(itemName);
+ folder.setDescription(itemName);
+ folder.setTitle(itemName);
+ folder.setLastModified(new Date());
+ folder.setBasePath(sBasePath);
+
+ JCRCommand folderSave = (JCRCommand)context.getCommandFactory().createFolderSaveCommand(folder);
+ context.execute(folderSave);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ //Log the error, but don't fail creation of other resources in the archive
+ log.error(this, e);
+ }
+ }
/** @param parentPath */
private void createParentHierarchy(String parentPath) throws CMSException
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/ha/HAJCRCMS.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/ha/HAJCRCMS.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/impl/jcr/ha/HAJCRCMS.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -22,6 +22,15 @@
******************************************************************************/
package org.jboss.portal.cms.impl.jcr.ha;
+import java.security.Principal;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.security.jacc.PolicyContext;
+import javax.security.jacc.PolicyContextException;
+
import org.apache.log4j.Logger;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
@@ -31,6 +40,7 @@
import org.jboss.portal.cms.model.CMSUser;
import org.jboss.portal.identity.User;
import org.jboss.portal.jems.ha.HASingletonInvoker;
+import org.jboss.portal.security.impl.jacc.JACCPortalPrincipal;
/**
* Extend the JCR CMS and make it run as an ha singleton.
@@ -62,6 +72,17 @@
User user = (User)this.getUserInfo().get();
JCRCommandContext context = this.getCommandContext((JCRCommand)cmd);
context.setClusterContextInfo("user", new CMSUser(user.getUserName()));
+
+ try
+ {
+ //Propagate the currently authenticated Subject's roles to the Master Node
+ Set<String> roles = this.getCurrentRoles();
+ context.setClusterContextInfo("roles", roles);
+ }
+ catch(PolicyContextException e)
+ {
+ throw new CMSException(e);
+ }
}
//Add the Workflow ThreadLocal variable to the Command Context for propagation to the Master Node
@@ -77,7 +98,7 @@
{
JCRCommandContext context = this.getCommandContext((JCRCommand)cmd);
context.setClusterContextInfo("enableUISecurityFilter", Boolean.TRUE);
- }
+ }
// Use the proxy to invoke on the singleton
Object returnValue = null;
@@ -86,10 +107,12 @@
returnValue = invoker.invoke("execute", new Class[]{Command.class}, new Object[]{cmd});
if(returnValue instanceof CMSException)
{
- if(returnValue.toString().indexOf("Access to this resource is denied") != -1)
+ CMSException cmsException = (CMSException)returnValue;
+ if(cmsException.toString().indexOf("Access to this resource is denied") != -1 ||
+ cmsException.hasPathFormatFailure())
{
- throw (CMSException)returnValue;
- }
+ throw cmsException;
+ }
else
{
returnValue = null;
@@ -149,7 +172,7 @@
}
catch(CMSException ce)
{
- if (ce.toString().indexOf("Access to this resource is denied") != -1)
+ if (ce.toString().indexOf("Access to this resource is denied") != -1 || ce.hasPathFormatFailure())
{
result = ce;
}
@@ -206,4 +229,40 @@
return context;
}
+
+ private Set getCurrentRoles() throws PolicyContextException
+ {
+ Set<String> roles = new HashSet<String>();
+
+ // Get the current authenticated subject through the JACC contract
+ Subject subject = (Subject)PolicyContext.getContext("javax.security.auth.Subject.container");
+
+ if (subject != null)
+ {
+ Set tmp = subject.getPrincipals(JACCPortalPrincipal.class);
+ JACCPortalPrincipal pp = null;
+ for (Iterator i = tmp.iterator(); i.hasNext();)
+ {
+ pp = (JACCPortalPrincipal)i.next();
+ if (pp != null)
+ {
+ break;
+ }
+ }
+ if (pp == null)
+ {
+ pp = new JACCPortalPrincipal(subject);
+ tmp.add(pp);
+
+ // Lazy create all the permission containers for the given role names
+ for (Iterator i = pp.getRoles().iterator(); i.hasNext();)
+ {
+ Principal role = (Principal)i.next();
+ roles.add(role.getName());
+ }
+ }
+ }
+
+ return roles;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/security/AuthorizationProviderImpl.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -26,6 +26,7 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.jboss.portal.cms.hibernate.state.Tools;
+import org.jboss.portal.cms.impl.jcr.JCRCMS;
import org.jboss.portal.identity.AnonymousRole;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityServiceController;
@@ -567,7 +568,7 @@
// Get the current authenticated subject through the JACC contract
Subject subject = (Subject)PolicyContext.getContext("javax.security.auth.Subject.container");
-
+
if (subject != null)
{
Set tmp = subject.getPrincipals(JACCPortalPrincipal.class);
@@ -593,6 +594,13 @@
}
}
}
+
+ if(roles.isEmpty())
+ {
+ //Check and see if roles are found propagated via the cluster context
+ roles = JCRCMS.getRoles();
+ }
+
return roles;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/ApprovePublishImpl.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -159,7 +159,7 @@
this.managerSet = new HashSet();
for (int i = 0; i < managers.length; i++)
{
- this.managers[i] = st.nextToken();
+ this.managers[i] = st.nextToken().trim();
this.managerSet.add(this.managers[i]);
}
@@ -464,7 +464,7 @@
}
processInstance.getContextInstance().setVariable("approved", new Boolean(true));
- processInstance.getContextInstance().setVariable("modifiedContent", modifiedContent);
+ processInstance.getContextInstance().setVariable("modifiedContent", modifiedContent.getBytes());
Collection allTasks = processInstance.getTaskMgmtInstance().getTaskInstances();
if (allTasks != null)
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/CMSWorkflowUtil.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -25,8 +25,12 @@
import java.util.List;
import java.util.Locale;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
import javax.naming.InitialContext;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.portal.cms.CMS;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.model.Content;
@@ -101,19 +105,28 @@
return content;
}
- /**
- *
- * @return
- */
- private static CMS getCMSService()
+ /** @return */
+ public static CMS getCMSService()
{
+ CMS cms = null;
try
{
- return (CMS)new InitialContext().lookup("java:/portal/CMS");
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+ cms = (CMS)MBeanProxy.get(CMS.class, new ObjectName("portal:service=CMS"), mbeanServer);
}
catch (Exception e)
- {
- throw new RuntimeException(e);
+ {
+ try
+ {
+ //Give it a last try and look up in the JNDI tree (this happens in the test suite, where there is no mbean server)
+ cms = (CMS)new InitialContext().lookup("java:/portal/CMS");
+ }
+ catch(Exception ex)
+ {
+ //This failed too....This is a real failure and throw an exception
+ throw new RuntimeException(ex);
+ }
}
+ return cms;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/cms/src/main/org/jboss/portal/cms/workflow/FinalizePublish.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -31,7 +31,6 @@
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
-import javax.naming.InitialContext;
import java.util.List;
import java.util.Locale;
import java.util.ArrayList;
@@ -55,7 +54,7 @@
{
Content content = (Content)executionContext.getContextInstance().getVariable("content");
boolean approved = ((Boolean)executionContext.getContextInstance().getVariable("approved")).booleanValue();
- String modifiedContent = (String)executionContext.getContextInstance().getVariable("modifiedContent");
+ byte[] modifiedContent = (byte[])executionContext.getContextInstance().getVariable("modifiedContent");
long processId = executionContext.getProcessInstance().getId();
CMS cms = this.getCMSService();
@@ -84,9 +83,9 @@
new Locale(language));
File file = (File)cms.execute(command);
- if(modifiedContent != null && modifiedContent.trim().length()>0)
+ if(modifiedContent != null)
{
- file.getContent().setBytes(modifiedContent.getBytes());
+ file.getContent().setBytes(modifiedContent);
}
//now publish this
@@ -181,7 +180,7 @@
{
try
{
- return (CMS)new InitialContext().lookup("java:/portal/CMS");
+ return CMSWorkflowUtil.getCMSService();
}
catch (Exception e)
{
Modified: branches/JBoss_Portal_Branch_2_6/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/build.xml 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core/build.xml 2008-10-17 21:48:54 UTC (rev 12084)
@@ -773,7 +773,7 @@
<copy todir="${jboss.home}/server/${portal-ha.deploy.dir}/jboss-portal-ha.sar" overwrite="true">
<fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
</copy>
- <copy todir="${jboss.home}/server/ports-02/deploy/jboss-portal-ha.sar" overwrite="true">
+ <copy todir="${jboss.home}/server/${portal-ha.node2.deploy.dir}/jboss-portal-ha.sar" overwrite="true">
<fileset dir="${build.lib}/jboss-portal-ha-exploded.sar"/>
</copy>
</target>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -63,6 +63,8 @@
public static final String OP_CREATE_COLLECTION = "createcollection";
public static final String OP_CONFIRM_CREATE_COLLECTION = "confirmcreatecollection";
+
+ public static final String OP_CONFIRM_CREATE_COLLECTION_VALIDATION_ERROR = "confirmcreatecollection_validationError";
public static final String OP_CONFIRMCOPY = "confirmcopy";
@@ -111,4 +113,8 @@
public static final String OP_VIEWPENDINGPREVIEW = "view_pending_preview";
public static final String OP_MODIFYANDAPPROVE = "modify_and_approve";
+
+ public static final String CMS_FILENAME_INVALID = "CMS_FILENAME_INVALID";
+
+ public static final String CMS_FOLDERNAME_INVALID = "CMS_FOLDERNAME_INVALID";
}
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-17 21:48:54 UTC (rev 12084)
@@ -208,8 +208,8 @@
{
String sPath = rReq.getParameter("path");
String sOp = rReq.getParameter("returnOp");
-
+
rRes.setContentType("text/html");
rReq.setAttribute("path", sPath);
rReq.setAttribute("returnOp", sOp);
@@ -219,7 +219,7 @@
catch(Exception e)
{
throw new PortletException(e);
- }
+ }
}
private void internalDoView(JBossRenderRequest rReq, JBossRenderResponse rRes)
@@ -274,7 +274,7 @@
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/main.jsp");
prd.include(rReq, rRes);
}
- else if (CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION.equals(op))
+ else if (CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION.equals(op) || CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION_VALIDATION_ERROR.equals(op))
{
try
{
@@ -295,6 +295,21 @@
String sPath = rReq.getParameter("path");
rRes.setContentType("text/html");
rReq.setAttribute("createpath", sPath);
+
+ if (rReq.getParameter("error:message") != null)
+ {
+ rReq.setAttribute("error:message", rReq.getParameter("error:message"));
+ }
+ if (rReq.getParameter("error:newcollectionname") != null)
+ {
+ rReq.setAttribute("error:newcollectionname", rReq.getParameter("error:newcollectionname"));
+ }
+ if (rReq.getParameter("error:newcollectiondescription") != null)
+ {
+ rReq.setAttribute("error:newcollectiondescription", rReq.getParameter("error:newcollectiondescription"));
+ }
+
+
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/confirmcreatecollection.jsp");
prd.include(rReq, rRes);
}
@@ -563,6 +578,14 @@
{
rReq.setAttribute("error:language", rReq.getParameter("error:language"));
}
+ if (rReq.getParameter("error:filename") != null)
+ {
+ rReq.setAttribute("error:filename", rReq.getParameter("error:filename"));
+ }
+ if (rReq.getParameter("error:message") != null)
+ {
+ rReq.setAttribute("error:message", rReq.getParameter("error:message"));
+ }
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/create.jsp");
prd.include(rReq, rRes);
@@ -733,6 +756,13 @@
}
else if (CMSAdminConstants.OP_VIEWPENDING.equals(op))
{
+ boolean isWorkflowManagementAccessible = this.isWorkflowManagementAccessible(rReq);
+ if(!isWorkflowManagementAccessible)
+ {
+ this.showAccessDeniedScreen(rReq, rRes);
+ return;
+ }
+
String sPath = rReq.getParameter("path");
if (this.getApprovePublish() != null)
@@ -760,6 +790,20 @@
String path = rReq.getParameter("path");
String contentPath = rReq.getParameter("contentPath");
+ boolean isWorkflowManagementAccessible = this.isWorkflowManagementAccessible(rReq);
+ if(!isWorkflowManagementAccessible)
+ {
+ this.showAccessDeniedScreen(rReq, rRes);
+ return;
+ }
+
+ boolean hasWriteAccess = this.hasWriteAccess(rReq, path);
+ if(!hasWriteAccess)
+ {
+ this.showAccessDeniedScreen(rReq, rRes);
+ return;
+ }
+
if (this.getApprovePublish() != null)
{
try
@@ -854,11 +898,46 @@
folder.setName(sFolderName);
folder.setBasePath(sNewPath);
- Command saveCMD = CMSService.getCommandFactory().createFolderSaveCommand(folder);
- CMSService.execute(saveCMD);
+ try
+ {
+ Command saveCMD = CMSService.getCommandFactory().createFolderSaveCommand(folder);
+ CMSService.execute(saveCMD);
+ }
+ catch(CMSException cme)
+ {
+ if(cme.hasPathFormatFailure())
+ {
+ //Validation Error occurred
+ //FileName should not be empty
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION_VALIDATION_ERROR);
+ aRes.setRenderParameter("path", aReq.getParameter("destination"));
+ //used to remember the data already submitted by the user
+ aRes.setRenderParameter("error:message", CMSAdminConstants.CMS_FOLDERNAME_INVALID);
+ aRes.setRenderParameter("error:newcollectionname", aReq.getParameter("newcollectionname"));
+ aRes.setRenderParameter("error:newcollectiondescription", aReq.getParameter("newcollectiondescription"));
+
+ return;
+ }
+ else
+ {
+ throw cme;
+ }
+ }
+
aRes.setRenderParameter("op", CMSAdminConstants.OP_MAIN);
aRes.setRenderParameter("path", sNewPath);
+ }
+ else
+ {
+ //Validation Error
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION_VALIDATION_ERROR);
+ aRes.setRenderParameter("path", aReq.getParameter("destination"));
+
+ //used to remember the data already submitted by the user
+ aRes.setRenderParameter("error:message", CMSAdminConstants.CMS_FOLDERNAME_INVALID);
+ aRes.setRenderParameter("error:newcollectionname", aReq.getParameter("newcollectionname"));
+ aRes.setRenderParameter("error:newcollectiondescription", aReq.getParameter("newcollectiondescription"));
}
}
else if (CMSAdminConstants.OP_UPLOADCONTENT.equals(op))
@@ -1031,7 +1110,27 @@
{
String sNodeName = sFrom.substring(sFrom.lastIndexOf("/") + 1, sFrom.length());
sTo = FileUtil.cleanDoubleSlashes(sTo + "/" + sNodeName);
+
+ // check if destination already exists
+ Command existsCMD = CMSService.getCommandFactory().createItemExistsCommand(sTo);
+ Boolean bExists = (Boolean)CMSService.execute(existsCMD);
+ if (bExists.booleanValue())
+ {
+ List messages = new ArrayList();
+ messages.add(this.resources.getObject("CMS_MSG_DESTINATION_ALREADY_EXISTS"));
+ aReq.getPortletSession().setAttribute("messages", messages);
+ try
+ {
+ String sParentPath = NodeUtil.getParentPath(sFrom);
+ aRes.setRenderParameter("path", sParentPath);
+ }
+ catch (Exception e)
+ {
+ }
+ return;
+ }
+
Command copyCommand = CMSService.getCommandFactory().createCopyCommand(sFrom, sTo);
CMSService.execute(copyCommand);
@@ -1056,6 +1155,29 @@
{
String sNodeName = sFrom.substring(sFrom.lastIndexOf("/") + 1, sFrom.length());
sTo = FileUtil.cleanDoubleSlashes(sTo + "/" + sNodeName);
+
+ // check if destination already exists
+ Command existsCMD = CMSService.getCommandFactory().createItemExistsCommand(sTo);
+ Boolean bExists = (Boolean)CMSService.execute(existsCMD);
+ if (bExists.booleanValue())
+ {
+ List messages = new ArrayList();
+ messages.add(this.resources.getObject("CMS_MSG_DESTINATION_ALREADY_EXISTS"));
+ aReq.getPortletSession().setAttribute("messages", messages);
+ try
+ {
+ String sParentPath = NodeUtil.getParentPath(sFrom);
+ aRes.setRenderParameter("path", sParentPath);
+ }
+ catch (Exception e)
+ {
+
+ }
+ return;
+ }
+
+ Command moveCommand = CMSService.getCommandFactory().createMoveCommand(sFrom, sTo);
+ CMSService.execute(moveCommand);
if ("fo".equalsIgnoreCase(sType))
{
aRes.setRenderParameter("op", CMSAdminConstants.OP_MAIN);
@@ -1063,9 +1185,7 @@
else if ("fi".equalsIgnoreCase(sType))
{
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
- }
- Command moveCommand = CMSService.getCommandFactory().createMoveCommand(sFrom, sTo);
- CMSService.execute(moveCommand);
+ }
aRes.setRenderParameter("path", sTo);
}
@@ -1241,8 +1361,40 @@
file.setContent(new Locale(sLanguage), content);
+ //Check and make sure file can be successfully saved
Command existsCMD = CMSService.getCommandFactory().createItemExistsCommand(content.getBasePath());
- Boolean bExists = (Boolean)CMSService.execute(existsCMD);
+ Boolean bExists = null;
+ try
+ {
+ bExists = (Boolean)CMSService.execute(existsCMD);
+ }
+ catch(CMSException cme)
+ {
+ if(cme.hasPathFormatFailure())
+ {
+ //Validation Error occurred
+ //FileName should not be empty
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_CREATEFILE_VALIDATION_ERROR);
+
+ //set render parameters here
+ aRes.setRenderParameter("path", sDirectory);
+
+ //used to remember the data already submitted by the user
+ aRes.setRenderParameter("error:message", CMSAdminConstants.CMS_FILENAME_INVALID);
+ aRes.setRenderParameter("error:filename", aReq.getParameter("filename"));
+ aRes.setRenderParameter("error:content", aReq.getParameter("elm1"));
+ aRes.setRenderParameter("error:description", aReq.getParameter("description"));
+ aRes.setRenderParameter("error:title", aReq.getParameter("title"));
+ aRes.setRenderParameter("error:language", aReq.getParameter("language"));
+
+ return;
+ }
+ else
+ {
+ throw cme;
+ }
+ }
+
if (bExists.booleanValue()) // if file exists, update contentNode
{
Command cmdUpdate = CMSService.getCommandFactory().createUpdateFileCommand(file, content, true);
@@ -1371,6 +1523,12 @@
}
else if (CMSAdminConstants.OP_APPROVE.equals(op))
{
+ boolean hasWriteAccess = this.hasWriteAccess(aReq, aReq.getParameter("path"));
+ if(!hasWriteAccess)
+ {
+ throw new CMSException("Access to this resource is denied");
+ }
+
String sManager = aReq.getUser().getUserName();
String sPID = aReq.getParameter("pid");
try
@@ -1399,6 +1557,12 @@
}
else if (CMSAdminConstants.OP_DENY.equals(op))
{
+ boolean hasWriteAccess = this.hasWriteAccess(aReq, aReq.getParameter("path"));
+ if(!hasWriteAccess)
+ {
+ throw new CMSException("Access to this resource is denied");
+ }
+
String sManager = aReq.getUser().getUserName();
String sPID = aReq.getParameter("pid");
try
@@ -1450,6 +1614,12 @@
}
else if(CMSAdminConstants.OP_MODIFYANDAPPROVE.equals(op))
{
+ boolean hasWriteAccess = this.hasWriteAccess(aReq, aReq.getParameter("path"));
+ if(!hasWriteAccess)
+ {
+ throw new CMSException("Access to this resource is denied");
+ }
+
String modifiedContent = aReq.getParameter("elm1");
String processId = aReq.getParameter("pid");
String path = aReq.getParameter("path");
@@ -1839,4 +2009,38 @@
{
}
+
+ private boolean hasWriteAccess(PortletRequest request, String path)
+ {
+ boolean hasAccess = false;
+
+ User user = null;
+ if(request instanceof JBossRenderRequest)
+ {
+ user = ((JBossRenderRequest)request).getUser();
+ }
+ else if(request instanceof JBossActionRequest)
+ {
+ user = ((JBossActionRequest)request).getUser();
+ }
+
+ try
+ {
+ user = userModule.findUserById(user.getId());
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+
+ PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
+ File file = new FileImpl();
+ file.setBasePath(path);
+ securityContext.setAttribute("command", CMSService.getCommandFactory().createFileUpdateCommand(file));
+
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ hasAccess = this.authorizationManager.checkPermission(cmsPermission);
+
+ return hasAccess;
+ }
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/domain.hbm.xml 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/domain.hbm.xml 2008-10-17 21:48:54 UTC (rev 12084)
@@ -277,7 +277,7 @@
<!-- mapping to persist CMS Fine Grained Security related objects -->
<class name="org.jboss.portal.cms.security.PermRoleAssoc" table="jbp_cms_perm_role">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<id
name="id"
column="ID"
@@ -292,7 +292,7 @@
/>
</class>
<class name="org.jboss.portal.cms.security.PermUserAssoc" table="jbp_cms_perm_user">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<id
name="id"
column="ID"
@@ -307,7 +307,7 @@
/>
</class>
<class name="org.jboss.portal.cms.security.Criteria" table="jbp_cms_perm_criteria">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<id
name="id"
column="ID"
@@ -328,7 +328,7 @@
/>
</class>
<class name="org.jboss.portal.cms.security.Permission" table="jbp_cms_perm">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<id
name="id"
column="ID"
@@ -337,19 +337,19 @@
</id>
<!-- one-to-many association with the criteria object -->
<set name="criteria" lazy="false" table="jbp_cms_perm_criteria" cascade="all-delete-orphan">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<key column="CMS_PERM_ID"/>
<one-to-many class="org.jboss.portal.cms.security.Criteria"/>
</set>
<!-- many-to-many association with the role object -->
<set name="roleAssoc" lazy="false" cascade="all-delete-orphan">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<key column="CMS_PERM_ID"/>
<one-to-many class="org.jboss.portal.cms.security.PermRoleAssoc"/>
</set>
<!-- many-to-many association with the user object -->
<set name="userAssoc" lazy="false" cascade="all-delete-orphan">
- <cache usage="read-write"/>
+ <cache usage="@portal.hibernate.cache.usage@"/>
<key column="CMS_PERM_ID"/>
<one-to-many class="org.jboss.portal.cms.security.PermUserAssoc"/>
</set>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/hibernate.cfg.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/hibernate.cfg.xml 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-sar/conf/hibernate/cms/hibernate.cfg.xml 2008-10-17 21:48:54 UTC (rev 12084)
@@ -33,8 +33,23 @@
<!-- caching properties -->
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
- <property name="cache.provider_configuration_file_resource_path">conf/hibernate/cms/ehcache.xml</property>
- <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
+
+ <!--
+ | Uncomment in clustered mode : use transactional replicated cache
+ @portal.single.xml.close@
+ <property name="cache.provider_class">org.jboss.portal.jems.hibernate.JMXTreeCacheProvider</property>
+ <property name="cache.object_name">portal:service=TreeCacheProvider,type=hibernate</property>
+ @portal.single.xml.open@
+ -->
+
+ <!--
+ | Comment in clustered mode
+ @portal.clustered.xml.close@
+ <property name="cache.provider_configuration_file_resource_path">conf/hibernate/portal/ehcache.xml</property>
+ <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
+ @portal.clustered.xml.open@
+ -->
+
<!-- managed environment transaction configuration -->
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-17 21:48:54 UTC (rev 12084)
@@ -121,6 +121,7 @@
CMS_HELP=The CMS Portlet displays content from the file store inside a portlet window, or, in the case of binary content, outside of the portlet window altogether
CMS_TO_MODIFY=To modify how this portlet behaves, please
CMS_CLICK_HERE=click here
+CMS_SELECT_ACTION=Select Action
CMS_QUERYERROR=The query you entered is not valid
@@ -139,4 +140,9 @@
CMS_MISSING_DOCUMENT=404 - Page Not Found
CMS_MISSING_DOCUMENT_DESCRIPTION=The document you tried to access is not available
+CMS_FILENAME_INVALID=File Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character.
+CMS_FOLDERNAME_INVALID=Folder Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character.
+CMS_MSG_DESTINATION_ALREADY_EXISTS=The command was not performed, because the destination already exists.
+
+
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/accessdenied.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/accessdenied.jsp 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/accessdenied.jsp 2008-10-17 21:48:54 UTC (rev 12084)
@@ -6,8 +6,17 @@
<portlet:defineObjects/>
<%
- String sBackPath = (String)request.getAttribute("path");
- String OP = CMSAdminConstants.OP_MAIN;
+ String OP = (String)request.getAttribute("returnOp");
+ String sBackPath = null;
+ if(OP != null)
+ {
+ sBackPath = (String)request.getAttribute("path");
+ }
+ else
+ {
+ OP = CMSAdminConstants.OP_MAIN;
+ sBackPath = "/";
+ }
%>
<link rel="stylesheet" type="text/css" href="/portal-admin/css/style.css" media="screen"/>
<div class="admin-ui">
@@ -21,18 +30,18 @@
<h2>${n:i18n("CMS_ACCESS_DENIED")}</h2>
</td>
</tr>
+ <%if(sBackPath != null){%>
<tr>
<td class="portlet-section-body" align="center">
<form name="accessdeniedform" method="post">
- <input class="portlet-form-button" type="button" value="${n:i18n("CMS_BACKTOBROWSER")}"
+ <input class="portlet-form-button" type="button" value="${n:i18n("CMS_BACKTOBROWSER")}"
name="back"
- onclick="window.location='<portlet:renderURL><portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/><portlet:param name="path" value="<%= sBackPath %>"/></portlet:renderURL>'">
+ onclick="window.location='<portlet:renderURL><portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/><portlet:param name="path" value="<%= sBackPath %>"/></portlet:renderURL>'"/>
</form>
</td>
- </tr>
- </table>
- <br/><br/>
-
-
+ </tr>
+ <%}%>
+ </table>
+ <br/><br/>
</div>
</div>
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp 2008-10-17 21:48:54 UTC (rev 12084)
@@ -6,6 +6,19 @@
<%
String sCurrPath = (String)request.getAttribute("createpath");
String OP = CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION;
+
+ //validation handling related data
+ String newcollectionname = (String)request.getAttribute("error:newcollectionname");
+ String newcollectiondescription = (String)request.getAttribute("error:newcollectiondescription");
+ String errorMessage = (String)request.getAttribute("error:message");
+ if(newcollectionname == null)
+ {
+ newcollectionname = "";
+ }
+ if(newcollectiondescription == null)
+ {
+ newcollectiondescription = "";
+ }
%>
<portlet:defineObjects/>
<link rel="stylesheet" type="text/css" href="/portal-admin/css/style.css" media="screen"/>
@@ -14,6 +27,14 @@
<h3 class="sectionTitle-blue">${n:i18n("TITLE_CREATECOLLCONFIRM")}</h3>
<div class=" cms-tab-container">
<table width="100%">
+ <%if(errorMessage != null){%>
+ <tr>
+ <td colspan="2">
+ <font color="red">${n:i18n("CMS_FOLDERNAME_INVALID")}</font>
+ </td>
+ </tr>
+ <%}%>
+
<tr>
<td valign="top" width="250" class="portlet-section-alternate">
<%@ include file="folderlist.jsp" %>
@@ -36,14 +57,14 @@
<tr>
<td valign="bottom">${n:i18n("CMS_NAME")}:</td>
<td align="left"><input class="portlet-form-input-field" type="text"
- name="newcollectionname" size="40" maxlength="50">
+ name="newcollectionname" size="40" maxlength="50" value="<%=newcollectionname.replace("\"", """)%>">
</td>
</tr>
<tr>
<td valign="bottom">${n:i18n("CMS_DESCRIPTION")}:</td>
<td align="left"><input class="portlet-form-input-field" type="text"
name="newcollectiondescription"
- size="40" maxlength="80">
+ size="40" maxlength="80" value="<%=newcollectiondescription.replace("\"", """)%>">
</td>
</tr>
<tr>
Modified: branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp 2008-10-17 13:41:55 UTC (rev 12083)
+++ branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp 2008-10-17 21:48:54 UTC (rev 12084)
@@ -19,6 +19,8 @@
String description = (String)request.getAttribute("error:description");
String title = (String)request.getAttribute("error:title");
String language = (String)request.getAttribute("error:language");
+ String fileName = (String)request.getAttribute("error:filename");
+ String errorMessage = (String)request.getAttribute("error:message");
if (sContent == null)
{
sContent = "";
@@ -35,6 +37,10 @@
{
language = "";
}
+ if(fileName == null)
+ {
+ fileName = "";
+ }
%>
<!-- tinyMCE -->
@@ -104,7 +110,16 @@
<tr>
<td height="10"></td>
</tr>
+
+<%if(errorMessage != null){%>
<tr>
+ <td colspan="2">
+ <font color="red">${n:i18n("CMS_FILENAME_INVALID")}</font>
+ </td>
+</tr>
+<%}%>
+
+<tr>
<td>
<table>
<tr>
@@ -118,7 +133,9 @@
<td>
<input
type="text" name="filename"
- class="portlet-form-input-field"/>
+ class="portlet-form-input-field"
+ value="<%=fileName.replace("\"", """)%>"
+ />
: ${n:i18n("CMS_REQUIRED")}
</td>
</tr>
17 years, 9 months
JBoss Portal SVN: r12083 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-17 09:41:55 -0400 (Fri, 17 Oct 2008)
New Revision: 12083
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
Log:
- JBPORTAL-2201: Remove extra separator: rewrite token should be replaced by the namespace and nothing else!
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2008-10-17 13:41:25 UTC (rev 12082)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2008-10-17 13:41:55 UTC (rev 12083)
@@ -95,7 +95,7 @@
// process the response
consumer.getSessionHandler().updateSessionIfNeeded(markupResponse.getSessionContext(), invocation,
- requestPrecursor.getPortletHandle());
+ requestPrecursor.getPortletHandle());
MarkupContext markupContext = markupResponse.getMarkupContext();
String markup = markupContext.getMarkupString();
@@ -103,7 +103,7 @@
if (markup != null && binary != null)
{
return new ErrorResponse(new IllegalArgumentException("Markup response cannot contain both string and binary " +
- "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
}
if (markup == null && binary == null)
@@ -115,7 +115,7 @@
else
{
return new ErrorResponse(new IllegalArgumentException("Markup response must contain at least string or binary" +
- " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
}
}
@@ -184,7 +184,7 @@
private String processMarkup(String markup, PortletInvocation invocation, boolean rewriteURLs)
{
// fix-me: how to deal with fragment header? => interceptor?
- String prefix = getNamespaceFrom(invocation.getWindowContext()) + SEPARATOR;
+ String prefix = getNamespaceFrom(invocation.getWindowContext());
markup = Tools.replace(markup, WSRPRewritingConstants.WSRP_REWRITE_TOKEN, prefix);
@@ -258,11 +258,11 @@
if (urlAsString.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
WSRPPortletURL portletURL = WSRPPortletURL.create(urlAsString,
- info.getSupportedCustomModes(), info.getSupportedCustomWindowStates());
+ info.getSupportedCustomModes(), info.getSupportedCustomWindowStates());
if (portletURL instanceof WSRPResourceURL)
{
log.debug("URL '" + urlAsString + "' seems to refer to a resource which are not currently supported. " +
- "Trying to use the raw URL but this probably won't work...");
+ "Trying to use the raw URL but this probably won't work...");
return portletURL.toString();
}
17 years, 9 months
JBoss Portal SVN: r12082 - branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-17 09:41:25 -0400 (Fri, 17 Oct 2008)
New Revision: 12082
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
Log:
- JBPORTAL-2201: Remove extra separator: rewrite token should be replaced by the namespace and nothing else!
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2008-10-17 02:08:44 UTC (rev 12081)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2008-10-17 13:41:25 UTC (rev 12082)
@@ -86,7 +86,7 @@
// process the response
consumer.getSessionHandler().updateSessionIfNeeded(markupResponse.getSessionContext(), invocation,
- requestPrecursor.getPortletHandle());
+ requestPrecursor.getPortletHandle());
MarkupContext markupContext = markupResponse.getMarkupContext();
String markup = markupContext.getMarkupString();
@@ -94,7 +94,7 @@
if (markup != null && binary != null)
{
return new ErrorResponse(new IllegalArgumentException("Markup response cannot contain both string and binary " +
- "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
}
if (markup == null && binary == null)
@@ -106,7 +106,7 @@
else
{
return new ErrorResponse(new IllegalArgumentException("Markup response must contain at least string or binary" +
- " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
}
}
@@ -129,7 +129,7 @@
org.jboss.portal.portlet.cache.CacheControl cacheControl = createCacheControl(markupContext);
FragmentResponse result = new FragmentResponse(null, null, mimeType, null, markup,
- markupContext.getPreferredTitle(), cacheControl, invocation.getPortalContext().getModes());
+ markupContext.getPreferredTitle(), cacheControl, invocation.getPortalContext().getModes());
log.debug("Response processed");
return result;
@@ -170,14 +170,14 @@
private String processMarkup(String markup, PortletInvocation invocation, boolean rewriteURLs)
{
// fix-me: how to deal with fragment header? => interceptor?
- String prefix = getNamespaceFrom(invocation.getWindowContext()) + SEPARATOR;
+ String prefix = getNamespaceFrom(invocation.getWindowContext());
markup = Tools.replace(markup, WSRPRewritingConstants.WSRP_REWRITE_TOKEN, prefix);
if (rewriteURLs)
{
URLFormat format = new URLFormat(invocation.getSecurityContext().isSecure(),
- invocation.getSecurityContext().isAuthenticated(), true, true);
+ invocation.getSecurityContext().isAuthenticated(), true, true);
WSRPURLRewriter rewriter = new WSRPURLRewriter(invocation.getContext(), format, consumer);
markup = URLTools.replaceURLsBy(markup, rewriter);
}
@@ -244,11 +244,11 @@
if (urlAsString.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
WSRPPortletURL portletURL = WSRPPortletURL.create(urlAsString,
- info.getSupportedCustomModes(), info.getSupportedCustomWindowStates());
+ info.getSupportedCustomModes(), info.getSupportedCustomWindowStates());
if (portletURL instanceof WSRPResourceURL)
{
log.debug("URL '" + urlAsString + "' seems to refer to a resource which are not currently supported. " +
- "Trying to use the raw URL but this probably won't work...");
+ "Trying to use the raw URL but this probably won't work...");
return portletURL.toString();
}
17 years, 9 months