diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-02-22 19:24:26 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-28 23:41:35 -0300 |
commit | 1fc05ea53a6ed6053c0ceb90ad72a49ca314d57e (patch) | |
tree | 58ae3b1dc3f748f290bff88f086fa77dc286223d /apps/lookup_server_connector | |
parent | 2a773310dc58adcd299c1f7ae37e834cbae3b027 (diff) | |
download | nextcloud-server-1fc05ea53a6ed6053c0ceb90ad72a49ca314d57e.tar.gz nextcloud-server-1fc05ea53a6ed6053c0ceb90ad72a49ca314d57e.zip |
allow admin to configure lookup server
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r-- | apps/lookup_server_connector/appinfo/app.php | 10 | ||||
-rw-r--r-- | apps/lookup_server_connector/lib/UpdateLookupServer.php | 29 |
2 files changed, 15 insertions, 24 deletions
diff --git a/apps/lookup_server_connector/appinfo/app.php b/apps/lookup_server_connector/appinfo/app.php index 639eeafcf3f..a98a5de406f 100644 --- a/apps/lookup_server_connector/appinfo/app.php +++ b/apps/lookup_server_connector/appinfo/app.php @@ -28,18 +28,20 @@ $dispatcher->addListener('OC\AccountManager::userUpdated', function(\Symfony\Com \OC::$server->getAppDataDir('identityproof'), \OC::$server->getCrypto() ); + + $config = \OC::$server->getConfig(); + $lookupServer = $config->getSystemValue('lookup_server', ''); + $updateLookupServer = new \OCA\LookupServerConnector\UpdateLookupServer( new \OC\Accounts\AccountManager(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()), - \OC::$server->getConfig(), - \OC::$server->getSecureRandom(), \OC::$server->getHTTPClientService(), - $keyManager, new \OC\Security\IdentityProof\Signer( $keyManager, new \OC\AppFramework\Utility\TimeFactory(), \OC::$server->getUserManager() ), - \OC::$server->getJobList() + \OC::$server->getJobList(), + $lookupServer ); $updateLookupServer->userUpdated($user); }); diff --git a/apps/lookup_server_connector/lib/UpdateLookupServer.php b/apps/lookup_server_connector/lib/UpdateLookupServer.php index 86865311725..03fd98351c8 100644 --- a/apps/lookup_server_connector/lib/UpdateLookupServer.php +++ b/apps/lookup_server_connector/lib/UpdateLookupServer.php @@ -23,14 +23,11 @@ namespace OCA\LookupServerConnector; use OC\Accounts\AccountManager; -use OC\Security\IdentityProof\Manager; use OC\Security\IdentityProof\Signer; use OCA\LookupServerConnector\BackgroundJobs\RetryJob; use OCP\BackgroundJob\IJobList; use OCP\Http\Client\IClientService; -use OCP\IConfig; use OCP\IUser; -use OCP\Security\ISecureRandom; /** * Class UpdateLookupServer @@ -40,44 +37,36 @@ use OCP\Security\ISecureRandom; class UpdateLookupServer { /** @var AccountManager */ private $accountManager; - /** @var IConfig */ - private $config; - /** @var ISecureRandom */ - private $secureRandom; /** @var IClientService */ private $clientService; - /** @var Manager */ - private $keyManager; /** @var Signer */ private $signer; /** @var IJobList */ private $jobList; /** @var string URL point to lookup server */ - private $lookupServer = 'https://lookup.nextcloud.com/users'; + private $lookupServer = 'https://lookup.nextcloud.com'; /** * @param AccountManager $accountManager - * @param IConfig $config - * @param ISecureRandom $secureRandom * @param IClientService $clientService - * @param Manager $manager * @param Signer $signer * @param IJobList $jobList + * @param string $lookupServer if nothing is given we use the default lookup server */ public function __construct(AccountManager $accountManager, - IConfig $config, - ISecureRandom $secureRandom, IClientService $clientService, - Manager $manager, Signer $signer, - IJobList $jobList) { + IJobList $jobList, + $lookupServer = '') { $this->accountManager = $accountManager; - $this->config = $config; - $this->secureRandom = $secureRandom; $this->clientService = $clientService; - $this->keyManager = $manager; $this->signer = $signer; $this->jobList = $jobList; + if ($lookupServer !== '') { + $this->lookupServer = $lookupServer; + } + $this->lookupServer = rtrim($this->lookupServer, '/'); + $this->lookupServer .= '/users'; } /** |