summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorJuan Pablo Villafáñez <jvillafanez@solidgear.es>2017-04-19 19:05:27 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-04-27 15:57:25 +0200
commita9a80f95e3599cbe95c799f5c3c3073a9f7ddedf (patch)
tree64eec195075ae80b99fc9aade0d6318e91d2adb4 /apps/user_ldap
parent3e37a5f1c742eae03158a14f6dbb1fc3bb1e0a5a (diff)
downloadnextcloud-server-a9a80f95e3599cbe95c799f5c3c3073a9f7ddedf.tar.gz
nextcloud-server-a9a80f95e3599cbe95c799f5c3c3073a9f7ddedf.zip
Use proxy classes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/appinfo/app.php40
1 files changed, 10 insertions, 30 deletions
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index cbdcafc58d6..70e505c18af 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -29,46 +29,26 @@
$helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
-$ldapWrapper = new OCA\User_LDAP\LDAP();
-$ocConfig = \OC::$server->getConfig();
-$notificationManager = \OC::$server->getNotificationManager();
-$notificationManager->registerNotifier(function() {
- return new \OCA\User_LDAP\Notification\Notifier(
- \OC::$server->getL10NFactory()
- );
-}, function() {
+if(count($configPrefixes) > 0) {
+ $ldapWrapper = new OCA\User_LDAP\LDAP();
+ $ocConfig = \OC::$server->getConfig();
+ $notificationManager = \OC::$server->getNotificationManager();
+ $notificationManager->registerNotifier(function() {
+ return new \OCA\User_LDAP\Notification\Notifier(
+ \OC::$server->getL10NFactory()
+ );
+ }, function() {
$l = \OC::$server->getL10N('user_ldap');
return [
'id' => 'user_ldap',
'name' => $l->t('LDAP user and group backend'),
];
-});
-if(count($configPrefixes) === 1) {
- $dbc = \OC::$server->getDatabaseConnection();
- $userManager = new OCA\User_LDAP\User\Manager($ocConfig,
- new OCA\User_LDAP\FilesystemHelper(),
- new OCA\User_LDAP\LogWrapper(),
- \OC::$server->getAvatarManager(),
- new \OCP\Image(),
- $dbc,
- \OC::$server->getUserManager(),
- $notificationManager
- );
- $connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]);
- $ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager, $helper);
+ });
- $ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc));
- $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc));
- $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig, $notificationManager);
- $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess);
-} else if(count($configPrefixes) > 1) {
$userBackend = new OCA\User_LDAP\User_Proxy(
$configPrefixes, $ldapWrapper, $ocConfig, $notificationManager
);
$groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper);
-}
-
-if(count($configPrefixes) > 0) {
// register user backend
OC_User::useBackend($userBackend);
\OC::$server->getGroupManager()->addBackend($groupBackend);