]> source.dussan.org Git - archiva.git/commitdiff
ldap writable save in archiva configuration
authorOlivier Lamy <olamy@apache.org>
Tue, 12 Feb 2013 17:11:15 +0000 (17:11 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 12 Feb 2013 17:11:15 +0000 (17:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445271 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/LdapConfiguration.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/general-admin.html

index 49a858bc212ced7522b2ad6496a19ffcd81ba011..b1257abb11625f2ab43d6d07ff58c7fb3a94c135 100644 (file)
           <version>1.4.0+</version>
           <type>boolean</type>
         </field>
+        <field>
+          <name>writable</name>
+          <description>LDAP writable.</description>
+          <version>1.4.0+</version>
+          <type>boolean</type>
+        </field>
         <field>
           <name>extraProperties</name>
           <version>1.4.0+</version>
index eba93395d96c26e5af64f23b331bfba64e12b787..25d391554c2bf4a3a014388b37d87e412bc4d797 100644 (file)
@@ -95,6 +95,11 @@ public class LdapConfiguration
      */
     private List<PropertyEntry> extraPropertiesEntries;
 
+    /**
+     * LDAP writable.
+     */
+    private boolean writable = false;
+
     public LdapConfiguration()
     {
         // no op
@@ -231,4 +236,14 @@ public class LdapConfiguration
     {
         this.baseGroupsDn = baseGroupsDn;
     }
+
+    public boolean isWritable()
+    {
+        return writable;
+    }
+
+    public void setWritable( boolean writable )
+    {
+        this.writable = writable;
+    }
 }
index ebb117e064c506d1e5596df5c4c339a2d4f72103..1ffc45ee7a334d18f4fb736970f1a4d023a0c162 100644 (file)
@@ -132,6 +132,9 @@ public class DefaultRedbackRuntimeConfigurationAdmin
                 ldapConfiguration.setAuthenticationMethod(
                     userConfiguration.getString( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD, null ) );
 
+                ldapConfiguration.setWritable(
+                    userConfiguration.getBoolean( UserConfigurationKeys.LDAP_WRITABLE, false ) );
+
                 redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
 
                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
@@ -444,6 +447,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
     {
         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
 
+        if ( UserConfigurationKeys.LDAP_WRITABLE.equals( key ) )
+        {
+            return conf.getLdapConfiguration().isWritable();
+        }
+
         if ( conf.getConfigurationProperties().containsKey( key ) )
         {
             return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
@@ -472,6 +480,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
             return getRedbackRuntimeConfiguration().getLdapConfiguration().isSsl();
         }
 
+        if ( UserConfigurationKeys.LDAP_WRITABLE.equals( key ) )
+        {
+            return getRedbackRuntimeConfiguration().getLdapConfiguration().isWritable();
+        }
+
         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
 
         if ( conf.getConfigurationProperties().containsKey( key ) )
index b327ce22dd0dedc1773545d48b7089de4fbb92f1..b2e59166edb9284a29b6cdff24dfa47330873105 100644 (file)
@@ -1290,7 +1290,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
   }
 
   LdapConfiguration=function(hostName,port,ssl,baseDn,baseGroupsDn,contextFactory,bindDn,password,authenticationMethod,
-                             extraPropertiesEntries){
+                             extraPropertiesEntries,writable){
 
     var self=this;
     this.modified=ko.observable(false);
@@ -1333,6 +1333,11 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
 
     this.extraPropertiesEntries=ko.observableArray(extraPropertiesEntries);
     this.extraPropertiesEntries.subscribe(function(newValue){self.modified(true)});
+
+    //private boolean writable = false;
+    this.writable=ko.observable(writable);
+    this.writable.subscribe(function(newValue){self.modified(true)});
+
   }
 
   mapLdapConfiguration=function(data){
@@ -1346,7 +1351,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
         }
         $.log("mapLdapConfiguration done");
         return new LdapConfiguration(data.hostName,data.port,data.ssl,data.baseDn,data.baseGroupsDn,data.contextFactory,data.bindDn,data.password,
-                                    data.authenticationMethod,extraPropertiesEntries);
+                                    data.authenticationMethod,extraPropertiesEntries,data.writable);
       }
       return null;
   }
index ade1b20d9dd9112b9fab60c5685d219a44f32779..af6d25d8814509a063c8bdedde852efcc03f6138 100644 (file)
                        data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().port"/>
               </div>
             </div>
+            <div class="control-group">
+              <label for="ldap-writable" class="control-label">
+                ${$.i18n.prop('redback.runtime.ldap.writable.label')}
+              </label>
+              <div class="controls">
+                <input type="checkbox" id="ldap-writable" name="ldap-ssl"
+                       data-bind="checked: redbackRuntimeConfiguration().ldapConfiguration().writable"/>
+              </div>
+            </div>
             <div class="control-group">
               <label for="ldapBaseDn" class="control-label">
                 ${$.i18n.prop('redback.runtime.ldap.baseDn.label')}