diff options
Diffstat (limited to 'lib/kolab_api_service.php')
-rw-r--r-- | lib/kolab_api_service.php | 20 |
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; + } } |