summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-11-11 12:47:46 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-11-11 12:47:46 (GMT)
commitf4fab1d3115c99a063f30befc11aadb91f4e8a45 (patch)
tree659355a3b36689090d276038abba42577a4b27cc
parentfbf4f78ca4cd8b0e04fac7b57f8f80a540c109d1 (diff)
downloadkolab-wap-f4fab1d3115c99a063f30befc11aadb91f4e8a45.tar.gz
Add list_options_ou() for form values
-rw-r--r--lib/api/kolab_api_service_form_value.php39
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 07ee351..33f0530 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -131,11 +131,12 @@ class kolab_api_service_form_value extends kolab_api_service
$method_name = 'list_options_' . strtolower($attr_name) . '_' . strtolower($postdata['object_type']);
if (!method_exists($this, $method_name)) {
- //console("Method $method_name doesn't exist");
+ Log::debug("Method $method_name doesn't exist");
$method_name = 'list_options_' . strtolower($attr_name);
if (!method_exists($this, $method_name)) {
+ Log::debug("Method $method_name doesn't exist");
return $result;
}
}
@@ -942,6 +943,42 @@ class kolab_api_service_form_value extends kolab_api_service
return $list;
}
+ private function list_options_ou($postdata, $attribs = array())
+ {
+ // return specified records only, by exact DN attributes
+ if (!empty($postdata['list'])) {
+ $data['page_size'] = count($postdata['list']);
+ $data['search'] = array(
+ 'entrydn' => array(
+ 'value' => $postdata['list'],
+ 'type' => 'exact',
+ ),
+ );
+ }
+ // return records with specified string
+ else {
+ $keyword = array('value' => $postdata['search']);
+ $data['page_size'] = 15;
+ $data['search'] = array(
+ 'entrydn' => $keyword,
+ 'description' => $keyword,
+ );
+ }
+
+ $data['attributes'] = array('ou', 'entrydn');
+
+ $service = $this->controller->get_service('ous');
+ $result = $service->ous_list(null, $data);
+ $list = $result['list'];
+
+ // convert to key=>value array
+ foreach ($list as $idx => $value) {
+ $list[$idx] = $value['entrydn'];
+ }
+
+ return $list;
+ }
+
private function list_options_owner($postdata, $attribs = array())
{
return $this->_list_options_users($postdata, $attribs);