2 commits - lib/api lib/kolab_api_service.php

Aleksander Machniak machniak at kolabsys.com
Mon Oct 22 11:38:19 CEST 2012


 lib/api/kolab_api_service_domain.php |    8 +++-----
 lib/api/kolab_api_service_role.php   |    6 +++++-
 lib/kolab_api_service.php            |    5 -----
 3 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 8e51264407f4e89b2cee325e98f12ee6eb0436f8
Author: Aleksander Machniak <alec at alec.pl>
Date:   Mon Oct 22 11:38:00 2012 +0200

    Fix warning on role.effective_rights

diff --git a/lib/api/kolab_api_service_domain.php b/lib/api/kolab_api_service_domain.php
index 89064e0..636c230 100644
--- a/lib/api/kolab_api_service_domain.php
+++ b/lib/api/kolab_api_service_domain.php
@@ -152,15 +152,13 @@ class kolab_api_service_domain extends kolab_api_service
 
             $unique_attr = $conf->get('ldap', 'unique_attribute');
 
-            $domain = $auth->domain_find_by_attribute(
-                    array($unique_attr => $entry_dn)
-                );
+            $domain = $auth->domain_find_by_attribute(array($unique_attr => $entry_dn));
 
             if (!empty($domain)) {
                 $entry_dn = key($domain);
             }
-
-        } else {
+        }
+        else {
             $conf = Conf::get_instance();
             $entry_dn = $conf->get('ldap', 'domain_base_dn');
         }
diff --git a/lib/api/kolab_api_service_role.php b/lib/api/kolab_api_service_role.php
index 0deecf9..18ebf19 100644
--- a/lib/api/kolab_api_service_role.php
+++ b/lib/api/kolab_api_service_role.php
@@ -146,7 +146,11 @@ class kolab_api_service_role extends kolab_api_service
                 $unique_attr = 'nsuniqueid';
             }
 
-            $role_dn = $auth->role_find_by_attribute(Array($unique_attr => $getdata['role']));
+            $role = $auth->role_find_by_attribute(Array($unique_attr => $getdata['role']));
+
+            if (is_array($role) && count($role) == 1) {
+                $role_dn = key($role);
+            }
         }
 
         $effective_rights = $auth->list_rights(empty($role_dn) ? 'role' : $role_dn);


commit b6e5f325671cde2712dc449b744c72ab46a98282
Author: Aleksander Machniak <alec at alec.pl>
Date:   Mon Oct 22 11:28:36 2012 +0200

    Remove redundant code

diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index c45f811..e2ba761 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -194,11 +194,6 @@ abstract class kolab_api_service
             }
         }
 
-        $unique_attr = $conf->get('unique_attribute');
-        if (!$unique_attr) {
-            $unique_attr = 'nsuniqueid';
-        }
-
         $sql_result   = $this->db->query("SELECT * FROM {$object_name}_types ORDER BY name");
         $object_types = array();
 





More information about the commits mailing list