2 commits - lib/api lib/kolab_api_service.php
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Thu Jun 21 15:19:42 CEST 2012
lib/api/kolab_api_service_resources.php | 2 +-
lib/kolab_api_service.php | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
New commits:
commit 7f7fbccc120c2206d2ba6976d033a8a60d02297c
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Jun 21 12:52:17 2012 +0200
On the off-chance the object_type_id for a resource is to be determined, use additional attributes as well (#853)
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index b984d54..cbe27ba 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -107,14 +107,16 @@ abstract class kolab_api_service
* Detects object type ID for specified objectClass attribute value
*
* @param string $object_name Name of the object (user, group, etc.)
- * @param array $object_class Value of objectClass attribute
+ * @param array $attributes Array of attributes and values
*
* @return int Object type identifier
*/
- protected function object_type_id($object_name, $object_class)
+ protected function object_type_id($object_name, $attributes)
{
if ($object_name == 'domain') return 1;
+ $object_class = $attributes['objectclass'];
+
if (empty($object_class)) {
return null;
}
@@ -151,6 +153,18 @@ abstract class kolab_api_service
$type_id = $idx;
$type_score = $elem_score;
}
+
+ // On the likely chance that the object is a resource (types of which likely have the same
+ // set of objectclass attribute values), consider the other attributes. (#853)
+ if ($object_name == 'resource') {
+ //console("From database", $elem);
+ //console("Element key is " . $elem['key'] . " and \$attributes['mail'] is " . $attributes['mail']);
+
+ if (strstr($attributes['mail'], "-" . $elem['key'] . "-")) {
+ $type_id = $idx;
+ $type_score = 10;
+ }
+ }
}
return $type_id;
@@ -303,7 +317,7 @@ abstract class kolab_api_service
$extra_attrs = array();
// add group type id to the result
- $attrs['type_id'] = $this->object_type_id($object_name, $attrs['objectclass']);
+ $attrs['type_id'] = $this->object_type_id($object_name, $attrs);
if (empty($attrs['type_id'])) {
if ($object_name == 'domain') {
commit c1109dfdf8929e13084fe72fbc334a2d1481805a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Jun 21 12:51:30 2012 +0200
Better verbosity for console() message on resources.list service method
diff --git a/lib/api/kolab_api_service_resources.php b/lib/api/kolab_api_service_resources.php
index 6bcc7e3..bdb12d4 100644
--- a/lib/api/kolab_api_service_resources.php
+++ b/lib/api/kolab_api_service_resources.php
@@ -139,7 +139,7 @@ class kolab_api_service_resources extends kolab_api_service
'count' => $count,
);
- //console($result);
+ //console("api::resources.list() \$result", $result);
return $result;
}
More information about the commits
mailing list