]> source.dussan.org Git - archiva.git/commitdiff
map property ldap.config.groups.use.rolename in archiva configuration
authorOlivier Lamy <olamy@apache.org>
Tue, 12 Feb 2013 20:38:31 +0000 (20:38 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 12 Feb 2013 20:38:31 +0000 (20:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445346 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 cabb59331baef3f1005b98d05142d1d2ed43aa93..6c0516661f1453fde6652646ac0c221ef921bb00 100644 (file)
           <type>boolean</type>
           <defaultValue>false</defaultValue>
         </field>
+        <field>
+          <name>useRoleNameAsGroup</name>
+          <description>Will use role name as LDAP group.</description>
+          <version>1.4.0+</version>
+          <type>boolean</type>
+          <defaultValue>false</defaultValue>
+        </field>
         <field>
           <name>extraProperties</name>
           <version>1.4.0+</version>
index 25d391554c2bf4a3a014388b37d87e412bc4d797..09c7eb5fceeff76114b8ed8f0ca8b8b65095f235 100644 (file)
@@ -85,6 +85,11 @@ public class LdapConfiguration
      */
     private boolean bindAuthenticatorEnabled;
 
+    /**
+     * Will use role name as LDAP group.
+     */
+    private boolean useRoleNameAsGroup = false;
+
     /**
      * Field extraProperties.
      */
@@ -246,4 +251,14 @@ public class LdapConfiguration
     {
         this.writable = writable;
     }
+
+    public boolean isUseRoleNameAsGroup()
+    {
+        return useRoleNameAsGroup;
+    }
+
+    public void setUseRoleNameAsGroup( boolean useRoleNameAsGroup )
+    {
+        this.useRoleNameAsGroup = useRoleNameAsGroup;
+    }
 }
index 1ffc45ee7a334d18f4fb736970f1a4d023a0c162..98858c1b39d48c7c555a4a5196c6512585c2b640 100644 (file)
@@ -135,6 +135,9 @@ public class DefaultRedbackRuntimeConfigurationAdmin
                 ldapConfiguration.setWritable(
                     userConfiguration.getBoolean( UserConfigurationKeys.LDAP_WRITABLE, false ) );
 
+                ldapConfiguration.setUseRoleNameAsGroup(
+                    userConfiguration.getBoolean( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME, false ) );
+
                 redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
 
                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
@@ -452,6 +455,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
             return conf.getLdapConfiguration().isWritable();
         }
 
+        if ( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME.equals( key ) )
+        {
+            return conf.getLdapConfiguration().isUseRoleNameAsGroup();
+        }
+
         if ( conf.getConfigurationProperties().containsKey( key ) )
         {
             return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
@@ -485,6 +493,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
             return getRedbackRuntimeConfiguration().getLdapConfiguration().isWritable();
         }
 
+        if ( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME.equals( key ) )
+        {
+            return getRedbackRuntimeConfiguration().getLdapConfiguration().isUseRoleNameAsGroup();
+        }
+
         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
 
         if ( conf.getConfigurationProperties().containsKey( key ) )
index 153f737df0ede46887604e89a4b38e74bb708a89..3169849956d0479c0110064680391613362c6a6a 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,writable){
+                             extraPropertiesEntries,writable,useRoleNameAsGroup){
 
     var self=this;
     this.modified=ko.observable(false);
@@ -1338,6 +1338,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
     this.writable=ko.observable(writable);
     this.writable.subscribe(function(newValue){self.modified(true)});
 
+    // useRoleNameAsGroup
+    this.useRoleNameAsGroup=ko.observable(useRoleNameAsGroup);
+    this.useRoleNameAsGroup.subscribe(function(newValue){self.modified(true)});
+
   }
 
   mapLdapConfiguration=function(data){
@@ -1351,7 +1355,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.writable);
+                                    data.authenticationMethod,extraPropertiesEntries,data.writable,data.useRoleNameAsGroup);
       }
       return null;
   }
index 99abc49b7b4cbf341d2be300a981803b573dc6e3..680ca8cfedecb914b21825688e67d86656693ca8 100644 (file)
                        data-bind="checked: redbackRuntimeConfiguration().ldapConfiguration().ssl"/>
               </div>
             </div>
+            <div class="control-group">
+              <label for="ldap-useRoleNameAsGroup" class="control-label">
+                ${$.i18n.prop('redback.runtime.ldap.useRoleNameAsGroup.label')}
+              </label>
+              <div class="controls">
+                <input type="checkbox" id="ldap-useRoleNameAsGroup" name="ldap-useRoleNameAsGroup"
+                       data-bind="checked: redbackRuntimeConfiguration().ldapConfiguration().useRoleNameAsGroup"/>
+              </div>
+            </div>
+
             <div class="control-group">
               <label for="ldapPassword" class="control-label">
                 ${$.i18n.prop('redback.runtime.ldap.password.label')}