directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1687092 - in /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages: OptionsPage.java SecurityPage.java
Date Tue, 23 Jun 2015 16:44:43 GMT
Author: elecharny
Date: Tue Jun 23 16:44:43 2015
New Revision: 1687092

URL: http://svn.apache.org/r1687092
Log:
o Added the support for olcSecurity
o Simplified the tables update

Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java?rev=1687092&r1=1687091&r2=1687092&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
Tue Jun 23 16:44:43 2015
@@ -840,117 +840,87 @@ public class OptionsPage extends OpenLDA
 
             // Allow Feature Table Widget
             List<String> allowedFeatures = global.getOlcAllows();
+            List<AllowFeatureEnum> alloweds = new ArrayList<AllowFeatureEnum>();
 
             if ( allowedFeatures != null )
             {
-                List<AllowFeatureEnum> alloweds = new ArrayList<AllowFeatureEnum>();
-                
                 for ( String allowedFeature : allowedFeatures )
                 {
                     alloweds.add( AllowFeatureEnum.getFeature( allowedFeature ) );
                 }
-                
-                allowFeatureTableWidget.setElements( alloweds );
-            }
-            else
-            {
-                allowFeatureTableWidget.setElements( new ArrayList<AllowFeatureEnum>()
);
             }
 
+            allowFeatureTableWidget.setElements( alloweds );
+
             // Disallow Feature Table Widget
             List<String> disallowedFeatures = global.getOlcDisallows();
+            List<DisallowFeatureEnum> disalloweds = new ArrayList<DisallowFeatureEnum>();
 
             if ( disallowedFeatures != null )
             {
-                List<DisallowFeatureEnum> disalloweds = new ArrayList<DisallowFeatureEnum>();
-                
                 for ( String disallowedFeature : disallowedFeatures )
                 {
                     disalloweds.add( DisallowFeatureEnum.getFeature( disallowedFeature )
);
                 }
-                
-                disallowFeatureTableWidget.setElements( disalloweds );
-            }
-            else
-            {
-                disallowFeatureTableWidget.setElements( new ArrayList<DisallowFeatureEnum>()
);
             }
+            
+            disallowFeatureTableWidget.setElements( disalloweds );
 
             // Require Condition Table Widget
             List<String> requireConditions = global.getOlcRequires();
+            List<RequireConditionEnum> requires = new ArrayList<RequireConditionEnum>();
 
             if ( requireConditions != null )
             {
-                List<RequireConditionEnum> requires = new ArrayList<RequireConditionEnum>();
-                
                 for ( String requireCondition : requireConditions )
                 {
                     requires.add( RequireConditionEnum.getCondition( requireCondition ) );
                 }
-                
-                requireConditionTableWidget.setElements( requires );
-            }
-            else
-            {
-                requireConditionTableWidget.setElements( new ArrayList<RequireConditionEnum>()
);
             }
+            
+            requireConditionTableWidget.setElements( requires );
 
             // Restrict Operation Condition Table Widget
             List<String> restrictOperations = global.getOlcRestrict();
+            List<RestrictOperationEnum> restricts = new ArrayList<RestrictOperationEnum>();
 
             if ( restrictOperations != null )
             {
-                List<RestrictOperationEnum> restricts = new ArrayList<RestrictOperationEnum>();
-                
                 for ( String restrictOperation : restrictOperations )
                 {
                     restricts.add( RestrictOperationEnum.getOperation( restrictOperation
) );
                 }
-                
-                restrictOperationTableWidget.setElements( restricts );
-            }
-            else
-            {
-                restrictOperationTableWidget.setElements( new ArrayList<RestrictOperationEnum>()
);
             }
+            
+            restrictOperationTableWidget.setElements( restricts );
 
             // AuthID Rewrite Table Widget
             List<String> authIdRewrites = global.getOlcAuthIDRewrite();
+            List<AuthIdRewriteWrapper> rewrites = new ArrayList<AuthIdRewriteWrapper>();
 
             if ( authIdRewrites != null )
             {
-                List<AuthIdRewriteWrapper> rewrites = new ArrayList<AuthIdRewriteWrapper>();
-                
                 for ( String rewrite : authIdRewrites )
                 {
                     rewrites.add( new AuthIdRewriteWrapper( rewrite ) );
                 }
-                
-                authIdRewriteTableWidget.setElements( rewrites );
-            }
-            else
-            {
-                authIdRewriteTableWidget.setElements( new ArrayList<AuthIdRewriteWrapper>()
);
             }
+            
+            authIdRewriteTableWidget.setElements( rewrites );
 
             // Authz Regexp Table Widget
             List<String> authzRegexps = global.getOlcRestrict();
+            List<AuthzRegexpWrapper> regexps = new ArrayList<AuthzRegexpWrapper>();
 
             if ( authzRegexps != null )
             {
-                List<AuthzRegexpWrapper> regexps = new ArrayList<AuthzRegexpWrapper>();
-                
                 for ( String regexp : authzRegexps )
                 {
                     regexps.add( new AuthzRegexpWrapper( regexp ) );
                 }
-                
-                authzRegexpTableWidget.setElements( regexps );
-            }
-            else
-            {
-                authzRegexpTableWidget.setElements( new ArrayList<AuthzRegexpWrapper>()
);
             }
+            
+            authzRegexpTableWidget.setElements( regexps );
 
             // Update the ArgsFileText
             BaseWidgetUtils.setValue( global.getOlcArgsFile(), argsFileText );
@@ -991,23 +961,18 @@ public class OptionsPage extends OpenLDA
 
             // Update the RootDSEText
             List<String> rootDses = global.getOlcRootDSE();
+            List<StringValueWrapper> roots = new ArrayList<StringValueWrapper>();
 
             if ( rootDses != null )
             {
-                List<StringValueWrapper> roots = new ArrayList<StringValueWrapper>();
-                
                 for ( String rootDse : rootDses )
                 {
                     roots.add( new StringValueWrapper( rootDse, true ) );
                 }
-                
-                rootDseTableWidget.setElements( roots );
-            }
-            else
-            {
-                rootDseTableWidget.setElements( new ArrayList<StringValueWrapper>()
);
             }
             
+            rootDseTableWidget.setElements( roots );
+            
             // Update the GentleHupCheckbox
             BaseWidgetUtils.setValue( global.getOlcGentleHUP(), gentleHupCheckbox );
             

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java?rev=1687092&r1=1687091&r2=1687092&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/SecurityPage.java
Tue Jun 23 16:44:43 2015
@@ -277,6 +277,25 @@ public class SecurityPage extends OpenLD
     
     
     /**
+     * The olcSecurity listener
+     */
+    private WidgetModifyListener securityListener = new WidgetModifyListener()
+    {
+        public void widgetModified( WidgetModifyEvent e )
+        {
+            List<String> ssfWrappers = new ArrayList<String>();
+            
+            for ( SsfWrapper ssfWrapper : securityTableWidget.getElements() )
+            {
+                ssfWrappers.add( ssfWrapper.toString() );
+            }
+            
+            getConfiguration().getGlobal().setOlcSecurity( ssfWrappers );
+        }
+    };
+
+    
+    /**
      * The olcTlsCertificateFile listener
      */
     private ModifyListener tlsCertificateFileTextListener = new ModifyListener()
@@ -783,6 +802,7 @@ public class SecurityPage extends OpenLD
 
         securityTableWidget.createWidgetWithEdit( miscSectionComposite, toolkit );
         securityTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false, 4, 1 ) );
+        addModifyListener( securityTableWidget, securityListener );
     }
 
 
@@ -930,34 +950,31 @@ public class SecurityPage extends OpenLD
 
             // Password Hash Table Widget
             List<String> passwordHashes = global.getOlcPasswordHash();
+            List<PasswordHashEnum> hashes = new ArrayList<PasswordHashEnum>();
 
             if ( passwordHashes != null )
             {
-                List<PasswordHashEnum> hashes = new ArrayList<PasswordHashEnum>();
-                
                 for ( String passwordHashName : passwordHashes )
                 {
                     hashes.add( PasswordHashEnum.getPasswordHash( passwordHashName ) );
                 }
-                
-                passwordHashTableWidget.setElements( hashes );
-            }
-            else
-            {
-                passwordHashTableWidget.setElements( new ArrayList<PasswordHashEnum>()
);
             }
 
+            passwordHashTableWidget.setElements( hashes );
+
             // Security Table Widget
-            List<String> security = global.getOlcSecurity();
+            List<String> features = global.getOlcSecurity();
+            List<SsfWrapper> ssfWrappers = new ArrayList<SsfWrapper>();
 
-            if ( security != null )
+            if ( features != null )
             {
-                // TODO
-            }
-            else
-            {
-                // TODO
+                for ( String feature : features )
+                {
+                    ssfWrappers.add( new SsfWrapper( feature ) );
+                }
             }
+
+            securityTableWidget.setElements( ssfWrappers );
         }
         
         addListeners();



Mime
View raw message