plugins/kolab_auth plugins/kolab_delegation

Aleksander Machniak machniak at kolabsys.com
Mon Aug 18 18:24:13 CEST 2014


 plugins/kolab_auth/kolab_auth_ldap.php               |   17 ++++++++++++++++-
 plugins/kolab_delegation/kolab_delegation_engine.php |    3 ++-
 2 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit e4100366b5bf28d28015d883d4c50f03bf1bc529
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Mon Aug 18 08:29:29 2014 -0400

    Fix delegatee deletion if configured field name equals attribute name
    Fix so delegate field name might be omitted in kolab_auth plugin config (#3400)

diff --git a/plugins/kolab_auth/kolab_auth_ldap.php b/plugins/kolab_auth/kolab_auth_ldap.php
index 117db8c..303bbf3 100644
--- a/plugins/kolab_auth/kolab_auth_ldap.php
+++ b/plugins/kolab_auth/kolab_auth_ldap.php
@@ -202,7 +202,9 @@ class kolab_auth_ldap extends rcube_ldap_generic
         foreach ($this->fieldmap as $field => $attr) {
             if (array_key_exists($field, $entry)) {
                 $entry[$attr] = $entry[$field];
-                unset($entry[$field]);
+                if ($attr != $field) {
+                    unset($entry[$field]);
+                }
             }
         }
 
@@ -509,6 +511,19 @@ class kolab_auth_ldap extends rcube_ldap_generic
     }
 
     /**
+     * Register additional fields
+     */
+    public function extend_fieldmap($map)
+    {
+        foreach ((array)$map as $name => $attr) {
+            if (!in_array($attr, $this->attributes)) {
+                $this->attributes[]    = $attr;
+                $this->fieldmap[$name] = $attr;
+            }
+        }
+    }
+
+    /**
      * HTML-safe DN string encoding
      *
      * @param string $str DN string
diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php b/plugins/kolab_delegation/kolab_delegation_engine.php
index cb906d9..e346b10 100644
--- a/plugins/kolab_delegation/kolab_delegation_engine.php
+++ b/plugins/kolab_delegation/kolab_delegation_engine.php
@@ -240,6 +240,7 @@ class kolab_delegation_engine
         $this->ldap_org_field = $this->rc->config->get('kolab_auth_organization');
 
         $ldap->set_filter($this->ldap_filter);
+        $ldap->extend_fieldmap(array($this->ldap_delegate_field => $this->ldap_delegate_field));
 
         return $ldap;
     }
@@ -533,7 +534,7 @@ class kolab_delegation_engine
             }
 
             // Get current user record
-            $this->cache['user'] = $ldap->get_record($this->ldap_dn, true);
+            $this->cache['user'] = $ldap->get_record($this->ldap_dn);
         }
 
         return $parsed ? $this->parse_ldap_record($this->cache['user']) : $this->cache['user'];




More information about the commits mailing list