summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-05 15:24:52 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-05 15:24:52 +0200
commit0a4930ca58f121280c7a2e5ba29335ee55b3ceaf (patch)
tree770c73653b31590a4d496632c6049ed4aa2c60f4
parent5bf0cdfd5ed71cba0fec904e8f5f971490c9706a (diff)
downloadwebadmin-0a4930ca58f121280c7a2e5ba29335ee55b3ceaf.tar.gz
Fix scoring more narrow, subtle differences between user types
-rw-r--r--lib/kolab_api_service.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index 670aaaf..980932b 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -118,7 +118,7 @@ abstract class kolab_api_service
$type_score = null;
$type_id = null;
- Log::trace("kolab_api_service::object_type_id objectClasses: " . implode(", ", $object_class));
+ Log::trace("kolab_api_service::object_type_id objectclasses: " . implode(", ", $object_class));
foreach ($object_types as $idx => $elem) {
$ref_class = $elem['attributes']['fields']['objectclass'];
@@ -161,6 +161,11 @@ abstract class kolab_api_service
continue;
}
+ if (!array_key_exists($attr, $attributes)) {
+ // There's no point in comparing NULL with anything.
+ continue;
+ }
+
$v = $attributes[$attr];
if (is_array($value)) {
@@ -173,7 +178,7 @@ abstract class kolab_api_service
}
$value = implode('', $value);
- } else {
+ } else if (is_string($value)) {
$value = $this->conf->expand($_value, $custom = Array('base_dn' => $this->base_dn()));
}
@@ -181,7 +186,11 @@ abstract class kolab_api_service
$v = implode('', $v);
}
- $elem_values_score += intval($v == $value);
+ if ($v == $value) {
+ $elem_values_score += 1;
+ } else {
+ $elem_values_score -= 1;
+ }
}
// Position in tree score