make ILDAPProviderFactory usable when there is no ldap setuptags/v22.0.0beta1
public function getLDAPProvider(): ILDAPProvider { | public function getLDAPProvider(): ILDAPProvider { | ||||
return $this->serverContainer->get(LDAPProvider::class); | return $this->serverContainer->get(LDAPProvider::class); | ||||
} | } | ||||
public function isAvailable(): bool { | |||||
return true; | |||||
} | |||||
} | } |
'OC\\L10N\\LanguageIterator' => $baseDir . '/lib/private/L10N/LanguageIterator.php', | 'OC\\L10N\\LanguageIterator' => $baseDir . '/lib/private/L10N/LanguageIterator.php', | ||||
'OC\\L10N\\LanguageNotFoundException' => $baseDir . '/lib/private/L10N/LanguageNotFoundException.php', | 'OC\\L10N\\LanguageNotFoundException' => $baseDir . '/lib/private/L10N/LanguageNotFoundException.php', | ||||
'OC\\L10N\\LazyL10N' => $baseDir . '/lib/private/L10N/LazyL10N.php', | 'OC\\L10N\\LazyL10N' => $baseDir . '/lib/private/L10N/LazyL10N.php', | ||||
'OC\\LDAP\\NullLDAPProviderFactory' => $baseDir . '/lib/private/LDAP/NullLDAPProviderFactory.php', | |||||
'OC\\LargeFileHelper' => $baseDir . '/lib/private/LargeFileHelper.php', | 'OC\\LargeFileHelper' => $baseDir . '/lib/private/LargeFileHelper.php', | ||||
'OC\\Lock\\AbstractLockingProvider' => $baseDir . '/lib/private/Lock/AbstractLockingProvider.php', | 'OC\\Lock\\AbstractLockingProvider' => $baseDir . '/lib/private/Lock/AbstractLockingProvider.php', | ||||
'OC\\Lock\\DBLockingProvider' => $baseDir . '/lib/private/Lock/DBLockingProvider.php', | 'OC\\Lock\\DBLockingProvider' => $baseDir . '/lib/private/Lock/DBLockingProvider.php', |
'OC\\L10N\\LanguageIterator' => __DIR__ . '/../../..' . '/lib/private/L10N/LanguageIterator.php', | 'OC\\L10N\\LanguageIterator' => __DIR__ . '/../../..' . '/lib/private/L10N/LanguageIterator.php', | ||||
'OC\\L10N\\LanguageNotFoundException' => __DIR__ . '/../../..' . '/lib/private/L10N/LanguageNotFoundException.php', | 'OC\\L10N\\LanguageNotFoundException' => __DIR__ . '/../../..' . '/lib/private/L10N/LanguageNotFoundException.php', | ||||
'OC\\L10N\\LazyL10N' => __DIR__ . '/../../..' . '/lib/private/L10N/LazyL10N.php', | 'OC\\L10N\\LazyL10N' => __DIR__ . '/../../..' . '/lib/private/L10N/LazyL10N.php', | ||||
'OC\\LDAP\\NullLDAPProviderFactory' => __DIR__ . '/../../..' . '/lib/private/LDAP/NullLDAPProviderFactory.php', | |||||
'OC\\LargeFileHelper' => __DIR__ . '/../../..' . '/lib/private/LargeFileHelper.php', | 'OC\\LargeFileHelper' => __DIR__ . '/../../..' . '/lib/private/LargeFileHelper.php', | ||||
'OC\\Lock\\AbstractLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/AbstractLockingProvider.php', | 'OC\\Lock\\AbstractLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/AbstractLockingProvider.php', | ||||
'OC\\Lock\\DBLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/DBLockingProvider.php', | 'OC\\Lock\\DBLockingProvider' => __DIR__ . '/../../..' . '/lib/private/Lock/DBLockingProvider.php', |
<?php | |||||
declare(strict_types=1); | |||||
/** | |||||
* @copyright Copyright (c) 2021 Robin Appelman <robin@icewind.nl> | |||||
* | |||||
* @license GNU AGPL version 3 or any later version | |||||
* | |||||
* This program is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU Affero General Public License as | |||||
* published by the Free Software Foundation, either version 3 of the | |||||
* License, or (at your option) any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Affero General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU Affero General Public License | |||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||||
* | |||||
*/ | |||||
namespace OC\LDAP; | |||||
use OCP\IServerContainer; | |||||
use OCP\LDAP\ILDAPProviderFactory; | |||||
class NullLDAPProviderFactory implements ILDAPProviderFactory { | |||||
public function __construct(IServerContainer $serverContainer) { | |||||
} | |||||
public function getLDAPProvider() { | |||||
throw new \Exception("No LDAP provider is available"); | |||||
} | |||||
public function isAvailable(): bool { | |||||
return false; | |||||
} | |||||
} |
use OC\IntegrityCheck\Helpers\AppLocator; | use OC\IntegrityCheck\Helpers\AppLocator; | ||||
use OC\IntegrityCheck\Helpers\EnvironmentHelper; | use OC\IntegrityCheck\Helpers\EnvironmentHelper; | ||||
use OC\IntegrityCheck\Helpers\FileAccessHelper; | use OC\IntegrityCheck\Helpers\FileAccessHelper; | ||||
use OC\LDAP\NullLDAPProviderFactory; | |||||
use OC\KnownUser\KnownUserService; | use OC\KnownUser\KnownUserService; | ||||
use OC\Lock\DBLockingProvider; | use OC\Lock\DBLockingProvider; | ||||
use OC\Lock\MemcacheLockingProvider; | use OC\Lock\MemcacheLockingProvider; | ||||
use OCP\IUserManager; | use OCP\IUserManager; | ||||
use OCP\IUserSession; | use OCP\IUserSession; | ||||
use OCP\L10N\IFactory; | use OCP\L10N\IFactory; | ||||
use OCP\LDAP\ILDAPProvider; | |||||
use OCP\LDAP\ILDAPProviderFactory; | |||||
use OCP\Lock\ILockingProvider; | use OCP\Lock\ILockingProvider; | ||||
use OCP\Log\ILogFactory; | use OCP\Log\ILogFactory; | ||||
use OCP\Mail\IMailer; | use OCP\Mail\IMailer; | ||||
/** @deprecated 19.0.0 */ | /** @deprecated 19.0.0 */ | ||||
$this->registerDeprecatedAlias('Mailer', IMailer::class); | $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); | $config = $c->get(\OCP\IConfig::class); | ||||
$factoryClass = $config->getSystemValue('ldapProviderFactory', null); | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); | ||||
if (is_null($factoryClass)) { | if (is_null($factoryClass)) { | ||||
throw new \Exception('ldapProviderFactory not set'); | |||||
return new NullLDAPProviderFactory($this); | |||||
} | } | ||||
/** @var \OCP\LDAP\ILDAPProviderFactory $factory */ | /** @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(); | return $factory->getLDAPProvider(); | ||||
}); | }); | ||||
$this->registerService(ILockingProvider::class, function (ContainerInterface $c) { | $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
* @since 11.0.0 | * @since 11.0.0 | ||||
*/ | */ | ||||
public function __construct(IServerContainer $serverContainer); | public function __construct(IServerContainer $serverContainer); | ||||
/** | /** | ||||
* creates and returns an instance of the ILDAPProvider | * creates and returns an instance of the ILDAPProvider | ||||
* | * | ||||
* @since 11.0.0 | * @since 11.0.0 | ||||
*/ | */ | ||||
public function getLDAPProvider(); | public function getLDAPProvider(); | ||||
/** | |||||
* Check if an ldap provider is available | |||||
* | |||||
* @return bool | |||||
* @since 21.0.0 | |||||
*/ | |||||
public function isAvailable(): bool; | |||||
} | } |