summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-04-25 07:04:24 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-04-25 07:04:24 (GMT)
commitd2440636d44761095b55d89e89d866a259115938 (patch)
treee8f1c91fa367ae31204cba6a5b5b4483f4f0f6b6
parentae54d15c6083425a3f6795828f8f9318d55fc044 (diff)
downloadkolab-freebusy-d2440636d44761095b55d89e89d866a259115938.tar.gz
Convert certain attributes to lower-case as defined by config (#1777)
-rw-r--r--config/config.ini.sample1
-rw-r--r--lib/Kolab/FreeBusy/Directory.php17
2 files changed, 17 insertions, 1 deletions
diff --git a/config/config.ini.sample b/config/config.ini.sample
index fbcbdfa..62437d3 100644
--- a/config/config.ini.sample
+++ b/config/config.ini.sample
@@ -48,6 +48,7 @@ bind_pw = "<service-bind-pw>"
base_dn = "dc=yourdomain,dc=com"
filter = "(&(objectClass=kolabInetOrgPerson)(|(uid=%s)(mail=%s)(alias=%s)))"
attributes[] = mail
+lc_attributes[] = mail
fbsource = file:/www/kolab-freebusy/data/%mail.ifb
loglevel = 100 ; Debug
diff --git a/lib/Kolab/FreeBusy/Directory.php b/lib/Kolab/FreeBusy/Directory.php
index 97fee75..dba6014 100644
--- a/lib/Kolab/FreeBusy/Directory.php
+++ b/lib/Kolab/FreeBusy/Directory.php
@@ -53,7 +53,7 @@ abstract class Directory
$fbsource = $this->config['fbsource'];
if ($source = Source::Factory($fbsource)) {
// forward request to Source instance
- if ($data = $source->getFreeBusyData($user, $extended)) {
+ if ($data = $source->getFreeBusyData($this->postprocessAttrib($user), $extended)) {
// send data through the according format converter
$converter = Format::factory($this->config['format']);
$data = $converter->toVCalendar($data);
@@ -66,4 +66,19 @@ abstract class Directory
return false;
}
+ /**
+ * Modify attribute values according to config
+ */
+ protected function postprocessAttrib($attrib)
+ {
+ if (!empty($this->config['lc_attributes'])) {
+ foreach ((array)$this->config['lc_attributes'] as $key) {
+ if (!empty($attrib[$key]))
+ $attrib[$key] = strtolower($attrib[$key]);
+ }
+ }
+
+ return $attrib;
+ }
+
} \ No newline at end of file