summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-12-11 20:04:28 +0100
committerGitHub <noreply@github.com>2017-12-11 20:04:28 +0100
commit179be8d95c78391a7bb4cb1a283bc4887d3eea21 (patch)
treed9fbb4b33e048ab2f07f9812dad6dc858e661bee /lib
parentbd80795d595d4882fa1c11ae09ae22b6ab6520ec (diff)
parentcecfc28ebd63b80904b57b23b0e0c30b02960330 (diff)
downloadnextcloud-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 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php3
-rw-r--r--lib/private/Server.php12
-rw-r--r--lib/public/Contacts/ContactsMenu/IContactsStore.php31
5 files changed, 47 insertions, 1 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index b3fb04ff6d9..c91e4989d71 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -93,6 +93,7 @@ return array(
'OCP\\Contacts' => $baseDir . '/lib/public/Contacts.php',
'OCP\\Contacts\\ContactsMenu\\IAction' => $baseDir . '/lib/public/Contacts/ContactsMenu/IAction.php',
'OCP\\Contacts\\ContactsMenu\\IActionFactory' => $baseDir . '/lib/public/Contacts/ContactsMenu/IActionFactory.php',
+ 'OCP\\Contacts\\ContactsMenu\\IContactsStore' => $baseDir . '/lib/public/Contacts/ContactsMenu/IContactsStore.php',
'OCP\\Contacts\\ContactsMenu\\IEntry' => $baseDir . '/lib/public/Contacts/ContactsMenu/IEntry.php',
'OCP\\Contacts\\ContactsMenu\\ILinkAction' => $baseDir . '/lib/public/Contacts/ContactsMenu/ILinkAction.php',
'OCP\\Contacts\\ContactsMenu\\IProvider' => $baseDir . '/lib/public/Contacts/ContactsMenu/IProvider.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index a905134ce9f..3a7d7674fa0 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -123,6 +123,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Contacts' => __DIR__ . '/../../..' . '/lib/public/Contacts.php',
'OCP\\Contacts\\ContactsMenu\\IAction' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IAction.php',
'OCP\\Contacts\\ContactsMenu\\IActionFactory' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IActionFactory.php',
+ 'OCP\\Contacts\\ContactsMenu\\IContactsStore' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IContactsStore.php',
'OCP\\Contacts\\ContactsMenu\\IEntry' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IEntry.php',
'OCP\\Contacts\\ContactsMenu\\ILinkAction' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/ILinkAction.php',
'OCP\\Contacts\\ContactsMenu\\IProvider' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IProvider.php',
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index 108ff0d4989..43600470e1f 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -35,8 +35,9 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\Contacts\ContactsMenu\IContactsStore;
-class ContactsStore {
+class ContactsStore implements IContactsStore {
/** @var IManager */
private $contactsManager;
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 0dfbcbb75ec..8a5fb0fa96c 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -63,6 +63,7 @@ use OC\Collaboration\Collaborators\RemotePlugin;
use OC\Collaboration\Collaborators\UserPlugin;
use OC\Command\CronBus;
use OC\Contacts\ContactsMenu\ActionFactory;
+use OC\Contacts\ContactsMenu\ContactsStore;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger;
use OC\Federation\CloudIdManager;
@@ -114,6 +115,7 @@ use OCA\Theming\ThemingDefaults;
use OCP\App\IAppManager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Collaboration\AutoComplete\IManager;
+use OCP\Contacts\ContactsMenu\IContactsStore;
use OCP\Defaults;
use OCA\Theming\Util;
use OCP\Federation\ICloudIdManager;
@@ -1129,6 +1131,16 @@ class Server extends ServerContainer implements IServerContainer {
return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
});
+ $this->registerService(IContactsStore::class, function(Server $c) {
+ return new ContactsStore(
+ $c->getContactsManager(),
+ $c->getConfig(),
+ $c->getUserManager(),
+ $c->getGroupManager()
+ );
+ });
+ $this->registerAlias(IContactsStore::class, ContactsStore::class);
+
$this->connectDispatcher();
}
diff --git a/lib/public/Contacts/ContactsMenu/IContactsStore.php b/lib/public/Contacts/ContactsMenu/IContactsStore.php
new file mode 100644
index 00000000000..78b2b29c574
--- /dev/null
+++ b/lib/public/Contacts/ContactsMenu/IContactsStore.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace OCP\Contacts\ContactsMenu;
+
+use OCP\IUser;
+
+/**
+ * @since 13.0.0
+ */
+interface IContactsStore {
+
+
+ /**
+ * @param IUser $user
+ * @param $filter
+ * @return IEntry[]
+ * @since 13.0.0
+ */
+ public function getContacts(IUser $user, $filter);
+
+ /**
+ * @brief finds a contact by specifying the property to search on ($shareType) and the value ($shareWith)
+ * @param IUser $user
+ * @param integer $shareType
+ * @param string $shareWith
+ * @return IEntry|null
+ * @since 13.0.0
+ */
+ public function findOne(IUser $user, $shareType, $shareWith);
+
+}