You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2017/07/13 03:41:23 UTC

directory-fortress-commander git commit: FC-224 - reenable group and openldap audit tests

Repository: directory-fortress-commander
Updated Branches:
  refs/heads/master e2f86d574 -> ed0ed3338


FC-224 - reenable group and openldap audit tests


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/commit/ed0ed333
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/tree/ed0ed333
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/diff/ed0ed333

Branch: refs/heads/master
Commit: ed0ed3338d605e70021e959d5176cd02b4c89796
Parents: e2f86d5
Author: Shawn McKinney <sm...@apache.org>
Authored: Wed Jul 12 22:41:16 2017 -0500
Committer: Shawn McKinney <sm...@apache.org>
Committed: Wed Jul 12 22:41:16 2017 -0500

----------------------------------------------------------------------
 .../fortress/web/FortressWebBasePage.java       |  23 +-
 .../apache/directory/fortress/web/NavPanel.java | 261 +++++++++----------
 src/main/resources/FortressWebDemoUsers.xml     |   4 -
 .../integration/FortressWebSeleniumITCase.java  |  11 +-
 4 files changed, 138 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/ed0ed333/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
index 1cf11cd..59438a1 100644
--- a/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
+++ b/src/main/java/org/apache/directory/fortress/web/FortressWebBasePage.java
@@ -137,14 +137,25 @@ public abstract class FortressWebBasePage extends WebPage
         add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.GROUP_PAGE, GroupPage.class,
             org.apache.directory.fortress.web.common.GlobalIds.ROLE_GROUPS ) );
 
-        add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_BINDS_PAGE, AuditBindPage.class,
-            org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_BINDS ) );
+        // The audit pages only work with OpenLDAP:
+        if ( Config.getInstance().isOpenldap() )
+        {
+            add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_BINDS_PAGE, AuditBindPage.class,
+                org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_BINDS ) );
 
-        add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_AUTHZS_PAGE, AuditAuthzPage.class,
-            org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_AUTHZS ) );
+            add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_AUTHZS_PAGE, AuditAuthzPage.class,
+                org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_AUTHZS ) );
 
-        add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_MODS_PAGE, AuditModPage.class,
-            org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_MODS ) );
+            add( new SecureBookmarkablePageLink( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_MODS_PAGE, AuditModPage.class,
+                org.apache.directory.fortress.web.common.GlobalIds.ROLE_AUDIT_MODS ) );
+        }
+        else
+        {
+            // Only supported for openldap so set dummy links to be invisible.
+            add( new Label( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_BINDS_PAGE, "" ).setVisible( false ) );
+            add( new Label( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_AUTHZS_PAGE, "" ).setVisible( false ) );
+            add( new Label( org.apache.directory.fortress.web.common.GlobalIds.AUDIT_MODS_PAGE, "" ).setVisible( false ) );
+        }
 
         add( new Label( "footer", "Copyright (c) 2003-2016, The Apache Software Foundation. All Rights Reserved." ) );
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/ed0ed333/src/main/java/org/apache/directory/fortress/web/NavPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/NavPanel.java b/src/main/java/org/apache/directory/fortress/web/NavPanel.java
index b3d1844..13e5056 100644
--- a/src/main/java/org/apache/directory/fortress/web/NavPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/NavPanel.java
@@ -21,10 +21,12 @@
 package org.apache.directory.fortress.web;
 
 
+import jdk.nashorn.internal.runtime.regexp.joni.Config;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.attributes.AjaxCallListener;
 import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.FormComponentPanel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -507,150 +509,127 @@ public class NavPanel extends FormComponentPanel
             }
             );
 
-            add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_BINDS_PAGE, GlobalIds.ROLE_AUDIT_BINDS )
+            // These pages only work with OpenLDAP:
+            if ( org.apache.directory.fortress.core.util.Config.getInstance().isOpenldap() )
             {
-                /** Default serialVersionUID */
-                private static final long serialVersionUID = 1L;
-
-
-                @Override
-                public void onSubmit( AjaxRequestTarget target, Form<?> form )
-                {
-                    setResponsePage( AuditBindPage.class );
-                }
-
-
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        /** Default serialVersionUID */
-                        private static final long serialVersionUID = 1L;
-
-
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
+                add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_BINDS_PAGE, GlobalIds.ROLE_AUDIT_BINDS )
+                     {
+                         /**
+                          * Default serialVersionUID
+                          */
+                         private static final long serialVersionUID = 1L;
+
+
+                         @Override
+                         public void onSubmit(AjaxRequestTarget target, Form<?> form)
+                         {
+                             setResponsePage( AuditBindPage.class );
+                         }
+
+
+                         @Override
+                         protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
+                         {
+                             super.updateAjaxAttributes( attributes );
+                             AjaxCallListener ajaxCallListener = new AjaxCallListener()
+                             {
+                                 /** Default serialVersionUID */
+                                 private static final long serialVersionUID = 1L;
+
+
+                                 @Override
+                                 public CharSequence getFailureHandler(Component component)
+                                 {
+                                     return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
+                                 }
+                             };
+                             attributes.getAjaxCallListeners().add( ajaxCallListener );
+                         }
+                     }
+
+                );
+
+                add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_AUTHZS_PAGE, GlobalIds.ROLE_AUDIT_AUTHZS )
+                     {
+                         /**
+                          * Default serialVersionUID
+                          */
+                         private static final long serialVersionUID = 1L;
+
+
+                         @Override
+                         public void onSubmit(AjaxRequestTarget target, Form<?> form)
+                         {
+                             setResponsePage( AuditAuthzPage.class );
+                         }
+
+
+                         @Override
+                         protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
+                         {
+                             super.updateAjaxAttributes( attributes );
+                             AjaxCallListener ajaxCallListener = new AjaxCallListener()
+                             {
+                                 /** Default serialVersionUID */
+                                 private static final long serialVersionUID = 1L;
+
+
+                                 @Override
+                                 public CharSequence getFailureHandler(Component component)
+                                 {
+                                     return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
+                                 }
+                             };
+                             attributes.getAjaxCallListeners().add( ajaxCallListener );
+                         }
+                     }
+
+                );
+
+                add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_MODS_PAGE, GlobalIds.ROLE_AUDIT_MODS )
+                     {
+                         /**
+                          * Default serialVersionUID
+                          */
+                         private static final long serialVersionUID = 1L;
+
+
+                         @Override
+                         public void onSubmit(AjaxRequestTarget target, Form<?> form)
+                         {
+                             setResponsePage( AuditModPage.class );
+                         }
+
+
+                         @Override
+                         protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
+                         {
+                             super.updateAjaxAttributes( attributes );
+                             AjaxCallListener ajaxCallListener = new AjaxCallListener()
+                             {
+                                 /** Default serialVersionUID */
+                                 private static final long serialVersionUID = 1L;
+
+
+                                 @Override
+                                 public CharSequence getFailureHandler(Component component)
+                                 {
+                                     return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
+                                 }
+                             };
+                             attributes.getAjaxCallListeners().add( ajaxCallListener );
+                         }
+                     }
+                );
             }
-
-            );
-
-            add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_AUTHZS_PAGE, GlobalIds.ROLE_AUDIT_AUTHZS )
+            // TODO: fix me, there's a better way.
+            // if not openldap add button as state invisible.
+            else
             {
-                /** Default serialVersionUID */
-                private static final long serialVersionUID = 1L;
-
-
-                @Override
-                public void onSubmit( AjaxRequestTarget target, Form<?> form )
-                {
-                    setResponsePage( AuditAuthzPage.class );
-                }
-
-
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        /** Default serialVersionUID */
-                        private static final long serialVersionUID = 1L;
-
-
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
+                add (new Button(GlobalIds.AUDIT_BINDS_PAGE).setVisible( false ));
+                add (new Button(GlobalIds.AUDIT_AUTHZS_PAGE).setVisible( false ));
+                add (new Button(GlobalIds.AUDIT_MODS_PAGE).setVisible( false ));
             }
-
-            );
-
-            add( new SecureIndicatingAjaxButton( GlobalIds.AUDIT_MODS_PAGE, GlobalIds.ROLE_AUDIT_MODS )
-            {
-                /** Default serialVersionUID */
-                private static final long serialVersionUID = 1L;
-
-
-                @Override
-                public void onSubmit( AjaxRequestTarget target, Form<?> form )
-                {
-                    setResponsePage( AuditModPage.class );
-                }
-
-
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        /** Default serialVersionUID */
-                        private static final long serialVersionUID = 1L;
-
-
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            }
-
-            );
-
-            //@Authorizable
-            /*
-                        add( new SecureIndicatingAjaxButton( "test", GlobalIds.ADMIN_MGR, "test")
-                        {
-                            @Override
-                            public void onSubmit( AjaxRequestTarget target, Form<?> form )
-                            {
-                                // sleep for 5 seconds to show off the busy indicator
-                                try
-                                {
-                                    Thread.sleep( 5000 );
-                                }
-                                catch ( InterruptedException e )
-                                {
-                                    // noop
-                                }
-                            }
-                        }.setPosition( IndicatingAjaxButton.Position.RIGHT));
-            */
-            /*
-                    add( new SecureIndicatingAjaxButton("test" )
-                    {
-                        @Override public void onSubmit ( AjaxRequestTarget target, Form < ?>form)
-                        {
-                            // sleep for 5 seconds to show off the busy indicator
-                            try
-                            {
-                                TestAuthorization testSecurity = new TestAuthorization();
-                                boolean result = testSecurity.checkAccess( GlobalUtils.getSession( this ), "foo", "fighters" );
-                                Thread.sleep( 1000 );
-                            }
-                            catch ( InterruptedException e )
-                            {
-                                // noop
-                            }
-                        }
-                    }.setPosition( IndicatingAjaxButton.Position.RIGHT )
-                    );
-            */
-        }
+       }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/ed0ed333/src/main/resources/FortressWebDemoUsers.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/FortressWebDemoUsers.xml b/src/main/resources/FortressWebDemoUsers.xml
index 2f8ff63..65379b3 100644
--- a/src/main/resources/FortressWebDemoUsers.xml
+++ b/src/main/resources/FortressWebDemoUsers.xml
@@ -134,12 +134,8 @@
                 <relationship child="fortress-web-super-user" parent="ROLE_ADMINROLES"/>
                 <relationship child="fortress-web-super-user" parent="ROLE_ADMINOBJS"/>
                 <relationship child="fortress-web-super-user" parent="ROLE_ADMINPERMS"/>
-<!--
-                Group page disabled until the datatable is replaced:
                 <relationship child="fortress-web-super-user" parent="ROLE_GROUPS"/>
-
                 <relationship child="fortress-web-group-admin-user" parent="ROLE_GROUPS"/>
--->
                 <relationship child="fortress-web-group-admin-user" parent="ROLE_POLICIES"/>
                 <relationship child="fortress-web-group-admin-user" parent="ROLE_USERS"/>
                 <relationship child="fortress-web-group-admin-user" parent="ROLE_AUDIT_AUTHZS"/>

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/ed0ed333/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java b/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
index 96dce09..2eae6dc 100644
--- a/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
+++ b/src/test/java/org/apache/directory/fortress/web/integration/FortressWebSeleniumITCase.java
@@ -171,16 +171,14 @@ public class FortressWebSeleniumITCase
             admobjs();
             admperms();
             plcys();
-            //groups();
+            groups();
 
-/*
             if( Config.getInstance().isOpenldap())
             {
                binds();
                authzs();
                mods();
             }
-*/
         }
 
         /*****
@@ -751,13 +749,6 @@ public class FortressWebSeleniumITCase
         List<WebElement> allRows = table.findElements(By.tagName("tr"));
         // And iterate over them, getting the cells
         allRows.get( 5 ).findElement(By.className("imxt-cell")).click();
-        TUtils.sleep( 1 );
-        nextPage( "modstable");
-        TUtils.sleep( 1 );
-        allRows.get( 6 ).findElement(By.className("imxt-cell")).click();
-        TUtils.sleep( 1 );
-        nextPage( "modstable");
-        TUtils.sleep( 1 );
     }
 
     private void nextPage(String szTableName)