summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-10-10 10:18:18 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-10 10:18:18 +0200
commitbdf4bf46698f3239b9552e2e8cc30501bfc5a399 (patch)
treebfaf2222aa0497ad5a9ec8f7933d387bb9692533 /apps
parent1ba2b7e5d4d787c64d07ddbf8bfa1efd74cccaa9 (diff)
downloadnextcloud-server-bdf4bf46698f3239b9552e2e8cc30501bfc5a399.tar.gz
nextcloud-server-bdf4bf46698f3239b9552e2e8cc30501bfc5a399.zip
DI IConfig into ldap helper
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/ajax/deleteConfiguration.php2
-rw-r--r--apps/user_ldap/ajax/getNewServerConfigPrefix.php2
-rw-r--r--apps/user_ldap/ajax/wizard.php4
-rw-r--r--apps/user_ldap/appinfo/app.php2
-rw-r--r--apps/user_ldap/appinfo/install.php2
-rw-r--r--apps/user_ldap/appinfo/register_command.php2
-rw-r--r--apps/user_ldap/appinfo/update.php2
-rw-r--r--apps/user_ldap/lib/Command/Search.php2
-rw-r--r--apps/user_ldap/lib/Command/SetConfig.php2
-rw-r--r--apps/user_ldap/lib/Command/TestConfig.php2
-rw-r--r--apps/user_ldap/lib/Connection.php2
-rw-r--r--apps/user_ldap/lib/Helper.php16
-rw-r--r--apps/user_ldap/lib/Jobs/CleanUp.php2
-rw-r--r--apps/user_ldap/lib/Jobs/UpdateGroups.php2
-rw-r--r--apps/user_ldap/lib/LDAPProviderFactory.php2
-rw-r--r--apps/user_ldap/lib/Proxy.php2
-rw-r--r--apps/user_ldap/lib/Settings/Admin.php2
-rw-r--r--apps/user_ldap/lib/Wizard.php2
-rw-r--r--apps/user_ldap/tests/AccessTest.php2
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php2
-rw-r--r--apps/user_ldap/tests/Integration/AbstractIntegrationTest.php2
-rw-r--r--apps/user_ldap/tests/LDAPProviderTest.php4
-rw-r--r--apps/user_ldap/tests/Settings/AdminTest.php2
-rw-r--r--apps/user_ldap/tests/User/UserTest.php2
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php2
-rw-r--r--apps/user_ldap/tests/WizardTest.php2
26 files changed, 43 insertions, 27 deletions
diff --git a/apps/user_ldap/ajax/deleteConfiguration.php b/apps/user_ldap/ajax/deleteConfiguration.php
index 683a63435e2..6115ae2faa5 100644
--- a/apps/user_ldap/ajax/deleteConfiguration.php
+++ b/apps/user_ldap/ajax/deleteConfiguration.php
@@ -32,7 +32,7 @@ OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$prefix = (string)$_POST['ldap_serverconfig_chooser'];
-$helper = new \OCA\User_LDAP\Helper();
+$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
if($helper->deleteServerConfiguration($prefix)) {
OCP\JSON::success();
} else {
diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php
index ae0199f79a7..536aab4bc87 100644
--- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php
+++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php
@@ -27,7 +27,7 @@ OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
-$helper = new \OCA\User_LDAP\Helper();
+$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$serverConnections = $helper->getServerConfigurationPrefixes();
sort($serverConnections);
$lk = array_pop($serverConnections);
diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php
index 654fb70ced5..826f94f0003 100644
--- a/apps/user_ldap/ajax/wizard.php
+++ b/apps/user_ldap/ajax/wizard.php
@@ -60,7 +60,9 @@ $userManager = new \OCA\User_LDAP\User\Manager(
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager());
-$access = new \OCA\User_LDAP\Access($con, $ldapWrapper, $userManager, new \OCA\User_LDAP\Helper());
+$access = new \OCA\User_LDAP\Access($con, $ldapWrapper, $userManager, new \OCA\User_LDAP\Helper(
+ \OC::$server->getConfig()
+));
$wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index caacbea5619..995b1226649 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -27,7 +27,7 @@
*
*/
-$helper = new \OCA\User_LDAP\Helper();
+$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new OCA\User_LDAP\LDAP();
$ocConfig = \OC::$server->getConfig();
diff --git a/apps/user_ldap/appinfo/install.php b/apps/user_ldap/appinfo/install.php
index c16a1f4a039..43ec69a950b 100644
--- a/apps/user_ldap/appinfo/install.php
+++ b/apps/user_ldap/appinfo/install.php
@@ -26,5 +26,5 @@ if($state === 'doSet') {
OCP\Config::setSystemValue('ldapIgnoreNamingRules', false);
}
-$helper = new \OCA\User_LDAP\Helper();
+$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$helper->setLDAPProvider();
diff --git a/apps/user_ldap/appinfo/register_command.php b/apps/user_ldap/appinfo/register_command.php
index 59e2dca565f..41083f8d12a 100644
--- a/apps/user_ldap/appinfo/register_command.php
+++ b/apps/user_ldap/appinfo/register_command.php
@@ -30,7 +30,7 @@ use OCA\User_LDAP\User\DeletedUsersIndex;
$dbConnection = \OC::$server->getDatabaseConnection();
$userMapping = new UserMapping($dbConnection);
-$helper = new Helper();
+$helper = new Helper(\OC::$server->getConfig());
$ocConfig = \OC::$server->getConfig();
$uBackend = new User_Proxy(
$helper->getServerConfigurationPrefixes(true),
diff --git a/apps/user_ldap/appinfo/update.php b/apps/user_ldap/appinfo/update.php
index 3c9745338e6..f6f7389dd5f 100644
--- a/apps/user_ldap/appinfo/update.php
+++ b/apps/user_ldap/appinfo/update.php
@@ -20,5 +20,5 @@
*
*/
-$helper = new \OCA\User_LDAP\Helper();
+$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$helper->setLDAPProvider();
diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php
index e1db3f47448..17e506855b2 100644
--- a/apps/user_ldap/lib/Command/Search.php
+++ b/apps/user_ldap/lib/Command/Search.php
@@ -102,7 +102,7 @@ class Search extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $helper = new Helper();
+ $helper = new Helper($this->ocConfig);
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new LDAP();
diff --git a/apps/user_ldap/lib/Command/SetConfig.php b/apps/user_ldap/lib/Command/SetConfig.php
index a1d5e90f3ed..5188bee1049 100644
--- a/apps/user_ldap/lib/Command/SetConfig.php
+++ b/apps/user_ldap/lib/Command/SetConfig.php
@@ -57,7 +57,7 @@ class SetConfig extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$availableConfigs = $helper->getServerConfigurationPrefixes();
$configID = $input->getArgument('configID');
if(!in_array($configID, $availableConfigs)) {
diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php
index 55a834812aa..cd3ecc26d2b 100644
--- a/apps/user_ldap/lib/Command/TestConfig.php
+++ b/apps/user_ldap/lib/Command/TestConfig.php
@@ -47,7 +47,7 @@ class TestConfig extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$availableConfigs = $helper->getServerConfigurationPrefixes();
$configID = $input->getArgument('configID');
if(!in_array($configID, $availableConfigs)) {
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 07a595f0529..64c8b9675a3 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -87,7 +87,7 @@ class Connection extends LDAPUtility {
if($memcache->isAvailable()) {
$this->cache = $memcache->create();
}
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$this->doNotValidate = !in_array($this->configPrefix,
$helper->getServerConfigurationPrefixes());
$this->hasPagedResultSupport =
diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php
index 1955e7b0eea..933aee382df 100644
--- a/apps/user_ldap/lib/Helper.php
+++ b/apps/user_ldap/lib/Helper.php
@@ -30,8 +30,22 @@
namespace OCA\User_LDAP;
+use OCP\IConfig;
+
class Helper {
+ /** @var IConfig */
+ private $config;
+
+ /**
+ * Helper constructor.
+ *
+ * @param IConfig $config
+ */
+ public function __construct(IConfig $config) {
+ $this->config = $config;
+ }
+
/**
* returns prefixes for each saved LDAP/AD server configuration.
* @param bool $activeConfigurations optional, whether only active configuration shall be
@@ -251,7 +265,7 @@ class Helper {
}
//ain't it ironic?
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new LDAP();
diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php
index b91fed14dd6..e69d24dfd06 100644
--- a/apps/user_ldap/lib/Jobs/CleanUp.php
+++ b/apps/user_ldap/lib/Jobs/CleanUp.php
@@ -83,7 +83,7 @@ class CleanUp extends TimedJob {
if(isset($arguments['helper'])) {
$this->ldapHelper = $arguments['helper'];
} else {
- $this->ldapHelper = new Helper();
+ $this->ldapHelper = new Helper(\OC::$server->getConfig());
}
if(isset($arguments['ocConfig'])) {
diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php
index 3b951d20c43..b4259425fcc 100644
--- a/apps/user_ldap/lib/Jobs/UpdateGroups.php
+++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php
@@ -172,7 +172,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
if(!is_null(self::$groupBE)) {
return self::$groupBE;
}
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new LDAP();
if(count($configPrefixes) === 1) {
diff --git a/apps/user_ldap/lib/LDAPProviderFactory.php b/apps/user_ldap/lib/LDAPProviderFactory.php
index 528af001037..f2915b43163 100644
--- a/apps/user_ldap/lib/LDAPProviderFactory.php
+++ b/apps/user_ldap/lib/LDAPProviderFactory.php
@@ -52,7 +52,7 @@ class LDAPProviderFactory implements ILDAPProviderFactory {
public function getLDAPProvider() {
$dbConnection = $this->serverContainer->getDatabaseConnection();
$userMapping = new UserMapping($dbConnection);
- return new LDAPProvider($this->serverContainer, new Helper(),
+ return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()),
new DeletedUsersIndex($this->serverContainer->getConfig(),
$dbConnection, $userMapping));
}
diff --git a/apps/user_ldap/lib/Proxy.php b/apps/user_ldap/lib/Proxy.php
index db1c761656f..6b896e0b13d 100644
--- a/apps/user_ldap/lib/Proxy.php
+++ b/apps/user_ldap/lib/Proxy.php
@@ -77,7 +77,7 @@ abstract class Proxy {
$userManager =
new Manager($ocConfig, $fs, $log, $avatarM, new \OCP\Image(), $db, $coreUserManager);
$connector = new Connection($this->ldap, $configPrefix);
- $access = new Access($connector, $this->ldap, $userManager, new Helper());
+ $access = new Access($connector, $this->ldap, $userManager, new Helper(\OC::$server->getConfig()));
$access->setUserMapper($userMap);
$access->setGroupMapper($groupMap);
self::$accesses[$configPrefix] = $access;
diff --git a/apps/user_ldap/lib/Settings/Admin.php b/apps/user_ldap/lib/Settings/Admin.php
index ca7db66c788..32035128b64 100644
--- a/apps/user_ldap/lib/Settings/Admin.php
+++ b/apps/user_ldap/lib/Settings/Admin.php
@@ -45,7 +45,7 @@ class Admin implements ISettings {
* @return TemplateResponse
*/
public function getForm() {
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$prefixes = $helper->getServerConfigurationPrefixes();
$hosts = $helper->getServerConfigurationHosts();
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index 852c806b104..cdc98c72cde 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -724,7 +724,7 @@ class Wizard extends LDAPUtility {
//this did not help :(
//Let's see whether we can parse the Host URL and convert the domain to
//a base DN
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$domain = $helper->getDomainFromURL($this->configuration->ldapHost);
if(!$domain) {
return false;
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index f89af2423a9..eb660afee70 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -67,7 +67,7 @@ class AccessTest extends \Test\TestCase {
$this->createMock(Image::class),
$this->createMock(IDBConnection::class),
$this->createMock(IUserManager::class)));
- $helper = new \OCA\User_LDAP\Helper();
+ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
return array($lw, $connector, $um, $helper);
}
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 17ed5909bfb..9bda3b8ceb5 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -54,7 +54,7 @@ class Group_LDAPTest extends \Test\TestCase {
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
- $helper = new \OCA\User_LDAP\Helper();
+ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods,
array($connector, $lw, $um, $helper));
diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
index bd56494eac0..493fc2abace 100644
--- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
+++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php
@@ -113,7 +113,7 @@ abstract class AbstractIntegrationTest {
* initializes the test Helper
*/
protected function initHelper() {
- $this->helper = new Helper();
+ $this->helper = new Helper(\OC::$server->getConfig());
}
/**
diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php
index 22dfb61e5fb..585e0df662b 100644
--- a/apps/user_ldap/tests/LDAPProviderTest.php
+++ b/apps/user_ldap/tests/LDAPProviderTest.php
@@ -121,7 +121,7 @@ class LDAPProviderTest extends \Test\TestCase {
$server = $this->getServerMock($backend);
- $helper = new \OCA\User_LDAP\Helper();
+ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$ldapProvider = $this->getLDAPProvider($server);
$this->assertEquals(
@@ -137,7 +137,7 @@ class LDAPProviderTest extends \Test\TestCase {
$server = $this->getServerMock($backend);
- $helper = new \OCA\User_LDAP\Helper();
+ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$ldapProvider = $this->getLDAPProvider($server);
$this->assertEquals(
diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php
index 4ac5a14f58b..cd06b27f913 100644
--- a/apps/user_ldap/tests/Settings/AdminTest.php
+++ b/apps/user_ldap/tests/Settings/AdminTest.php
@@ -55,7 +55,7 @@ class AdminTest extends TestCase {
*/
public function testGetForm() {
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$prefixes = $helper->getServerConfigurationPrefixes();
$hosts = $helper->getServerConfigurationHosts();
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 6e6e2ad66b1..121b1102653 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -81,7 +81,7 @@ class UserTest extends \Test\TestCase {
$umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr));
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods, array($lw, null, null));
- $helper = new \OCA\User_LDAP\Helper();
+ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods, array($connector, $lw, $um, $helper));
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index 5859e51ec66..05837097929 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -97,7 +97,7 @@ class User_LDAPTest extends TestCase {
->method('getDeletedUser')
->will($this->returnValue($offlineUser));
- $helper = new Helper();
+ $helper = new Helper(\OC::$server->getConfig());
$access = $this->getMockBuilder(Access::class)
->setMethodsExcept(['getConnection'])
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index 3aefa8779a2..af3b692c7dd 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -70,7 +70,7 @@ class WizardTest extends \Test\TestCase {
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
- $helper = new \OCA\User_LDAP\Helper();
+ $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods, array($connector, $lw, $um, $helper));