diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-12-11 20:04:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 20:04:28 +0100 |
commit | 179be8d95c78391a7bb4cb1a283bc4887d3eea21 (patch) | |
tree | d9fbb4b33e048ab2f07f9812dad6dc858e661bee /apps | |
parent | bd80795d595d4882fa1c11ae09ae22b6ab6520ec (diff) | |
parent | cecfc28ebd63b80904b57b23b0e0c30b02960330 (diff) | |
download | nextcloud-server-179be8d95c78391a7bb4cb1a283bc4887d3eea21.tar.gz nextcloud-server-179be8d95c78391a7bb4cb1a283bc4887d3eea21.zip |
Merge pull request #6637 from nextcloud/contactsstore_public_api
Make ContactsStore a public API
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/appinfo/app.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/AppInfo/Application.php | 10 | ||||
-rw-r--r-- | apps/dav/lib/CardDAV/ContactsManager.php | 8 |
3 files changed, 20 insertions, 0 deletions
diff --git a/apps/dav/appinfo/app.php b/apps/dav/appinfo/app.php index 8a534a75970..4f4fbe6e126 100644 --- a/apps/dav/appinfo/app.php +++ b/apps/dav/appinfo/app.php @@ -53,6 +53,8 @@ $cm->register(function() use ($cm, $app) { $user = \OC::$server->getUserSession()->getUser(); if (!is_null($user)) { $app->setupContactsProvider($cm, $user->getUID()); + } else { + $app->setupSystemContactsProvider($cm); } }); diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index b38f38044f3..a5571286354 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -76,6 +76,16 @@ class Application extends App { } /** + * @param IManager $contactsManager + */ + public function setupSystemContactsProvider(IContactsManager $contactsManager) { + /** @var ContactsManager $cm */ + $cm = $this->getContainer()->query(ContactsManager::class); + $urlGenerator = $this->getContainer()->getServer()->getURLGenerator(); + $cm->setupSystemContactsProvider($contactsManager, $urlGenerator); + } + + /** * @param ICalendarManager $calendarManager * @param string $userId */ diff --git a/apps/dav/lib/CardDAV/ContactsManager.php b/apps/dav/lib/CardDAV/ContactsManager.php index ad02d4ba427..67e3ef2c72c 100644 --- a/apps/dav/lib/CardDAV/ContactsManager.php +++ b/apps/dav/lib/CardDAV/ContactsManager.php @@ -55,6 +55,14 @@ class ContactsManager { public function setupContactsProvider(IManager $cm, $userId, IURLGenerator $urlGenerator) { $addressBooks = $this->backend->getAddressBooksForUser("principals/users/$userId"); $this->register($cm, $addressBooks, $urlGenerator); + $this->setupSystemContactsProvider($cm, $urlGenerator); + } + + /** + * @param IManager $cm + * @param IURLGenerator $urlGenerator + */ + public function setupSystemContactsProvider(IManager $cm, IURLGenerator $urlGenerator) { $addressBooks = $this->backend->getAddressBooksForUser("principals/system/system"); $this->register($cm, $addressBooks, $urlGenerator); } |