[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kolab-commits
Subject:    Branch 'roundcubemail-plugins-kolab-3.1' - 2 commits - plugins/kolab_auth plugins/kolab_delegation
From:       Aleksander Machniak <machniak () kolabsys ! com>
Date:       2013-12-10 10:43:40
Message-ID: 20131210104340.817E83EF1C2 () app01 ! kolabsys ! com
[Download RAW message or body]

 plugins/kolab_auth/kolab_auth_ldap.php               |   23 +++++++++++++++----
 plugins/kolab_delegation/kolab_delegation_engine.php |    4 +--
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 3842440d05effcc48eabc50f489e1f952c382808
Author: Aleksander Machniak <machniak@kolabsys.com>
Date:   Tue Dec 10 11:41:24 2013 +0100

    Fix LDAP searches in kolab_auth_ldap::search() when fieldmap does not
    contain requested attribute mapping (Bug #2302)

diff --git a/plugins/kolab_auth/kolab_auth_ldap.php \
b/plugins/kolab_auth/kolab_auth_ldap.php index b9b3e4a..2f2ca14 100644
--- a/plugins/kolab_auth/kolab_auth_ldap.php
+++ b/plugins/kolab_auth/kolab_auth_ldap.php
@@ -207,7 +207,7 @@ class kolab_auth_ldap extends rcube_ldap_generic
     /**
      * Search records (simplified version of rcube_ldap::search)
      *
-     * @param mixed   $fields   The field name of array of field names to search in
+     * @param mixed   $fields   The field name or array of field names to search in
      * @param mixed   $value    Search value (or array of values when $fields is \
                array)
      * @param int     $mode     Matching mode:
      *                          0 - partial (*abc*),
@@ -221,6 +221,10 @@ class kolab_auth_ldap extends rcube_ldap_generic
      */
     function search($fields, $value, $mode=1, $required = array(), $limit = 0)
     {
+        if (empty($fields)) {
+            return array();
+        }
+
         $mode = intval($mode);
 
         // use AND operator for advanced searches
@@ -236,8 +240,13 @@ class kolab_auth_ldap extends rcube_ldap_generic
         }
 
         foreach ((array)$fields as $idx => $field) {
-            $val = is_array($value) ? $value[$idx] : $value;
-            if ($attrs = (array) $this->fieldmap[$field]) {
+            $val   = is_array($value) ? $value[$idx] : $value;
+            $attrs = (array) $this->fieldmap[$field];
+
+            if (empty($attrs)) {
+                $filter .= "($field=$wp" . rcube_ldap_generic::quote_string($val) . \
"$ws)"; +            }
+            else {
                 if (count($attrs) > 1)
                     $filter .= '(|';
                 foreach ($attrs as $f)
@@ -254,7 +263,13 @@ class kolab_auth_ldap extends rcube_ldap_generic
         foreach ((array)$required as $field) {
             if (in_array($field, (array)$fields))  // required field is already in \
search filter  continue;
-            if ($attrs = (array) $this->fieldmap[$field]) {
+
+            $attrs = (array) $this->fieldmap[$field];
+
+            if (empty($attrs)) {
+                $req_filter .= "($field=*)";
+            }
+            else {
                 if (count($attrs) > 1)
                     $req_filter .= '(|';
                 foreach ($attrs as $f)


commit 36d0150efc0379b7c4e3dad06c029c8bc47482c6
Author: Aleksander Machniak <machniak@kolabsys.com>
Date:   Tue Dec 10 11:41:08 2013 +0100

    Define some default config values

diff --git a/plugins/kolab_delegation/kolab_delegation_engine.php \
b/plugins/kolab_delegation/kolab_delegation_engine.php index 9ce7ad4..ef869f2 100644
--- a/plugins/kolab_delegation/kolab_delegation_engine.php
+++ b/plugins/kolab_delegation/kolab_delegation_engine.php
@@ -224,9 +224,9 @@ class kolab_delegation_engine
         }
 
         // Default filter of LDAP queries
-        $this->ldap_filter = $this->rc->config->get('kolab_delegation_filter');
+        $this->ldap_filter = $this->rc->config->get('kolab_delegation_filter', \
'(objectClass=kolabInetOrgPerson)');  // Name of the LDAP field for delegates list
-        $this->ldap_delegate_field = \
$this->rc->config->get('kolab_delegation_delegate_field'); +        \
$this->ldap_delegate_field = \
                $this->rc->config->get('kolab_delegation_delegate_field', \
                'kolabDelegate');
         // Encoded LDAP DN of current user, set on login by kolab_auth plugin
         $this->ldap_dn = $_SESSION['kolab_dn'];
 


_______________________________________________
commits mailing list
commits@lists.kolab.org
https://lists.kolab.org/mailman/listinfo/commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic