diff options
author | Robin Appelman <robin@icewind.nl> | 2021-01-25 21:06:07 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-03-31 15:23:33 +0200 |
commit | 65b78515bd5864eb456c0717102a2b6eed7245cc (patch) | |
tree | 3481dfb873d7725395b1e334259083902469a87d /lib/private/Server.php | |
parent | 91ae7f22b0e796a8eba90f3de0ead750b685e793 (diff) | |
download | nextcloud-server-65b78515bd5864eb456c0717102a2b6eed7245cc.tar.gz nextcloud-server-65b78515bd5864eb456c0717102a2b6eed7245cc.zip |
make ILDAPProviderFactory usable when there is no ldap setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r-- | lib/private/Server.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index 26c76125e56..6a1550f83e0 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -104,6 +104,7 @@ use OC\IntegrityCheck\Checker; use OC\IntegrityCheck\Helpers\AppLocator; use OC\IntegrityCheck\Helpers\EnvironmentHelper; use OC\IntegrityCheck\Helpers\FileAccessHelper; +use OC\LDAP\NullLDAPProviderFactory; use OC\KnownUser\KnownUserService; use OC\Lock\DBLockingProvider; use OC\Lock\MemcacheLockingProvider; @@ -206,6 +207,8 @@ use OCP\IUser; use OCP\IUserManager; use OCP\IUserSession; use OCP\L10N\IFactory; +use OCP\LDAP\ILDAPProvider; +use OCP\LDAP\ILDAPProviderFactory; use OCP\Lock\ILockingProvider; use OCP\Log\ILogFactory; use OCP\Mail\IMailer; @@ -1003,14 +1006,20 @@ class Server extends ServerContainer implements IServerContainer { /** @deprecated 19.0.0 */ $this->registerDeprecatedAlias('Mailer', IMailer::class); - $this->registerService('LDAPProvider', function (ContainerInterface $c) { + /** @deprecated 21.0.0 */ + $this->registerDeprecatedAlias('LDAPProvider', ILDAPProvider::class); + + $this->registerService(ILDAPProviderFactory::class, function (ContainerInterface $c) { $config = $c->get(\OCP\IConfig::class); $factoryClass = $config->getSystemValue('ldapProviderFactory', null); if (is_null($factoryClass)) { - throw new \Exception('ldapProviderFactory not set'); + return new NullLDAPProviderFactory($this); } /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ - $factory = new $factoryClass($this); + return new $factoryClass($this); + }); + $this->registerService(ILDAPProvider::class, function (ContainerInterface $c) { + $factory = $c->get(ILDAPProviderFactory::class); return $factory->getLDAPProvider(); }); $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |