|
29 | 29 |
|
30 | 30 | $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); |
31 | 31 | $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
32 | | -$ldapWrapper = new OCA\User_LDAP\LDAP(); |
33 | | -$ocConfig = \OC::$server->getConfig(); |
34 | | -$notificationManager = \OC::$server->getNotificationManager(); |
35 | | -$notificationManager->registerNotifier(function() { |
36 | | - return new \OCA\User_LDAP\Notification\Notifier( |
37 | | - \OC::$server->getL10NFactory() |
38 | | - ); |
39 | | -}, function() { |
| 32 | +if(count($configPrefixes) > 0) { |
| 33 | + $ldapWrapper = new OCA\User_LDAP\LDAP(); |
| 34 | + $ocConfig = \OC::$server->getConfig(); |
| 35 | + $notificationManager = \OC::$server->getNotificationManager(); |
| 36 | + $notificationManager->registerNotifier(function() { |
| 37 | + return new \OCA\User_LDAP\Notification\Notifier( |
| 38 | + \OC::$server->getL10NFactory() |
| 39 | + ); |
| 40 | + }, function() { |
40 | 41 | $l = \OC::$server->getL10N('user_ldap'); |
41 | 42 | return [ |
42 | 43 | 'id' => 'user_ldap', |
43 | 44 | 'name' => $l->t('LDAP user and group backend'), |
44 | 45 | ]; |
45 | | -}); |
46 | | -if(count($configPrefixes) === 1) { |
47 | | - $dbc = \OC::$server->getDatabaseConnection(); |
48 | | - $userManager = new OCA\User_LDAP\User\Manager($ocConfig, |
49 | | - new OCA\User_LDAP\FilesystemHelper(), |
50 | | - new OCA\User_LDAP\LogWrapper(), |
51 | | - \OC::$server->getAvatarManager(), |
52 | | - new \OCP\Image(), |
53 | | - $dbc, |
54 | | - \OC::$server->getUserManager(), |
55 | | - $notificationManager |
56 | | - ); |
57 | | - $connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]); |
58 | | - $ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager, $helper); |
| 46 | + }); |
59 | 47 |
|
60 | | - $ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc)); |
61 | | - $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc)); |
62 | | - $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig, $notificationManager); |
63 | | - $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess); |
64 | | -} else if(count($configPrefixes) > 1) { |
65 | 48 | $userBackend = new OCA\User_LDAP\User_Proxy( |
66 | 49 | $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager |
67 | 50 | ); |
68 | 51 | $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
69 | | -} |
70 | | - |
71 | | -if(count($configPrefixes) > 0) { |
72 | 52 | // register user backend |
73 | 53 | OC_User::useBackend($userBackend); |
74 | 54 | \OC::$server->getGroupManager()->addBackend($groupBackend); |
|
0 commit comments