Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117705771
D24.1774883446.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D24.1774883446.diff
View Options
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -28,6 +28,7 @@
*/
abstract class kolab_api_service
{
+ protected $base_dn = null;
protected $cache = array();
protected $conf;
protected $controller;
@@ -155,13 +156,31 @@
// Static attributes score
$elem_values_score = 0;
foreach ((array) $elem['attributes']['fields'] as $attr => $value) {
+ // Skip the object classes we have already compared
+ if ($attr == "objectclass") {
+ continue;
+ }
+
$v = $attributes[$attr];
+
if (is_array($value)) {
+ foreach ($value as $_value) {
+ $_value = $this->conf->expand($_value, $custom = Array('base_dn' => $this->base_dn()));
+
+ if (in_array($_value, (array)$v)) {
+ $elem_values_score++;
+ }
+ }
+
$value = implode('', $value);
+ } else {
+ $value = $this->conf->expand($_value, $custom = Array('base_dn' => $this->base_dn()));
}
+
if (is_array($v)) {
$v = implode('', $v);
}
+
$elem_values_score += intval($v == $value);
}
@@ -350,11 +369,19 @@
if (isset($type_attrs['fields'])) {
foreach ($type_attrs['fields'] as $key => $value) {
if (!is_array($value)) {
- $value2 = $this->conf->expand($value);
+ $value2 = $this->conf->expand($value, $custom = Array('base_dn' => $this->base_dn()));
if ($value !== $value2) {
Log::trace("Made value " . var_export($value, TRUE) . " in to: " . var_export($value2, TRUE));
$value = $value2;
}
+ } else {
+ foreach ($value as $_key => $_value) {
+ $_value2 = $this->conf->expand($_value, $custom = Array('base_dn' => $this->base_dn()));
+ if ($_value !== $_value2) {
+ Log::trace("Made value " . var_export($_value, TRUE) . " in to: " . var_export($_value2, TRUE));
+ $value[$_key] = $_value2;
+ }
+ }
}
if (empty($attribs[$key])) {
@@ -663,4 +690,36 @@
return $this->cache['unique_attributes'][$dn] = $result;
}
+
+ private function base_dn()
+ {
+ if (!empty($this->base_dn)) {
+ return $this->base_dn;
+ }
+
+ // Get the domain information for expansion later
+ $auth = Auth::get_instance();
+ $domain_info = $auth->domain_info($_SESSION['user']->get_domain());
+ $domain_info = $domain_info[key($domain_info)];
+ $dna = $this->conf->get('domain_name_attribute');
+
+ if (empty($dna)) {
+ $dna = 'associateddomain';
+ }
+
+ $domain = $domain_info[$dna];
+ if (is_array($domain)) {
+ $domain = $domain[0];
+ }
+
+ $dba = 'inetdomainbasedn';
+
+ if (empty($domain_info[$dba])) {
+ $this->base_dn = 'dc=' . implode('dc=,', explode('.', $domain));
+ } else {
+ $this->base_dn = $domain_info[$dba];
+ }
+
+ return $this->base_dn;
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 30, 3:10 PM (2 d, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18814917
Default Alt Text
D24.1774883446.diff (3 KB)
Attached To
Mode
D24: Allow values of attributes defined to be expanded and as such, match between the configured user type and the LDAP object entry (T496)
Attached
Detach File
Event Timeline