summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/jobs.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/jobs.php')
-rw-r--r--apps/user_ldap/lib/jobs.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/apps/user_ldap/lib/jobs.php b/apps/user_ldap/lib/jobs.php
index 60ecc0da33d..d626afed6c3 100644
--- a/apps/user_ldap/lib/jobs.php
+++ b/apps/user_ldap/lib/jobs.php
@@ -134,21 +134,19 @@ class Jobs extends \OC\BackgroundJob\TimedJob {
\OCP\Util::DEBUG);
}
- static private function getConnector() {
- if(!is_null(self::$connector)) {
- return self::$connector;
- }
- self::$connector = new \OCA\user_ldap\lib\Connection('user_ldap');
- return self::$connector;
- }
-
static private function getGroupBE() {
if(!is_null(self::$groupBE)) {
return self::$groupBE;
}
- self::getConnector();
- self::$groupBE = new \OCA\user_ldap\GROUP_LDAP();
- self::$groupBE->setConnector(self::$connector);
+ $configPrefixes = Helper::getServerConfigurationPrefixes(true);
+ if(count($configPrefixes) == 1) {
+ //avoid the proxy when there is only one LDAP server configured
+ $connector = new Connection($configPrefixes[0]);
+ self::$groupBE = new \OCA\user_ldap\GROUP_LDAP();
+ self::$groupBE->setConnector($connector);
+ } else {
+ self::$groupBE = new \OCA\user_ldap\Group_Proxy($configPrefixes);
+ }
return self::$groupBE;
}