summaryrefslogtreecommitdiff
path: root/lib/kolab_api_service.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-10-25 11:04:07 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-10-25 11:04:07 (GMT)
commitbc02bf23dfa00062ca94a9fe285496a11e010967 (patch)
tree2fd49b71afc89bb0ece8d10bb8d2e2628102f7f9 /lib/kolab_api_service.php
parentcc78f666ed3492c2fc4c77b5313f10f0e3fec3a5 (diff)
downloadkolab-wap-bc02bf23dfa00062ca94a9fe285496a11e010967.tar.gz
Add support for validate='extended' in 'alias' field, which if set
will check for availability of provided email addresses. Added in-memory cache for entrydn-to-nsuniqueid resolving. Code improvements
Diffstat (limited to 'lib/kolab_api_service.php')
-rw-r--r--lib/kolab_api_service.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index fa5bd8e..c8f2680 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -560,4 +560,24 @@ abstract class kolab_api_service
return $unique_attr;
}
+
+ /**
+ * Returns unique attribute for specified entry DN
+ *
+ * @return string Unique attribute value
+ */
+ protected function unique_attribute_value($dn)
+ {
+ // this method can be called internally quite often
+ // let's cache results in memory
+ if (!empty($this->cache['unique_attributes'][$dn])) {
+ return $this->cache['unique_attributes'][$dn];
+ }
+
+ $unique_attr = $this->unique_attribute();
+ $auth = Auth::get_instance();
+ $result = $auth->get_entry_attribute($dn, $unique_attr);
+
+ return $this->cache['unique_attributes'][$dn] = $result;
+ }
}