summaryrefslogtreecommitdiffstats
path: root/lib/api
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-01-16 14:53:27 +0100
committerAleksander Machniak <alec@alec.pl>2012-01-16 14:53:27 +0100
commit1a8666af04ce60d42e05a81ad67acf9859b6e05a (patch)
tree3ab4ec5f0d2878dc26d6406bf1899aec6a52e2b7 /lib/api
parent9e069a87d6db5032e64511f4921a16f737f3bd4d (diff)
downloadwebadmin-1a8666af04ce60d42e05a81ad67acf9859b6e05a.tar.gz
- Allow setting users list attributes
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/kolab_users_actions.php51
1 files changed, 34 insertions, 17 deletions
diff --git a/lib/api/kolab_users_actions.php b/lib/api/kolab_users_actions.php
index 58bf4df..4a3262d 100644
--- a/lib/api/kolab_users_actions.php
+++ b/lib/api/kolab_users_actions.php
@@ -1,25 +1,42 @@
<?php
- /**
- *
- */
- class kolab_users_actions extends kolab_api_service
+/**
+ *
+ */
+class kolab_users_actions extends kolab_api_service
+{
+ public $list_attribs = array(
+ 'uid',
+ 'cn',
+ 'displayname',
+ 'sn',
+ 'givenname',
+ 'mail',
+ );
+
+
+ public function capabilities($domain)
{
- public function capabilities($domain)
- {
- return array(
- 'list' => 'r',
-
- );
- }
+ return array(
+ 'list' => 'r',
+ );
+ }
- public function users_list($get, $post) {
- $auth = Auth::get_instance();
- $users = $auth->list_users();
- $users = $auth->normalize_result($users);
- return $users;
+ public function users_list($get, $post)
+ {
+ $auth = Auth::get_instance();
+ if (!empty($post['attributes']) && is_array($post['attributes'])) {
+ $attributes = array_intersect($this->list_attribs, $post['attributes']);
+ }
+ if (empty($attributes)) {
+ $attributes = (array)$this->list_attribs[0];
}
+
+ $users = $auth->list_users(null, $attributes);
+ $users = $auth->normalize_result($users);
+
+ return $users;
}
-?>
+}