portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smi...@apache.org
Subject svn commit: r602371 - /portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
Date Sat, 08 Dec 2007 09:31:08 GMT
Author: smilek
Date: Sat Dec  8 01:31:08 2007
New Revision: 602371

URL: http://svn.apache.org/viewvc?rev=602371&view=rev
Log:
The following revision comments are from branches/JETSPEED-2.1.3 revisions which were not
individually checked-in to trunk
=== ---------------------------------------------------------------- ===
[ from branches/JETSPEED-2.1.3 r595431 ] | smilek | 2007-11-15 13:21:24 -0700 (Thu, 15 Nov
2007) | 1 line

major improvements to desktop page editor (UI, config options, flow, no action layouts); support
for create-new-page-on-edit
=== ---------------------------------------------------------------- ===

Modified:
    portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java

Modified: portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java?rev=602371&r1=602370&r2=602371&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
(original)
+++ portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/layout/impl/PortletActionSecurityPathBehavior.java
Sat Dec  8 01:31:08 2007
@@ -37,10 +37,16 @@
 {
     protected Log log = LogFactory.getLog(PortletActionSecurityPathBehavior.class);    
     protected PageManager pageManager;
+    private boolean enableCreateUserPagesFromRolesOnEdit;
     
-    public PortletActionSecurityPathBehavior(PageManager pageManager)
+    public PortletActionSecurityPathBehavior(PageManager pageManager )
+    {
+    	this( pageManager, Boolean.FALSE ) ;
+    }
+    public PortletActionSecurityPathBehavior(PageManager pageManager, Boolean enableCreateUserPagesFromRolesOnEdit
)
     {
         this.pageManager = pageManager;
+        this.enableCreateUserPagesFromRolesOnEdit = ( enableCreateUserPagesFromRolesOnEdit
== null ? false : enableCreateUserPagesFromRolesOnEdit.booleanValue() );
     }
 
     public boolean checkAccess(RequestContext context, String action)
@@ -57,23 +63,43 @@
         }
         return true;
     }
+    
+    public boolean isCreateNewPageOnEditEnabled()
+    {
+    	return enableCreateUserPagesFromRolesOnEdit;
+    }
+    public boolean isPageQualifiedForCreateNewPageOnEdit(RequestContext context)
+    {
+    	if ( ! this.enableCreateUserPagesFromRolesOnEdit || context == null )
+    		return false ;
+    	return isPageQualifiedForCreateNewPageOnEdit( context.getPage().getPath() );
+    }
+    
+    protected boolean isPageQualifiedForCreateNewPageOnEdit( String pagePath )
+    {
+        if (pagePath == null)
+        	return false;
+        // page must be in role directory
+        return (pagePath.indexOf(Folder.ROLE_FOLDER) == 0);
+    }
 
     public boolean createNewPageOnEdit(RequestContext context)
     {
+    	if ( ! this.enableCreateUserPagesFromRolesOnEdit )
+    		return false ;
+
         Page page = context.getPage();        
-        String path = page.getPath();
+        String pagePath = page.getPath();
         try
-        {        
-            if (path == null)
-                return false;
-            // make sure we are not copying from user area
-            if (path.indexOf(Folder.USER_FOLDER) == -1)
+        {
+        	if ( isPageQualifiedForCreateNewPageOnEdit( pagePath ) )
             {
+        		String pageName = page.getName();
                 this.pageManager.createUserHomePagesFromRoles(context.getSubject());
                 page = this.pageManager.getPage(Folder.USER_FOLDER 
                                                 + context.getRequest().getUserPrincipal().getName()
                                                 + Folder.PATH_SEPARATOR 
-                                                + Folder.FALLBACK_DEFAULT_PAGE);        
        
+                                                + pageName);   // was Folder.FALLBACK_DEFAULT_PAGE
prior to 2007-11-06
                 context.setPage(new ContentPageImpl(page));
                 context.getRequest().getSession().removeAttribute(ProfilerValveImpl.PORTAL_SITE_SESSION_CONTEXT_ATTR_KEY);
               
             }            



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message