portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r1178828 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src: main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java test/java/org/apache/jetspeed/layout/TestPageLayout.java
Date Tue, 04 Oct 2011 15:14:37 GMT
Author: woonsan
Date: Tue Oct  4 15:14:37 2011
New Revision: 1178828

URL: http://svn.apache.org/viewvc?rev=1178828&view=rev
Log:
JS2-1259: reverting r1178716 because the original code setting null was properly intended
to initialize the security constraints and reset later.
Also, the original code work fine with CastorXmlPageManager.
So, the question is now to add a test case with DatabasePageManager and test/fix it to work
fine as well.

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/test/java/org/apache/jetspeed/layout/TestPageLayout.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java?rev=1178828&r1=1178827&r2=1178828&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java
Tue Oct  4 15:14:37 2011
@@ -1923,8 +1923,11 @@ public class PageLayoutComponentImpl imp
             // check for edit permission
             fragment.checkAccess(JetspeedActions.EDIT);            
 
-            // update fragment preferences and page in page manager
-            fragment.setSecurityConstraints(constraints);
+            // update fragment preferences and page in page manager.
+            
+            // Initializing security constraints by setting null first to reset it after
aggregating into fragmentConstraintsConstraints..
+            fragment.setSecurityConstraints(null);
+            
             if ((constraints != null) && !constraints.isEmpty())
             {
                 SecurityConstraints fragmentConstraints = fragment.newSecurityConstraints();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/test/java/org/apache/jetspeed/layout/TestPageLayout.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/test/java/org/apache/jetspeed/layout/TestPageLayout.java?rev=1178828&r1=1178827&r2=1178828&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/test/java/org/apache/jetspeed/layout/TestPageLayout.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/test/java/org/apache/jetspeed/layout/TestPageLayout.java
Tue Oct  4 15:14:37 2011
@@ -602,6 +602,21 @@ public class TestPageLayout extends Abst
             throw exception;
         }
     }
+    
+    public void testUpdateSecurityConstraints() throws Exception {
+        assertNotNull(pageManager);
+        assertNotNull(pageLayout);
+
+        Page page = pageManager.getPage("/page.psml");
+        assertNotNull(page);
+        ContentPage pageContentPage = pageLayout.newContentPage(page, pageManager.getPageTemplate("/template.tpsml"),
Collections.emptyMap());
+        assertNotNull(pageContentPage);
+        ContentFragment contentFrag = pageContentPage.getFragmentByFragmentId("fake-portlet");
+        assertNotNull(contentFrag);
+        
+        pageLayout.updateSecurityConstraints(contentFrag, null);
+        assertNull(contentFrag.getSecurityConstraints());
+    }
 
     public static abstract class AbstractTestPrincipal extends TransientJetspeedPrincipal
     {



---------------------------------------------------------------------
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