directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-commander git commit: FC-102 - [fortress-web] fix problems with group page
Date Mon, 18 May 2015 14:13:00 GMT
Repository: directory-fortress-commander
Updated Branches:
  refs/heads/master 0ad975bca -> 157183acb


FC-102 - [fortress-web] fix problems with group page


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/157183ac
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/tree/157183ac
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/diff/157183ac

Branch: refs/heads/master
Commit: 157183acb8ea1ebcbc0165f2fe378d5cc2e87762
Parents: 0ad975b
Author: Shawn McKinney <smckinney@apache.org>
Authored: Mon May 18 09:12:29 2015 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Mon May 18 09:12:29 2015 -0500

----------------------------------------------------------------------
 pom.xml                                         |  21 ++-
 .../directory/fortress/web/GroupPage.java       |   2 +-
 .../fortress/web/panel/GroupDetailPanel.java    | 148 +++++++++++++++----
 .../fortress/web/panel/GroupListPanel.java      |   6 +-
 src/main/resources/FortressWebDemoUsers.xml     |   1 +
 .../fortress/web/FortressWebBasePage.html       |   4 +
 .../fortress/web/panel/GroupDetailPanel.html    |   3 +
 .../web/panel/UserSearchModalPanel.html         |   7 +-
 8 files changed, 148 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ab2079f..1fd9709 100755
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
   <groupId>org.apache.directory.fortress</groupId>
   <artifactId>fortress-web</artifactId>
   <packaging>war</packaging>
-  <version>1.0-RC40-SNAPSHOT</version>
+  <version>1.0-RC41-SNAPSHOT</version>
   <name>Apache Fortress Web</name>
   <url>http://directory.apache.org/fortress/</url>
   <description>Fortress Web is an ANSI RBAC INCITS 359 compliant administrative UI</description>
@@ -82,9 +82,16 @@
 
   <properties>
     <title>${project.name} ${project.version}</title>
-    <wicket.version>6.18.0</wicket.version>
-    <wicket.jquery.version>6.18.0</wicket.jquery.version>
-    <wicket.kendo-ui.version>6.18.0</wicket.kendo-ui.version>
+    <wicket.version>6.19.0</wicket.version>
+
+    <wicket.jquery.version>6.14.0</wicket.jquery.version>
+    <wicket.kendo-ui.version>6.14.0</wicket.kendo-ui.version>
+
+<!--
+    <wicket.jquery.version>6.19.0</wicket.jquery.version>
+    <wicket.kendo-ui.version>6.19.0</wicket.kendo-ui.version>
+-->
+
     <version.log4j>1.2.17</version.log4j>
     <version.slf4j.log4j12>1.7.7</version.slf4j.log4j12>
     <spring.version>3.2.3.RELEASE</spring.version>
@@ -150,12 +157,14 @@
       <version>${wicket.version}</version>
     </dependency>
     
+<!--
     <dependency>
       <groupId>org.apache.wicket</groupId>
       <artifactId>wicket-auth-roles</artifactId>
       <version>${wicket.version}</version>
     </dependency>
-    
+-->
+
     <dependency>
       <groupId>org.apache.wicket</groupId>
       <artifactId>wicket-datetime</artifactId>
@@ -203,7 +212,7 @@
       <artifactId>wicket-kendo-ui</artifactId>
       <version>${wicket.kendo-ui.version}</version>
     </dependency>
-    
+
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/java/org/apache/directory/fortress/web/GroupPage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/GroupPage.java b/src/main/java/org/apache/directory/fortress/web/GroupPage.java
index 6dc7041..ea88029 100644
--- a/src/main/java/org/apache/directory/fortress/web/GroupPage.java
+++ b/src/main/java/org/apache/directory/fortress/web/GroupPage.java
@@ -47,7 +47,7 @@ public class GroupPage extends FortressWebBasePage
     {
         add( new Label( GlobalIds.PAGE_HEADER, label ) );
         WebMarkupContainer container = new WebMarkupContainer( GlobalIds.LAYOUT );
-        FourWaySplitter splitter = new FourWaySplitter();
+        FourWaySplitter splitter = new FourWaySplitter( "40", "60" );
         splitter.addBorderLayout( container );
 
         // Add the four necessary panels for Commander Page: 1. Nav,, 2. List, 3. Info, 4.
Detail

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
index b20a0a9..96a139f 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/GroupDetailPanel.java
@@ -61,6 +61,8 @@ import org.apache.directory.fortress.core.util.attr.VUtil;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 
@@ -392,7 +394,7 @@ public class GroupDetailPanel extends FormComponentPanel
                             {
                                 Group newGroup = groupMgr.add( group, key, val );
                                 group.setProperties( newGroup.getProperties() );
-                                memberPropsCB = new ComboBox<String>( "memberProps",
new PropertyModel<String>( form,
+                                memberPropsCB = new ComboBox<>( "memberProps", new
PropertyModel<String>( form,
                                     "memberPropsSelection" ), group.getPropList() );
                                 form.addOrReplace( memberPropsCB );
                             }
@@ -525,17 +527,20 @@ public class GroupDetailPanel extends FormComponentPanel
                         try
                         {
                             // TODO: figure out how to get the table to refresh its values
here:
-                            String userId = getRdn( memberAssign );
-                            Group newGroup = groupMgr.assign( group, userId );
-                            group.setMembers( newGroup.getMembers() );
-
-                            String msg = "Group: " + group.getName() + ", member: " + memberAssign
-                                + ", has been assigned";
-                            memberAssign = "";
-                            form.add( memberAssignTF );
-                            addMemberTable( group );
-                            display.setMessage( msg );
-                            log.debug( msg );
+                            String userId = getUserId( memberAssign );
+                            if( userId != null )
+                            {
+                                Group newGroup = groupMgr.assign( group, userId );
+                                group.setMembers( newGroup.getMembers() );
+
+                                String msg = "Group: " + group.getName() + ", member: " +
memberAssign
+                                    + ", has been assigned";
+                                memberAssign = "";
+                                form.add( memberAssignTF );
+                                addMemberTable( group );
+                                display.setMessage( msg );
+                                log.debug( msg );
+                            }
                         }
                         catch ( org.apache.directory.fortress.core.SecurityException se )
                         {
@@ -574,12 +579,80 @@ public class GroupDetailPanel extends FormComponentPanel
                     attributes.getAjaxCallListeners().add( ajaxCallListener );
                 }
             } );
+
+            add( new SecureIndicatingAjaxButton( "member.deassign", GlobalIds.GROUP_MGR,
"deassign" )
+            {
+                private static final long serialVersionUID = 1L;
+
+
+                @Override
+                protected void onSubmit( AjaxRequestTarget target, Form<?> form )
+                {
+                    Group group = ( Group ) form.getModel().getObject();
+                    if ( VUtil.isNotNullOrEmpty( memberAssign ) )
+                    {
+                        try
+                        {
+                            // TODO: figure out how to get the table to refresh its values
here:
+                            String userId = getUserId( memberAssign );
+                            if( userId != null )
+                            {
+                                Group newGroup = groupMgr.deassign( group, userId );
+                                group.setMembers( newGroup.getMembers() );
+
+                                String msg = "Group: " + group.getName() + ", member: " +
memberAssign
+                                    + ", has been deassigned";
+                                memberAssign = "";
+                                form.add( memberAssignTF );
+                                addMemberTable( group );
+                                display.setMessage( msg );
+                                log.debug( msg );
+                            }
+                        }
+                        catch ( org.apache.directory.fortress.core.SecurityException se )
+                        {
+                            String error = "Failed assign user: " + memberAssign + ", SecurityException="
+ se;
+                            log.warn( error );
+                            display.setMessage( error );
+                        }
+                    }
+                    else
+                    {
+                        String msg = "Group: " + group.getName()
+                            + ", assign op ignored, no value entered for deassignment";
+                        display.setMessage( msg );
+                        log.debug( msg );
+                    }
+                    component = editForm;
+                }
+
+
+                @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 );
+                }
+            } );
         }
 
 
         private void clearDetailFields( String msg, AjaxRequestTarget target, Form form )
         {
             setModelObject( new Group() );
+            memberAssign = "";
             memberPropsCB = new ComboBox<String>( "memberProps", new PropertyModel<String>(
form,
                 "memberPropsSelection" ), new ArrayList<String>() );
             editForm.addOrReplace( memberPropsCB );
@@ -619,8 +692,17 @@ public class GroupDetailPanel extends FormComponentPanel
             ListDataProvider<Member> results;
             if ( VUtil.isNotNullOrEmpty( members ) )
             {
+                Collections.sort( members, new Comparator<String>()
+                {
+                    @Override
+                    public int compare(String m1, String m2)
+                    {
+                        return m1.compareToIgnoreCase( m2 );
+                    }
+                } );
+
                 int ctr = 0;
-                List<Member> tableMembers = new ArrayList<Member>();
+                List<Member> tableMembers = new ArrayList<>();
                 for ( String member : members )
                 {
                     Member tableMember = new Member();
@@ -755,7 +837,6 @@ public class GroupDetailPanel extends FormComponentPanel
                 /** Default serialVersionUID */
                 private static final long serialVersionUID = 1L;
 
-
                 /**
                  * Triggered when a column button is clicked.
                  */
@@ -767,13 +848,16 @@ public class GroupDetailPanel extends FormComponentPanel
                         try
                         {
                             // TODO: figure out how to get the table to refresh its values
here:
-                            String userId = getRdn( value );
-                            Group newGroup = groupMgr.deassign( group, userId );
-                            group.setMembers( newGroup.getMembers() );
-                            table.refresh( target );
-                            String msg = "User: " + userId + ", deassigned from group: "
+ group.getName();
-                            display.setMessage( msg );
-                            log.debug( msg );
+                            String userId = getUserId( value );
+                            if( userId != null )
+                            {
+                                Group newGroup = groupMgr.deassign( group, userId );
+                                group.setMembers( newGroup.getMembers() );
+                                table.refresh( target );
+                                String msg = "User: " + userId + ", deassigned from group:
" + group.getName();
+                                display.setMessage( msg );
+                                log.debug( msg );
+                            }
                         }
                         catch ( org.apache.directory.fortress.core.SecurityException se )
                         {
@@ -789,31 +873,33 @@ public class GroupDetailPanel extends FormComponentPanel
         }
 
         /**
-         * Method will retrieve the relative distinguished name from a distinguished name
variable.
+         * Method will retrieve the userId from a distinguished name variable.
          *
          * @param szDn contains ldap distinguished name.
-         * @return rDn as string.
+         * @return userId as string.
          */
-        private String getRdn( String szDn )
+        private String getUserId(String szDn)
         {
-            String szRdn = null;
+            String szUserId = null;
             try
             {
                 Dn dn = new Dn( szDn );
                 Rdn rDn = dn.getRdn();
-                szRdn = rDn.getName();
+                String szRdn = rDn.getName();
+                int indexEquals = szRdn.indexOf( '=' ) + 1;
+                if (indexEquals != -1)
+                    szUserId = szRdn.substring( indexEquals );
             }
             catch ( LdapInvalidDnException e )
             {
-                String error = "GlobalUtils.getRdn dn: " + szDn + ", caught LdapInvalidDnException:"
+ e;
-                throw new RuntimeException( error );
-
+                String error = "User DN: " + szDn + ", incorrect format: " + e;
+                log.warn( error );
+                display.setMessage( error );
             }
-            return szRdn;
+            return szUserId;
         }
 
 
-
         public String getMemberAssign()
         {
             return memberAssign;

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java b/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
index b41438a..ec79c74 100644
--- a/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
+++ b/src/main/java/org/apache/directory/fortress/web/panel/GroupListPanel.java
@@ -259,17 +259,19 @@ public class GroupListPanel extends FormComponentPanel
 
         PropertyColumn groupName = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode,
String, String>(
             Model.of( "Group Name" ), "userObject.Name" );
-        groupName.setInitialSize( 400 );
+        groupName.setInitialSize( 250 );
         columns.add( groupName );
 
         PropertyColumn description = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode,
String, String>(
             Model.of( "Description" ), "userObject.Description" );
-        description.setInitialSize( 400 );
+        description.setInitialSize( 300 );
         columns.add( description );
 
+/*
         PropertyColumn protocol = new PropertyColumn( new Model( "Protocol" ), "userObject.Protocol"
);
         protocol.setInitialSize( 400 );
         columns.add( protocol );
+*/
 
         List<Group> groups = ( List<Group> ) getDefaultModel().getObject();
         treeModel = createTreeModel( groups );

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/resources/FortressWebDemoUsers.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/FortressWebDemoUsers.xml b/src/main/resources/FortressWebDemoUsers.xml
index 037ca0f..b86b7dc 100644
--- a/src/main/resources/FortressWebDemoUsers.xml
+++ b/src/main/resources/FortressWebDemoUsers.xml
@@ -133,6 +133,7 @@
                 <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"/>
+                <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"/>

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
b/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
index 5bd2b16..dfc1a6b 100644
--- a/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
+++ b/src/main/resources/org/apache/directory/fortress/web/FortressWebBasePage.html
@@ -27,6 +27,10 @@
     <link rel="stylesheet" type="text/css" href="css/ui-lightness/jquery-ui-1.10.2.custom.min.css"
media="all"/>
     <link rel="stylesheet" type="text/css" href="css/kendo/kendo.common.min.css" media="all"/>
     <link rel="stylesheet" type="text/css" href="css/kendo/kendo.default.min.css" media="all"/>
+<!--
+    <link rel="stylesheet" type="text/css" href="css/kendo/kendo.ui.core.min.css" media="all"/>
+    <link rel="stylesheet" type="text/css" href="css/kendo/kendo.ui.core.css" media="all"/>
+-->
     <link rel="stylesheet" type="text/css" href="css/splitter-style.css" media="all"/>
 
     <style type="text/css">

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
b/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
index 0ad1863..da1f5ae 100644
--- a/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
+++ b/src/main/resources/org/apache/directory/fortress/web/panel/GroupDetailPanel.html
@@ -87,6 +87,9 @@
                         <input type="button" class="ui-button ui-widget ui-state-default
ui-corner-all ui-button-text-only"
                                wicket:id="member.assign" name="member.assign" value="assign"/>
 
+                        <input type="button" class="ui-button ui-widget ui-state-default
ui-corner-all ui-button-text-only"
+                               wicket:id="member.deassign" name="member.deassign" value="deassign"/>
+
                         <div wicket:id="membersmodal"></div>
                     </td>
                 </tr>

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/157183ac/src/main/resources/org/apache/directory/fortress/web/panel/UserSearchModalPanel.html
----------------------------------------------------------------------
diff --git a/src/main/resources/org/apache/directory/fortress/web/panel/UserSearchModalPanel.html
b/src/main/resources/org/apache/directory/fortress/web/panel/UserSearchModalPanel.html
index 41bd5a6..acdf71d 100644
--- a/src/main/resources/org/apache/directory/fortress/web/panel/UserSearchModalPanel.html
+++ b/src/main/resources/org/apache/directory/fortress/web/panel/UserSearchModalPanel.html
@@ -25,13 +25,12 @@
                 <thead>
                 <tr>
                     <th>Select</th>
+                    <th>Photo</th>
                     <th>User ID</th>
-                    <th>Description</th>
                     <th>Name</th>
-                    <th>Organization</th>
                     <th>Title</th>
-                    <th>Photo</th>
-
+                    <th>Description</th>
+                    <th>Organization</th>
                 </tr>
                 </thead>
                 <tbody>


Mime
View raw message