summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-31 11:10:06 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-31 11:10:06 +0200
commit4884ed6a5424034daff81dad0b09234a7303baed (patch)
tree3fceeb2f10e365ff08b530a5602fc624b9ec9b6d
parenta228de1f80379cc29b58bf2673fd4e3d56e953cd (diff)
downloadwebadmin-4884ed6a5424034daff81dad0b09234a7303baed.tar.gz
Rename function user_attributes to get_attributes so it can sensibly be used for users, groups and other objects
Make sure the values in ldap modifications arrays are arrays
-rw-r--r--lib/Auth.php10
-rw-r--r--lib/Auth/LDAP.php26
-rw-r--r--lib/api/kolab_api_service_group.php4
-rw-r--r--lib/api/kolab_api_service_user.php2
4 files changed, 21 insertions, 21 deletions
diff --git a/lib/Auth.php b/lib/Auth.php
index 936a8db..b72b7bc 100644
--- a/lib/Auth.php
+++ b/lib/Auth.php
@@ -176,6 +176,11 @@ class Auth {
return $this->_auth[$_SESSION['user']->get_domain()]->get_attribute($subject, $attribute);
}
+ public function get_attributes($subject, $attributes)
+ {
+ return $this->_auth[$_SESSION['user']->get_domain()]->get_attributes($subject, $attributes);
+ }
+
public function group_add($attributes, $type=NULL)
{
return $this->_auth[$_SESSION['user']->get_domain()]->group_add($attributes, $type);
@@ -288,11 +293,6 @@ class Auth {
return $this->_auth[$_SESSION['user']->get_domain()]->user_find_by_attribute($attribute);
}
- public function user_attributes($user, $attributes)
- {
- return $this->_auth[$_SESSION['user']->get_domain()]->user_attributes($user, $attributes);
- }
-
public function user_info($userdata)
{
return $this->_auth[$_SESSION['user']->get_domain()]->user_info($userdata);
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 1801328..a75323d 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -249,6 +249,19 @@ class LDAP
console($result);
}
+ public function get_attributes($subject_dn, $attributes)
+ {
+ $result = $this->search($subject_dn, '(objectclass=*)', $attributes);
+ $result = self::normalize_result($result);
+
+ if (!empty($result)) {
+ $result = array_pop($result);
+ return $result;
+ }
+
+ return false;
+ }
+
public function group_find_by_attribute($attribute)
{
if (empty($attribute) || !is_array($attribute) || count($attribute) > 1) {
@@ -455,19 +468,6 @@ class LDAP
*
*
*/
- public function user_attributes($user_dn, $attributes)
- {
- $result = $this->search($user_dn, '(objectclass=*)', $attributes);
- $result = self::normalize_result($result);
-
- if (!empty($result)) {
- $result = array_pop($result);
- return $result;
- }
-
- return false;
- }
-
public function user_info($user)
{
$is_dn = ldap_explode_dn($user, 1);
diff --git a/lib/api/kolab_api_service_group.php b/lib/api/kolab_api_service_group.php
index 329521e..d2103fa 100644
--- a/lib/api/kolab_api_service_group.php
+++ b/lib/api/kolab_api_service_group.php
@@ -199,7 +199,7 @@ class kolab_api_service_group extends kolab_api_service
if (array_key_exists($_group_attr, $group_attributes)) {
if (!($group_attributes[$_group_attr] === $_group_value)) {
console("Attribute $_group_attr changed from", $_group_value, "to", $group_attributes[$_group_attr]);
- $mod_array['replace'][$_group_attr] = $_group_value;
+ $mod_array['replace'][$_group_attr] = (array)($_group_value);
}
} else {
// TODO: Since we're not shipping the entire object back and forth, and only post
@@ -281,7 +281,7 @@ class kolab_api_service_group extends kolab_api_service
}
if (!empty($attrs)) {
- $attrs = $auth->user_attributes($result['entrydn'], $attrs);
+ $attrs = $auth->get_attributes($result['entrydn'], $attrs);
if (!empty($attrs)) {
$result = array_merge($result, $attrs);
}
diff --git a/lib/api/kolab_api_service_user.php b/lib/api/kolab_api_service_user.php
index 111456e..5810732 100644
--- a/lib/api/kolab_api_service_user.php
+++ b/lib/api/kolab_api_service_user.php
@@ -182,7 +182,7 @@ class kolab_api_service_user extends kolab_api_service
}
if (!empty($attrs)) {
- $attrs = $auth->user_attributes($result['entrydn'], $attrs);
+ $attrs = $auth->get_attributes($result['entrydn'], $attrs);
if (!empty($attrs)) {
$result = array_merge($result, $attrs);
}