11 commits - lib/api lib/Auth lib/client lib/kolab_client_output.php lib/kolab_client_task.php lib/locale public_html/js

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed Apr 4 19:31:40 CEST 2012


 lib/Auth/LDAP.php                        |   17 ++++--
 lib/api/kolab_api_service_form_value.php |   87 ++++++++++++++++++++++++++-----
 lib/client/kolab_client_task_user.php    |   42 +++++++++-----
 lib/kolab_client_output.php              |   15 +++++
 lib/kolab_client_task.php                |   37 +++++++++++--
 lib/locale/en_US.php                     |    8 ++
 public_html/js/kolab_admin.js            |    2 
 7 files changed, 168 insertions(+), 40 deletions(-)

New commits:
commit b6651941eb639d95623b59ec815b232559f33b35
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 19:31:05 2012 +0200

    Do not mark auto-generated fields as disabled or its values won't be submitted and the result is an attempt to delete the values from LDAP... :/

diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 1a516a5..8dc2f34 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1087,11 +1087,15 @@ class kolab_client_task
 
                     // Other fields are generated by policy, and should therefore not be editable.
                     if (array_key_exists($field['name'], $auto_fields)) {
-                        if (!array_key_exists('disabled', $field) || !$field['disabled']) {
-                            //console("overriding disabled state on " . $field['name'] . ", as the field contains an automatically generated value");
+/*
+                        // Not sure what to do here - if it's not disabled but an auto-generated
+                        // field... perhaps we need to mark it as read-only or optional
+                        if (array_key_exists('disabled', $field) && !$field['disabled']) {
+                            console("overriding disabled state on " . $field['name'] . ", as the field contains an automatically generated value");
                             $field['disabled'] = true;
                         }
-                        if (!array_key_exists('readonly', $field) || !$field['readonly']) {
+*/
+                        if (array_key_exists('readonly', $field) && !$field['readonly']) {
                             //console("overriding readonly state on " . $field['name'] . ", as the field contains an automatically generated value");
                             $field['readonly'] = true;
                         }


commit fbe6a51702c85ad95a1394e52a569c7c1105ac1c
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 19:30:45 2012 +0200

    Group sensible attributes together

diff --git a/lib/client/kolab_client_task_user.php b/lib/client/kolab_client_task_user.php
index 66d4e7b..c66cb8b 100644
--- a/lib/client/kolab_client_task_user.php
+++ b/lib/client/kolab_client_task_user.php
@@ -204,43 +204,53 @@ class kolab_client_task_user extends kolab_client_task
         $fields_map = array(
             'type_id'                   => 'personal',
             'type_id_name'              => 'personal',
+
+            /* Sensibly first */
+            'title'                     => 'personal',
+            /* Probably input */
             'givenname'                 => 'personal',
             'sn'                        => 'personal',
-            'displayname'               => 'personal',
-            'cn'                        => 'personal',
+            /* Possibly input */
             'initials'                  => 'personal',
-            'title'                     => 'personal',
             'o'                         => 'personal',
+            /* Probably generated */
+            'cn'                        => 'personal',
+            'displayname'               => 'personal',
             'ou'                        => 'personal',
             'preferredlanguage'         => 'personal',
 
-            'alias'                     => 'contact_info',
+            /* Address lines together */
+            'street'                    => 'contact_info',
+            'postofficebox'             => 'contact_info',
+            'roomnumber'                => 'contact_info',
+            'postalcode'                => 'contact_info',
+            'l'                         => 'contact_info',
             'c'                         => 'contact_info',
+            /* Probably input */
+            'mobile'                    => 'contact_info',
             'facsimiletelephonenumber'  => 'contact_info',
+            'telephonenumber'           => 'contact_info',
             'homephone'                 => 'contact_info',
-            'l'                         => 'contact_info',
+            'pager'                     => 'contact_info',
             'mail'                      => 'contact_info',
+            'alias'                     => 'contact_info',
             'mailalternateaddress'      => 'contact_info',
-            'mobile'                    => 'contact_info',
-            'pager'                     => 'contact_info',
-            'postalcode'                => 'contact_info',
-            'postofficebox'             => 'contact_info',
-            'roomnumber'                => 'contact_info',
-            'street'                    => 'contact_info',
-            'telephonenumber'           => 'contact_info',
 
+            /* POSIX Attributes first */
+            'uid'                       => 'system',
             'userpassword'              => 'system',
             'userpassword2'             => 'system',
+            'uidnumber'                 => 'system',
             'gidnumber'                 => 'system',
             'homedirectory'             => 'system',
-            'kolabhomeserver'           => 'system',
             'loginshell'                => 'system',
-            'mailhost'                  => 'system',
+
             'nsrole'                    => 'system',
             'nsroledn'                  => 'system',
-            'uid'                       => 'system',
-            'uidnumber'                 => 'system',
 
+            /* Kolab Settings */
+            'kolabhomeserver'           => 'config',
+            'mailhost'                  => 'config',
             'mailquota'                 => 'config',
             'cyrususerquota'            => 'config',
             'kolabfreebusyfuture'       => 'config',


commit 26635cb5f0252ff1aafd06a6b8b3e511f30ce905
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 19:30:33 2012 +0200

    Additional translations

diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index 97b597d..44ee0f0 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -67,6 +67,7 @@ $LANG['user.personal'] = 'Personal';
 $LANG['user.postalcode'] = 'Postal Code';
 $LANG['user.sn'] = 'Surname';
 $LANG['user.system'] = 'System';
+$LANG['user.telephonenumber'] = 'Phone Number';
 $LANG['user.givenname'] = 'Given name';
 $LANG['user.displayname'] = 'Display name';
 $LANG['user.mail'] = 'Primary Email Address';


commit 1ef9e2518ddc98e043d84a26ecaa7cebac7c4419
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 19:13:52 2012 +0200

    Revert the conditions under which a field is marked as disabled

diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 76c2fa3..5d183d9 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -754,7 +754,7 @@ function kolab_admin()
     }
 
     // add autocompletion input
-    if (autocomplete && ((!disabled && !readonly) || (!len && (disabled || readonly)))) {
+    if (!disabled && !readonly && autocomplete) {
       elem = this.form_list_element(form_element.form, {
         maxlength: maxlength,
         autocomplete: autocomplete,


commit 0d21eb9d253d14f2b4b6cdcf4cf3033a99526329
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 19:03:30 2012 +0200

    More labels

diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index ab9e9cc..97b597d 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -48,10 +48,15 @@ $LANG['user.config'] = 'Configuration';
 $LANG['user.contact'] = 'Contact';
 $LANG['user.contact_info'] = 'Contact Information';
 $LANG['user.homephone'] = 'Home Phone Number';
+$LANG['user.kolaballowsmtprecipient'] = 'Recipient(s) Access List';
+$LANG['user.kolaballowsmtpsender'] = 'Sender Access List';
+$LANG['user.kolabdelegate'] = 'Delegates';
 $LANG['user.kolabinvitationpolicy'] = 'Invitation Handling Policy';
 $LANG['user.l'] = 'City, Region';
 $LANG['user.list'] = 'Users List';
 $LANG['user.list.records'] = '$1 to $2 of $3';
+$LANG['user.mailquota'] = 'Quota';
+$LANG['user.mailquota.desc'] = 'Leave blank for unlimited';
 $LANG['user.mobile'] = 'Mobile Phone Number';
 $LANG['user.name'] = 'Name';
 $LANG['user.norecords'] = 'No user records found!';
@@ -80,8 +85,6 @@ $LANG['user.postbox'] = 'Postal box';
 $LANG['user.postcode'] = 'Postal code';
 $LANG['user.org'] = 'Organization';
 $LANG['user.orgunit'] = 'Organizational Unit';
-$LANG['user.quota'] = 'Quota';
-$LANG['user.quota.desc'] = 'Leave blank for unlimited';
 $LANG['user.fbinterval'] = 'Free-Busy interval';
 $LANG['user.fbinterval.desc'] = 'Leave blank for default (60 days)';
 $LANG['user.type_id'] = 'Account type';


commit 1d4e7b144f102445adf28d45a536e1ed81c97df5
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 19:02:05 2012 +0200

    Provide select_options_preferredlanguage from database and list_options_kolabdelegate

diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index de3151f..7d4647f 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -72,7 +72,7 @@ class kolab_api_service_form_value extends kolab_api_service
             $method_name = 'generate_' . strtolower($attr_name) . '_' . strtolower($postdata['object_type']);
 
             if (!method_exists($this, $method_name)) {
-                console("Method $method_name doesn't exist");
+                //console("Method $method_name doesn't exist");
 
                 $method_name = 'generate_' . strtolower($attr_name);
 
@@ -168,6 +168,8 @@ class kolab_api_service_form_value extends kolab_api_service
      */
     public function list_options($getdata, $postdata)
     {
+        //console($postdata);
+
         $attribs   = $this->object_type_attributes($postdata['object_type'], $postdata['type_id']);
         $attr_name = $postdata['attribute'];
         $result    = array(
@@ -182,10 +184,14 @@ class kolab_api_service_form_value extends kolab_api_service
 
         $method_name = 'list_options_' . strtolower($attr_name);
 
+        //console($method_name);
+
         if (!method_exists($this, $method_name)) {
             return $result;
         }
 
+        //console("Still here");
+
         $result['list'] = $this->{$method_name}($postdata, $attribs);
 
         return $result;
@@ -459,11 +465,13 @@ class kolab_api_service_form_value extends kolab_api_service
 
             // TODO: Use preferredlanguage
             if (isset($postdata['preferredlanguage'])) {
-                console("Using locale for " . $postdata['preferredlanguage']);
+                //console("Using locale for " . $postdata['preferredlanguage']);
                 setlocale(LC_ALL, $postdata['preferredlanguage']);
-            } else {
+            }
+/*            else {
                 console("No locale specified...!");
             }
+*/
 
             $uid = iconv('UTF-8', 'ASCII//TRANSLIT', $postdata['sn']);
             $uid = strtolower($uid);
@@ -477,7 +485,7 @@ class kolab_api_service_form_value extends kolab_api_service
             while (($user_found = $auth->user_find_by_attribute(array('uid' => $uid)))) {
                 $user_found_dn = key($user_found);
                 $user_found_unique_attr = $auth->get_attribute($user_found_dn, $unique_attr);
-                console("user that i found info", $user_found_unique_attr);
+                //console("user that i found info", $user_found_unique_attr);
                 if ($user_found_unique_attr == $postdata[$unique_attr]) {
                     break;
                 }
@@ -525,18 +533,35 @@ class kolab_api_service_form_value extends kolab_api_service
         }
     }
 
-    private function list_options_c($postdata, $attribs = array())
+    private function list_options_kolabdelegate($postdata, $attribs = array())
     {
-        return $this->_list_options_db($postdata);
-    }
+        $service = $this->controller->get_service('users');
+
+        $keyword = array('value' => $postdata['search']);
+        $data    = array(
+            'attributes' => array('displayname', 'mail'),
+            'page_size'  => 15,
+            'search'     => array(
+                'displayname' => $keyword,
+                'cn'          => $keyword,
+                'mail'        => $keyword,
+            ),
+        );
+
+        $result = $service->users_list(null, $data);
+        $list   = $result['list'];
+
+        // convert to key=>value array
+        foreach ($list as $idx => $value) {
+            $list[$idx] = $value['displayname'];
+            if (!empty($value['mail'])) {
+                $list[$idx] .= ' <' . $value['mail'] . '>';
+            }
+        }
+
+        return $list;
 
-    private function select_options_preferredlanguage($postdata, $attribs = array())
-    {
-        $db        = SQL::get_instance();
-        $query     = $db->query("SELECT option_values FROM options WHERE attribute = 'preferredlanguage'");
-        $attribute = $db->fetch_assoc($query);
 
-        return json_decode($attribute['option_values']);
     }
 
     private function list_options_nsrole($postdata, $attribs = array())
@@ -571,10 +596,6 @@ class kolab_api_service_form_value extends kolab_api_service
         return $list;
     }
 
-    private function list_options_preferredlanguage($postdata, $attribs = array())
-    {
-        return $this->_list_options_db($postdata);
-    }
 
     private function list_options_uniquemember($postdata, $attribs = array())
     {
@@ -605,19 +626,32 @@ class kolab_api_service_form_value extends kolab_api_service
         return $list;
     }
 
-    private function _list_options_from_db($postdata)
+    private function select_options_c($postdata, $attribs = array())
+    {
+        return $this->_select_options_from_db('c');
+    }
+
+    private function select_options_preferredlanguage($postdata, $attribs = array())
     {
-        if (empty($postdata['attribute'])) {
+        return $this->_select_options_from_db('preferredlanguage');
+    }
+
+    private function _select_options_from_db($attribute)
+    {
+
+        if (empty($attribute)) {
             return false;
         }
 
         $db = SQL::get_instance();
-        $result = $db->fetch_assoc($db->query("SELECT option_values FROM options WHERE attribute = ?", $postdata['attribute']));
+        $result = $db->fetch_assoc($db->query("SELECT option_values FROM options WHERE attribute = ?", $attribute));
 
-        if (empty($result['option_values'])) {
+        $result = json_decode($result['option_values']);
+
+        if (empty($result)) {
             return false;
         } else {
-            return $result['option_values'];
+            return $result;
         }
     }
 }


commit 7af4ce9cc3272b93379189bfd57383b0a4a20f29
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 18:59:57 2012 +0200

    Retrieve all attributelevel access rights
    Fix "changed" arrays that are only really different because the ordering is different

diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 3fbbd7b..2f805fd 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -309,8 +309,8 @@ class LDAP
                                 'dn:' . $_SESSION['user']->user_bind_dn // User DN
                             )
                     ) . '"',
-                '"(entrydn=' . $entry_dn . ')"'
-
+                '"(entrydn=' . $entry_dn . ')"',
+                '"*"',
             );
 
         //console("Executing command " . implode(' ', $command));
@@ -1001,7 +1001,18 @@ class LDAP
         // in the new attrs, if any.
         foreach ($old_attrs as $attr => $old_attr_value) {
             if (array_key_exists($attr, $new_attrs)) {
-                if (!($new_attrs[$attr] === $old_attr_value)) {
+                $_sort1 = false;
+                $_sort2 = false;
+                if (is_array($new_attrs[$attr])) {
+                    $_sort1 = $new_attrs[$attr];
+                    sort($_sort1);
+                }
+                if (is_array($old_attr_value)) {
+                    $_sort2 = $old_attr_value;
+                    sort($_sort2);
+                }
+
+                if (!($new_attrs[$attr] === $old_attr_value) && !($_sort1 === $_sort2)) {
                     console("Attribute $attr changed from", $old_attr_value, "to", $new_attrs[$attr]);
                     if ($attr === $rdn_attr) {
                         $mod_array['rename'][$subject_dn] = $rdn_attr . '=' . $new_attrs[$attr];


commit 05626ef8d495dac9bff75e6be763cd74c74b8fca
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 15:57:21 2012 +0200

    Take into consideration whether or not the field is also a field for which the value is automatically generated

diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 1f5a4b2..1a516a5 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -464,11 +464,14 @@ class kolab_client_task
 
         $capabilities = $this->capabilities();
 
+        //console($capabilities);
+
         foreach ($this->menu as $idx => $label) {
-            console("$task: $task, idx: $idx, label: $label");
+            //console("$task: $task, idx: $idx, label: $label");
 
             if (in_array($task, array('user', 'group'))) {
-                if (!in_array($task . "." . $idx, $capabilities['actions'])) {
+                if (!array_key_exists($task . "." . $idx, $capabilities['actions'])) {
+                    //console("$task.$idx not in \$capabilities['actions'], skipping", $capabilities['actions']);
                     continue;
                 }
             }
@@ -742,7 +745,10 @@ class kolab_client_task
 
         // Mark automatically generated fields as read-only, etc.
         foreach ($auto_fields as $idx => $field) {
+            //console("\$field value for \$auto_fields[\$idx] (idx: $idx)", $auto_fields[$idx]);
             if (!is_array($field)) {
+                //console("not an array... unsetting");
+
                 unset($auto_fields[$idx]);
                 continue;
             }
@@ -776,7 +782,10 @@ class kolab_client_task
                  }
             }
             else {
+                //console("\$field['data'] is empty for \$auto_fields[\$idx] (idx: $idx)");
                 $auto_attribs[] = $idx;
+                // Unset the $auto_field array key to prevent the form field from
+                // becoming disabled/readonly
                 unset($auto_fields[$idx]);
             }
         }
@@ -924,6 +933,9 @@ class kolab_client_task
         $assoc_fields = array();
         $req_fields   = array();
 
+        $auto_fields = $this->output->get_env('auto_fields');
+        //console("\$auto_fields", $auto_fields);
+
         // Parse elements and add them to the form object
         foreach ($sections as $section_idx => $section) {
             $form->add_section($section_idx, kolab_html::escape($this->translate($section)));
@@ -1000,6 +1012,7 @@ class kolab_client_task
                                 //console("overriding disabled state on " . $field['name']);
                                 $field['disabled'] = false;
                             }
+
                             if (array_key_exists('readonly', $field) && $field['readonly']) {
                                 //console("overriding readonly state on " . $field['name']);
                                 $field['readonly'] = false;
@@ -1021,7 +1034,7 @@ class kolab_client_task
                         if (!in_array('write', $effective_rights['attributeLevelRights'][$field['name']])) {
                             //console("no write permissions on " . $field['name'] . ", marking read-only");
 /*                            if (array_key_exists('disabled', $field) && !$field['disabled']) {
-                                console("overriding disabled state on " . $field['name']);
+                                //console("overriding disabled state on " . $field['name']);
                                 $field['disabled'] = true;
                             }
 */
@@ -1044,7 +1057,7 @@ class kolab_client_task
 
                     }
 
-                    // Some fields are special, such as the 'userpassword2' field
+                    // Some fields are special, such as the 'userpassword2' field.
                     switch ($field['name']) {
                         case "type_id":
                             $field['disabled'] = false;
@@ -1071,6 +1084,18 @@ class kolab_client_task
                         default:
                             break;
                     }
+
+                    // Other fields are generated by policy, and should therefore not be editable.
+                    if (array_key_exists($field['name'], $auto_fields)) {
+                        if (!array_key_exists('disabled', $field) || !$field['disabled']) {
+                            //console("overriding disabled state on " . $field['name'] . ", as the field contains an automatically generated value");
+                            $field['disabled'] = true;
+                        }
+                        if (!array_key_exists('readonly', $field) || !$field['readonly']) {
+                            //console("overriding readonly state on " . $field['name'] . ", as the field contains an automatically generated value");
+                            $field['readonly'] = true;
+                        }
+                    }
                 }
 
                 //console("after authz " . $field['name'], $field);


commit 10aa37c499371553ae8dfb53e2445454ab7722ca
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 15:09:06 2012 +0200

    Provide functions list_options_c and list_options_preferredlanguage()

diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 4bcea83..de3151f 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -525,6 +525,11 @@ class kolab_api_service_form_value extends kolab_api_service
         }
     }
 
+    private function list_options_c($postdata, $attribs = array())
+    {
+        return $this->_list_options_db($postdata);
+    }
+
     private function select_options_preferredlanguage($postdata, $attribs = array())
     {
         $db        = SQL::get_instance();
@@ -566,6 +571,11 @@ class kolab_api_service_form_value extends kolab_api_service
         return $list;
     }
 
+    private function list_options_preferredlanguage($postdata, $attribs = array())
+    {
+        return $this->_list_options_db($postdata);
+    }
+
     private function list_options_uniquemember($postdata, $attribs = array())
     {
         $service = $this->controller->get_service('users');
@@ -595,4 +605,19 @@ class kolab_api_service_form_value extends kolab_api_service
         return $list;
     }
 
+    private function _list_options_from_db($postdata)
+    {
+        if (empty($postdata['attribute'])) {
+            return false;
+        }
+
+        $db = SQL::get_instance();
+        $result = $db->fetch_assoc($db->query("SELECT option_values FROM options WHERE attribute = ?", $postdata['attribute']));
+
+        if (empty($result['option_values'])) {
+            return false;
+        } else {
+            return $result['option_values'];
+        }
+    }
 }


commit 17144726bfe00ff78f90f8e7afb05b2fcbe849b5
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 14:44:53 2012 +0200

    Re-order alphabetically

diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 7e03140..4bcea83 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -534,13 +534,19 @@ class kolab_api_service_form_value extends kolab_api_service
         return json_decode($attribute['option_values']);
     }
 
-    private function list_options_uniquemember($postdata, $attribs = array())
+    private function list_options_nsrole($postdata, $attribs = array())
     {
-        $service = $this->controller->get_service('users');
+        error_log("Listing options for attribute 'nsrole', while the expected attribute to use is 'nsroledn'");
+        return $this->list_options_nsroledn($postdata, $attribs);
+    }
+
+    private function list_options_nsroledn($postdata, $attribs = Array())
+    {
+        $service = $this->controller->get_service('roles');
 
         $keyword = array('value' => $postdata['search']);
         $data    = array(
-            'attributes' => array('displayname', 'mail'),
+            'attributes' => array('cn'),
             'page_size'  => 15,
             'search'     => array(
                 'displayname' => $keyword,
@@ -549,33 +555,24 @@ class kolab_api_service_form_value extends kolab_api_service
             ),
         );
 
-        $result = $service->users_list(null, $data);
+        $result = $service->roles_list(null, $data);
         $list   = $result['list'];
 
         // convert to key=>value array
         foreach ($list as $idx => $value) {
-            $list[$idx] = $value['displayname'];
-            if (!empty($value['mail'])) {
-                $list[$idx] .= ' <' . $value['mail'] . '>';
-            }
+            $list[$idx] = $value['cn'];
         }
 
         return $list;
     }
 
-    private function list_options_nsrole($postdata, $attribs = array())
-    {
-        error_log("Listing options for attribute 'nsrole', while the expected attribute to use is 'nsroledn'");
-        return $this->list_options_nsroledn($postdata, $attribs);
-    }
-
-    private function list_options_nsroledn($postdata, $attribs = Array())
+    private function list_options_uniquemember($postdata, $attribs = array())
     {
-        $service = $this->controller->get_service('roles');
+        $service = $this->controller->get_service('users');
 
         $keyword = array('value' => $postdata['search']);
         $data    = array(
-            'attributes' => array('cn'),
+            'attributes' => array('displayname', 'mail'),
             'page_size'  => 15,
             'search'     => array(
                 'displayname' => $keyword,
@@ -584,12 +581,15 @@ class kolab_api_service_form_value extends kolab_api_service
             ),
         );
 
-        $result = $service->roles_list(null, $data);
+        $result = $service->users_list(null, $data);
         $list   = $result['list'];
 
         // convert to key=>value array
         foreach ($list as $idx => $value) {
-            $list[$idx] = $value['cn'];
+            $list[$idx] = $value['displayname'];
+            if (!empty($value['mail'])) {
+                $list[$idx] .= ' <' . $value['mail'] . '>';
+            }
         }
 
         return $list;


commit a7ecd7f10eb6f476598c1641d72662fd77c37dc2
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Apr 4 13:37:12 2012 +0200

    Enable getting back from the environment what we have set elsewhere (workaround for some issues that should be resolved by resolving #671).

diff --git a/lib/kolab_client_output.php b/lib/kolab_client_output.php
index fe157bb..6454acf 100644
--- a/lib/kolab_client_output.php
+++ b/lib/kolab_client_output.php
@@ -188,6 +188,21 @@ class kolab_client_output
     }
 
     /**
+     * Get the value from the environment to be sent to the browser.
+     *
+     * @param string $name  Variable name
+     *
+     */
+    public function get_env($name)
+    {
+        if (empty($this->env[$name])) {
+            return null;
+        } else {
+            return $this->env[$name];
+        }
+    }
+
+    /**
      * Assigns value to browser environment.
      *
      * @param string $name  Variable name





More information about the commits mailing list