diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-12-17 00:31:27 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-12-17 00:31:27 +0100 |
commit | feb5366a428e25ebb6054c4a3d0bc6ea304bb295 (patch) | |
tree | 48009bec6d274d23a898899aa78e54903b471b2d /apps/user_ldap/lib | |
parent | 9322f5064a03fd523898caaec4414744a76595fc (diff) | |
download | nextcloud-server-feb5366a428e25ebb6054c4a3d0bc6ea304bb295.tar.gz nextcloud-server-feb5366a428e25ebb6054c4a3d0bc6ea304bb295.zip |
LDAP clear cache on config modification also when done via API or CLI
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/AppInfo/Application.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/SetConfig.php | 5 | ||||
-rw-r--r-- | apps/user_ldap/lib/Controller/ConfigAPIController.php | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 6d5c416f04f..59d7cdb4924 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -24,6 +24,8 @@ namespace OCA\User_LDAP\AppInfo; use OCA\User_LDAP\Controller\RenewPasswordController; +use OCA\User_LDAP\ILDAPWrapper; +use OCA\User_LDAP\LDAP; use OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; use OCP\IL10N; @@ -50,5 +52,9 @@ class Application extends App { $server->getURLGenerator() ); }); + + $container->registerService(ILDAPWrapper::class, function () { + return new LDAP(); + }); } } diff --git a/apps/user_ldap/lib/Command/SetConfig.php b/apps/user_ldap/lib/Command/SetConfig.php index db656558efc..cf73874ade8 100644 --- a/apps/user_ldap/lib/Command/SetConfig.php +++ b/apps/user_ldap/lib/Command/SetConfig.php @@ -26,6 +26,8 @@ namespace OCA\User_LDAP\Command; +use OCA\User_LDAP\ConnectionFactory; +use OCA\User_LDAP\LDAP; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -83,5 +85,8 @@ class SetConfig extends Command { $configHolder = new Configuration($configID); $configHolder->$key = $value; $configHolder->saveConfiguration(); + + $connectionFactory = new ConnectionFactory(new LDAP()); + $connectionFactory->get($configID)->clearCache(); } } diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index a745e4ce060..ce885b7dabb 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -27,6 +27,7 @@ use OC\CapabilitiesManager; use OC\Core\Controller\OCSController; use OC\Security\IdentityProof\Manager; use OCA\User_LDAP\Configuration; +use OCA\User_LDAP\ConnectionFactory; use OCA\User_LDAP\Helper; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSBadRequestException; @@ -45,6 +46,9 @@ class ConfigAPIController extends OCSController { /** @var ILogger */ private $logger; + /** @var ConnectionFactory */ + private $connectionFactory; + public function __construct( $appName, IRequest $request, @@ -53,7 +57,8 @@ class ConfigAPIController extends OCSController { IUserManager $userManager, Manager $keyManager, Helper $ldapHelper, - ILogger $logger + ILogger $logger, + ConnectionFactory $connectionFactory ) { parent::__construct( $appName, @@ -67,6 +72,7 @@ class ConfigAPIController extends OCSController { $this->ldapHelper = $ldapHelper; $this->logger = $logger; + $this->connectionFactory = $connectionFactory; } /** @@ -198,6 +204,7 @@ class ConfigAPIController extends OCSController { } $configuration->saveConfiguration(); + $this->connectionFactory->get($configID)->clearCache(); } catch(OCSException $e) { throw $e; } catch (\Exception $e) { |