Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117799117
D1780.1775265882.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D1780.1775265882.diff
View Options
diff --git a/lib/Kolab/CardDAV/LDAPResources.php b/lib/Kolab/CardDAV/LDAPResources.php
--- /dev/null
+++ b/lib/Kolab/CardDAV/LDAPResources.php
@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * CardDAV Directory class providing read-only access
+ * to an LDAP-based resources address book.
+ */
+
+namespace Kolab\CardDAV;
+
+use \rcube;
+use \rcube_ldap;
+use \rcube_ldap_generic;
+use Sabre\DAV;
+use Sabre\DAVACL;
+use Sabre\CardDAV\Property;
+use Kolab\Utils\VObjectUtils;
+
+class LDAPResources extends LDAPDirectory
+{
+ const DIRECTORY_NAME = 'ldap-resources';
+
+ /**
+ * Default constructor
+ */
+ function __construct($config, $principalUri, $carddavBackend = null)
+ {
+ $this->config = $config;
+ $this->principalUri = $principalUri;
+
+ $this->addressBookInfo = array(
+ 'id' => self::DIRECTORY_NAME,
+ 'uri' => self::DIRECTORY_NAME,
+ '{DAV:}displayname' => $config['name'] ?: "LDAP Resources",
+ '{urn:ietf:params:xml:ns:carddav}supported-address-data' => new Property\SupportedAddressData(),
+ 'principaluri' => $principalUri,
+ );
+
+ // used for vcard serialization
+ $this->carddavBackend = $carddavBackend ?: new ContactsBackend();
+ $this->carddavBackend->ldap_resources = $this;
+
+ // initialize cache. We need a different address space from GAL
+ // so don't mix our caches
+ $rcube = rcube::get_instance();
+ if ($rcube->config->get('kolabdav_res_cache')) {
+ $this->cache = $rcube->get_cache_shared('kolabdav_res');
+
+ // expunge cache every now and then
+ if (rand(0,10) === 0) {
+ $this->cache->expunge();
+ }
+ }
+ }
+
+ /**
+ * Returns the name of the node.
+ *
+ * This is used to generate the url.
+ *
+ * @return string
+ */
+ function getName()
+ {
+ return self::DIRECTORY_NAME;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 1:24 AM (10 h, 25 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18824231
Default Alt Text
D1780.1775265882.diff (1 KB)
Attached To
Mode
D1780: Add missing LDAPResources file, fixes T6019
Attached
Detach File
Event Timeline