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(a)"/>
<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(a)"/>
<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(a)"/>
<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(a)"/>
<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(a)"/>
<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(a)"/>
<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(a)"/>
<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>