@@ -6,81 +6,81 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitUser_LDAP |
| 8 | 8 | { |
| 9 | - public static $firstCharsPsr4 = array ( |
|
| 9 | + public static $firstCharsPsr4 = array( |
|
| 10 | 10 | 'O' => true, |
| 11 | 11 | ); |
| 12 | 12 | |
| 13 | - public static $prefixDirsPsr4 = array ( |
|
| 13 | + public static $prefixDirsPsr4 = array( |
|
| 14 | 14 | 'OCA\\User_LDAP\\' => |
| 15 | - array ( |
|
| 16 | - 0 => __DIR__ . '/..' . '/../lib', |
|
| 15 | + array( |
|
| 16 | + 0 => __DIR__.'/..'.'/../lib', |
|
| 17 | 17 | ), |
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | - public static $classMap = array ( |
|
| 21 | - 'OCA\\User_LDAP\\Access' => __DIR__ . '/..' . '/../lib/Access.php', |
|
| 22 | - 'OCA\\User_LDAP\\AccessFactory' => __DIR__ . '/..' . '/../lib/AccessFactory.php', |
|
| 23 | - 'OCA\\User_LDAP\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
| 24 | - 'OCA\\User_LDAP\\BackendUtility' => __DIR__ . '/..' . '/../lib/BackendUtility.php', |
|
| 25 | - 'OCA\\User_LDAP\\Command\\CheckUser' => __DIR__ . '/..' . '/../lib/Command/CheckUser.php', |
|
| 26 | - 'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => __DIR__ . '/..' . '/../lib/Command/CreateEmptyConfig.php', |
|
| 27 | - 'OCA\\User_LDAP\\Command\\DeleteConfig' => __DIR__ . '/..' . '/../lib/Command/DeleteConfig.php', |
|
| 28 | - 'OCA\\User_LDAP\\Command\\Search' => __DIR__ . '/..' . '/../lib/Command/Search.php', |
|
| 29 | - 'OCA\\User_LDAP\\Command\\SetConfig' => __DIR__ . '/..' . '/../lib/Command/SetConfig.php', |
|
| 30 | - 'OCA\\User_LDAP\\Command\\ShowConfig' => __DIR__ . '/..' . '/../lib/Command/ShowConfig.php', |
|
| 31 | - 'OCA\\User_LDAP\\Command\\ShowRemnants' => __DIR__ . '/..' . '/../lib/Command/ShowRemnants.php', |
|
| 32 | - 'OCA\\User_LDAP\\Command\\TestConfig' => __DIR__ . '/..' . '/../lib/Command/TestConfig.php', |
|
| 33 | - 'OCA\\User_LDAP\\Configuration' => __DIR__ . '/..' . '/../lib/Configuration.php', |
|
| 34 | - 'OCA\\User_LDAP\\Connection' => __DIR__ . '/..' . '/../lib/Connection.php', |
|
| 35 | - 'OCA\\User_LDAP\\ConnectionFactory' => __DIR__ . '/..' . '/../lib/ConnectionFactory.php', |
|
| 36 | - 'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__ . '/..' . '/../lib/Controller/ConfigAPIController.php', |
|
| 37 | - 'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__ . '/..' . '/../lib/Controller/RenewPasswordController.php', |
|
| 38 | - 'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__ . '/..' . '/../lib/Exceptions/ConstraintViolationException.php', |
|
| 39 | - 'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__ . '/..' . '/../lib/Exceptions/NotOnLDAP.php', |
|
| 40 | - 'OCA\\User_LDAP\\FilesystemHelper' => __DIR__ . '/..' . '/../lib/FilesystemHelper.php', |
|
| 41 | - 'OCA\\User_LDAP\\GroupPluginManager' => __DIR__ . '/..' . '/../lib/GroupPluginManager.php', |
|
| 42 | - 'OCA\\User_LDAP\\Group_LDAP' => __DIR__ . '/..' . '/../lib/Group_LDAP.php', |
|
| 43 | - 'OCA\\User_LDAP\\Group_Proxy' => __DIR__ . '/..' . '/../lib/Group_Proxy.php', |
|
| 44 | - 'OCA\\User_LDAP\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php', |
|
| 45 | - 'OCA\\User_LDAP\\IGroupLDAP' => __DIR__ . '/..' . '/../lib/IGroupLDAP.php', |
|
| 46 | - 'OCA\\User_LDAP\\ILDAPGroupPlugin' => __DIR__ . '/..' . '/../lib/ILDAPGroupPlugin.php', |
|
| 47 | - 'OCA\\User_LDAP\\ILDAPUserPlugin' => __DIR__ . '/..' . '/../lib/ILDAPUserPlugin.php', |
|
| 48 | - 'OCA\\User_LDAP\\ILDAPWrapper' => __DIR__ . '/..' . '/../lib/ILDAPWrapper.php', |
|
| 49 | - 'OCA\\User_LDAP\\IUserLDAP' => __DIR__ . '/..' . '/../lib/IUserLDAP.php', |
|
| 50 | - 'OCA\\User_LDAP\\Jobs\\CleanUp' => __DIR__ . '/..' . '/../lib/Jobs/CleanUp.php', |
|
| 51 | - 'OCA\\User_LDAP\\Jobs\\Sync' => __DIR__ . '/..' . '/../lib/Jobs/Sync.php', |
|
| 52 | - 'OCA\\User_LDAP\\Jobs\\UpdateGroups' => __DIR__ . '/..' . '/../lib/Jobs/UpdateGroups.php', |
|
| 53 | - 'OCA\\User_LDAP\\LDAP' => __DIR__ . '/..' . '/../lib/LDAP.php', |
|
| 54 | - 'OCA\\User_LDAP\\LDAPProvider' => __DIR__ . '/..' . '/../lib/LDAPProvider.php', |
|
| 55 | - 'OCA\\User_LDAP\\LDAPProviderFactory' => __DIR__ . '/..' . '/../lib/LDAPProviderFactory.php', |
|
| 56 | - 'OCA\\User_LDAP\\LDAPUtility' => __DIR__ . '/..' . '/../lib/LDAPUtility.php', |
|
| 57 | - 'OCA\\User_LDAP\\LogWrapper' => __DIR__ . '/..' . '/../lib/LogWrapper.php', |
|
| 58 | - 'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__ . '/..' . '/../lib/Mapping/AbstractMapping.php', |
|
| 59 | - 'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__ . '/..' . '/../lib/Mapping/GroupMapping.php', |
|
| 60 | - 'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__ . '/..' . '/../lib/Mapping/UserMapping.php', |
|
| 61 | - 'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__ . '/..' . '/../lib/Migration/UUIDFix.php', |
|
| 62 | - 'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixGroup.php', |
|
| 63 | - 'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixInsert.php', |
|
| 64 | - 'OCA\\User_LDAP\\Migration\\UUIDFixUser' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixUser.php', |
|
| 65 | - 'OCA\\User_LDAP\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php', |
|
| 66 | - 'OCA\\User_LDAP\\Proxy' => __DIR__ . '/..' . '/../lib/Proxy.php', |
|
| 67 | - 'OCA\\User_LDAP\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php', |
|
| 68 | - 'OCA\\User_LDAP\\Settings\\Section' => __DIR__ . '/..' . '/../lib/Settings/Section.php', |
|
| 69 | - 'OCA\\User_LDAP\\UserPluginManager' => __DIR__ . '/..' . '/../lib/UserPluginManager.php', |
|
| 70 | - 'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__ . '/..' . '/../lib/User/DeletedUsersIndex.php', |
|
| 71 | - 'OCA\\User_LDAP\\User\\IUserTools' => __DIR__ . '/..' . '/../lib/User/IUserTools.php', |
|
| 72 | - 'OCA\\User_LDAP\\User\\Manager' => __DIR__ . '/..' . '/../lib/User/Manager.php', |
|
| 73 | - 'OCA\\User_LDAP\\User\\OfflineUser' => __DIR__ . '/..' . '/../lib/User/OfflineUser.php', |
|
| 74 | - 'OCA\\User_LDAP\\User\\User' => __DIR__ . '/..' . '/../lib/User/User.php', |
|
| 75 | - 'OCA\\User_LDAP\\User_LDAP' => __DIR__ . '/..' . '/../lib/User_LDAP.php', |
|
| 76 | - 'OCA\\User_LDAP\\User_Proxy' => __DIR__ . '/..' . '/../lib/User_Proxy.php', |
|
| 77 | - 'OCA\\User_LDAP\\Wizard' => __DIR__ . '/..' . '/../lib/Wizard.php', |
|
| 78 | - 'OCA\\User_LDAP\\WizardResult' => __DIR__ . '/..' . '/../lib/WizardResult.php', |
|
| 20 | + public static $classMap = array( |
|
| 21 | + 'OCA\\User_LDAP\\Access' => __DIR__.'/..'.'/../lib/Access.php', |
|
| 22 | + 'OCA\\User_LDAP\\AccessFactory' => __DIR__.'/..'.'/../lib/AccessFactory.php', |
|
| 23 | + 'OCA\\User_LDAP\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
| 24 | + 'OCA\\User_LDAP\\BackendUtility' => __DIR__.'/..'.'/../lib/BackendUtility.php', |
|
| 25 | + 'OCA\\User_LDAP\\Command\\CheckUser' => __DIR__.'/..'.'/../lib/Command/CheckUser.php', |
|
| 26 | + 'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => __DIR__.'/..'.'/../lib/Command/CreateEmptyConfig.php', |
|
| 27 | + 'OCA\\User_LDAP\\Command\\DeleteConfig' => __DIR__.'/..'.'/../lib/Command/DeleteConfig.php', |
|
| 28 | + 'OCA\\User_LDAP\\Command\\Search' => __DIR__.'/..'.'/../lib/Command/Search.php', |
|
| 29 | + 'OCA\\User_LDAP\\Command\\SetConfig' => __DIR__.'/..'.'/../lib/Command/SetConfig.php', |
|
| 30 | + 'OCA\\User_LDAP\\Command\\ShowConfig' => __DIR__.'/..'.'/../lib/Command/ShowConfig.php', |
|
| 31 | + 'OCA\\User_LDAP\\Command\\ShowRemnants' => __DIR__.'/..'.'/../lib/Command/ShowRemnants.php', |
|
| 32 | + 'OCA\\User_LDAP\\Command\\TestConfig' => __DIR__.'/..'.'/../lib/Command/TestConfig.php', |
|
| 33 | + 'OCA\\User_LDAP\\Configuration' => __DIR__.'/..'.'/../lib/Configuration.php', |
|
| 34 | + 'OCA\\User_LDAP\\Connection' => __DIR__.'/..'.'/../lib/Connection.php', |
|
| 35 | + 'OCA\\User_LDAP\\ConnectionFactory' => __DIR__.'/..'.'/../lib/ConnectionFactory.php', |
|
| 36 | + 'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__.'/..'.'/../lib/Controller/ConfigAPIController.php', |
|
| 37 | + 'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__.'/..'.'/../lib/Controller/RenewPasswordController.php', |
|
| 38 | + 'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__.'/..'.'/../lib/Exceptions/ConstraintViolationException.php', |
|
| 39 | + 'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__.'/..'.'/../lib/Exceptions/NotOnLDAP.php', |
|
| 40 | + 'OCA\\User_LDAP\\FilesystemHelper' => __DIR__.'/..'.'/../lib/FilesystemHelper.php', |
|
| 41 | + 'OCA\\User_LDAP\\GroupPluginManager' => __DIR__.'/..'.'/../lib/GroupPluginManager.php', |
|
| 42 | + 'OCA\\User_LDAP\\Group_LDAP' => __DIR__.'/..'.'/../lib/Group_LDAP.php', |
|
| 43 | + 'OCA\\User_LDAP\\Group_Proxy' => __DIR__.'/..'.'/../lib/Group_Proxy.php', |
|
| 44 | + 'OCA\\User_LDAP\\Helper' => __DIR__.'/..'.'/../lib/Helper.php', |
|
| 45 | + 'OCA\\User_LDAP\\IGroupLDAP' => __DIR__.'/..'.'/../lib/IGroupLDAP.php', |
|
| 46 | + 'OCA\\User_LDAP\\ILDAPGroupPlugin' => __DIR__.'/..'.'/../lib/ILDAPGroupPlugin.php', |
|
| 47 | + 'OCA\\User_LDAP\\ILDAPUserPlugin' => __DIR__.'/..'.'/../lib/ILDAPUserPlugin.php', |
|
| 48 | + 'OCA\\User_LDAP\\ILDAPWrapper' => __DIR__.'/..'.'/../lib/ILDAPWrapper.php', |
|
| 49 | + 'OCA\\User_LDAP\\IUserLDAP' => __DIR__.'/..'.'/../lib/IUserLDAP.php', |
|
| 50 | + 'OCA\\User_LDAP\\Jobs\\CleanUp' => __DIR__.'/..'.'/../lib/Jobs/CleanUp.php', |
|
| 51 | + 'OCA\\User_LDAP\\Jobs\\Sync' => __DIR__.'/..'.'/../lib/Jobs/Sync.php', |
|
| 52 | + 'OCA\\User_LDAP\\Jobs\\UpdateGroups' => __DIR__.'/..'.'/../lib/Jobs/UpdateGroups.php', |
|
| 53 | + 'OCA\\User_LDAP\\LDAP' => __DIR__.'/..'.'/../lib/LDAP.php', |
|
| 54 | + 'OCA\\User_LDAP\\LDAPProvider' => __DIR__.'/..'.'/../lib/LDAPProvider.php', |
|
| 55 | + 'OCA\\User_LDAP\\LDAPProviderFactory' => __DIR__.'/..'.'/../lib/LDAPProviderFactory.php', |
|
| 56 | + 'OCA\\User_LDAP\\LDAPUtility' => __DIR__.'/..'.'/../lib/LDAPUtility.php', |
|
| 57 | + 'OCA\\User_LDAP\\LogWrapper' => __DIR__.'/..'.'/../lib/LogWrapper.php', |
|
| 58 | + 'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__.'/..'.'/../lib/Mapping/AbstractMapping.php', |
|
| 59 | + 'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__.'/..'.'/../lib/Mapping/GroupMapping.php', |
|
| 60 | + 'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__.'/..'.'/../lib/Mapping/UserMapping.php', |
|
| 61 | + 'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__.'/..'.'/../lib/Migration/UUIDFix.php', |
|
| 62 | + 'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__.'/..'.'/../lib/Migration/UUIDFixGroup.php', |
|
| 63 | + 'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__.'/..'.'/../lib/Migration/UUIDFixInsert.php', |
|
| 64 | + 'OCA\\User_LDAP\\Migration\\UUIDFixUser' => __DIR__.'/..'.'/../lib/Migration/UUIDFixUser.php', |
|
| 65 | + 'OCA\\User_LDAP\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php', |
|
| 66 | + 'OCA\\User_LDAP\\Proxy' => __DIR__.'/..'.'/../lib/Proxy.php', |
|
| 67 | + 'OCA\\User_LDAP\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php', |
|
| 68 | + 'OCA\\User_LDAP\\Settings\\Section' => __DIR__.'/..'.'/../lib/Settings/Section.php', |
|
| 69 | + 'OCA\\User_LDAP\\UserPluginManager' => __DIR__.'/..'.'/../lib/UserPluginManager.php', |
|
| 70 | + 'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__.'/..'.'/../lib/User/DeletedUsersIndex.php', |
|
| 71 | + 'OCA\\User_LDAP\\User\\IUserTools' => __DIR__.'/..'.'/../lib/User/IUserTools.php', |
|
| 72 | + 'OCA\\User_LDAP\\User\\Manager' => __DIR__.'/..'.'/../lib/User/Manager.php', |
|
| 73 | + 'OCA\\User_LDAP\\User\\OfflineUser' => __DIR__.'/..'.'/../lib/User/OfflineUser.php', |
|
| 74 | + 'OCA\\User_LDAP\\User\\User' => __DIR__.'/..'.'/../lib/User/User.php', |
|
| 75 | + 'OCA\\User_LDAP\\User_LDAP' => __DIR__.'/..'.'/../lib/User_LDAP.php', |
|
| 76 | + 'OCA\\User_LDAP\\User_Proxy' => __DIR__.'/..'.'/../lib/User_Proxy.php', |
|
| 77 | + 'OCA\\User_LDAP\\Wizard' => __DIR__.'/..'.'/../lib/Wizard.php', |
|
| 78 | + 'OCA\\User_LDAP\\WizardResult' => __DIR__.'/..'.'/../lib/WizardResult.php', |
|
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | public static function getInitializer(ClassLoader $loader) |
| 82 | 82 | { |
| 83 | - return \Closure::bind(function () use ($loader) { |
|
| 83 | + return \Closure::bind(function() use ($loader) { |
|
| 84 | 84 | $loader->firstCharsPsr4 = ComposerStaticInitUser_LDAP::$firstCharsPsr4; |
| 85 | 85 | $loader->prefixDirsPsr4 = ComposerStaticInitUser_LDAP::$prefixDirsPsr4; |
| 86 | 86 | $loader->classMap = ComposerStaticInitUser_LDAP::$classMap; |
@@ -6,62 +6,62 @@ |
||
| 6 | 6 | $baseDir = $vendorDir; |
| 7 | 7 | |
| 8 | 8 | return array( |
| 9 | - 'OCA\\User_LDAP\\Access' => $baseDir . '/../lib/Access.php', |
|
| 10 | - 'OCA\\User_LDAP\\AccessFactory' => $baseDir . '/../lib/AccessFactory.php', |
|
| 11 | - 'OCA\\User_LDAP\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
| 12 | - 'OCA\\User_LDAP\\BackendUtility' => $baseDir . '/../lib/BackendUtility.php', |
|
| 13 | - 'OCA\\User_LDAP\\Command\\CheckUser' => $baseDir . '/../lib/Command/CheckUser.php', |
|
| 14 | - 'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => $baseDir . '/../lib/Command/CreateEmptyConfig.php', |
|
| 15 | - 'OCA\\User_LDAP\\Command\\DeleteConfig' => $baseDir . '/../lib/Command/DeleteConfig.php', |
|
| 16 | - 'OCA\\User_LDAP\\Command\\Search' => $baseDir . '/../lib/Command/Search.php', |
|
| 17 | - 'OCA\\User_LDAP\\Command\\SetConfig' => $baseDir . '/../lib/Command/SetConfig.php', |
|
| 18 | - 'OCA\\User_LDAP\\Command\\ShowConfig' => $baseDir . '/../lib/Command/ShowConfig.php', |
|
| 19 | - 'OCA\\User_LDAP\\Command\\ShowRemnants' => $baseDir . '/../lib/Command/ShowRemnants.php', |
|
| 20 | - 'OCA\\User_LDAP\\Command\\TestConfig' => $baseDir . '/../lib/Command/TestConfig.php', |
|
| 21 | - 'OCA\\User_LDAP\\Configuration' => $baseDir . '/../lib/Configuration.php', |
|
| 22 | - 'OCA\\User_LDAP\\Connection' => $baseDir . '/../lib/Connection.php', |
|
| 23 | - 'OCA\\User_LDAP\\ConnectionFactory' => $baseDir . '/../lib/ConnectionFactory.php', |
|
| 24 | - 'OCA\\User_LDAP\\Controller\\ConfigAPIController' => $baseDir . '/../lib/Controller/ConfigAPIController.php', |
|
| 25 | - 'OCA\\User_LDAP\\Controller\\RenewPasswordController' => $baseDir . '/../lib/Controller/RenewPasswordController.php', |
|
| 26 | - 'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir . '/../lib/Exceptions/ConstraintViolationException.php', |
|
| 27 | - 'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir . '/../lib/Exceptions/NotOnLDAP.php', |
|
| 28 | - 'OCA\\User_LDAP\\FilesystemHelper' => $baseDir . '/../lib/FilesystemHelper.php', |
|
| 29 | - 'OCA\\User_LDAP\\GroupPluginManager' => $baseDir . '/../lib/GroupPluginManager.php', |
|
| 30 | - 'OCA\\User_LDAP\\Group_LDAP' => $baseDir . '/../lib/Group_LDAP.php', |
|
| 31 | - 'OCA\\User_LDAP\\Group_Proxy' => $baseDir . '/../lib/Group_Proxy.php', |
|
| 32 | - 'OCA\\User_LDAP\\Helper' => $baseDir . '/../lib/Helper.php', |
|
| 33 | - 'OCA\\User_LDAP\\IGroupLDAP' => $baseDir . '/../lib/IGroupLDAP.php', |
|
| 34 | - 'OCA\\User_LDAP\\ILDAPGroupPlugin' => $baseDir . '/../lib/ILDAPGroupPlugin.php', |
|
| 35 | - 'OCA\\User_LDAP\\ILDAPUserPlugin' => $baseDir . '/../lib/ILDAPUserPlugin.php', |
|
| 36 | - 'OCA\\User_LDAP\\ILDAPWrapper' => $baseDir . '/../lib/ILDAPWrapper.php', |
|
| 37 | - 'OCA\\User_LDAP\\IUserLDAP' => $baseDir . '/../lib/IUserLDAP.php', |
|
| 38 | - 'OCA\\User_LDAP\\Jobs\\CleanUp' => $baseDir . '/../lib/Jobs/CleanUp.php', |
|
| 39 | - 'OCA\\User_LDAP\\Jobs\\Sync' => $baseDir . '/../lib/Jobs/Sync.php', |
|
| 40 | - 'OCA\\User_LDAP\\Jobs\\UpdateGroups' => $baseDir . '/../lib/Jobs/UpdateGroups.php', |
|
| 41 | - 'OCA\\User_LDAP\\LDAP' => $baseDir . '/../lib/LDAP.php', |
|
| 42 | - 'OCA\\User_LDAP\\LDAPProvider' => $baseDir . '/../lib/LDAPProvider.php', |
|
| 43 | - 'OCA\\User_LDAP\\LDAPProviderFactory' => $baseDir . '/../lib/LDAPProviderFactory.php', |
|
| 44 | - 'OCA\\User_LDAP\\LDAPUtility' => $baseDir . '/../lib/LDAPUtility.php', |
|
| 45 | - 'OCA\\User_LDAP\\LogWrapper' => $baseDir . '/../lib/LogWrapper.php', |
|
| 46 | - 'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir . '/../lib/Mapping/AbstractMapping.php', |
|
| 47 | - 'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir . '/../lib/Mapping/GroupMapping.php', |
|
| 48 | - 'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir . '/../lib/Mapping/UserMapping.php', |
|
| 49 | - 'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir . '/../lib/Migration/UUIDFix.php', |
|
| 50 | - 'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir . '/../lib/Migration/UUIDFixGroup.php', |
|
| 51 | - 'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir . '/../lib/Migration/UUIDFixInsert.php', |
|
| 52 | - 'OCA\\User_LDAP\\Migration\\UUIDFixUser' => $baseDir . '/../lib/Migration/UUIDFixUser.php', |
|
| 53 | - 'OCA\\User_LDAP\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php', |
|
| 54 | - 'OCA\\User_LDAP\\Proxy' => $baseDir . '/../lib/Proxy.php', |
|
| 55 | - 'OCA\\User_LDAP\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php', |
|
| 56 | - 'OCA\\User_LDAP\\Settings\\Section' => $baseDir . '/../lib/Settings/Section.php', |
|
| 57 | - 'OCA\\User_LDAP\\UserPluginManager' => $baseDir . '/../lib/UserPluginManager.php', |
|
| 58 | - 'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir . '/../lib/User/DeletedUsersIndex.php', |
|
| 59 | - 'OCA\\User_LDAP\\User\\IUserTools' => $baseDir . '/../lib/User/IUserTools.php', |
|
| 60 | - 'OCA\\User_LDAP\\User\\Manager' => $baseDir . '/../lib/User/Manager.php', |
|
| 61 | - 'OCA\\User_LDAP\\User\\OfflineUser' => $baseDir . '/../lib/User/OfflineUser.php', |
|
| 62 | - 'OCA\\User_LDAP\\User\\User' => $baseDir . '/../lib/User/User.php', |
|
| 63 | - 'OCA\\User_LDAP\\User_LDAP' => $baseDir . '/../lib/User_LDAP.php', |
|
| 64 | - 'OCA\\User_LDAP\\User_Proxy' => $baseDir . '/../lib/User_Proxy.php', |
|
| 65 | - 'OCA\\User_LDAP\\Wizard' => $baseDir . '/../lib/Wizard.php', |
|
| 66 | - 'OCA\\User_LDAP\\WizardResult' => $baseDir . '/../lib/WizardResult.php', |
|
| 9 | + 'OCA\\User_LDAP\\Access' => $baseDir.'/../lib/Access.php', |
|
| 10 | + 'OCA\\User_LDAP\\AccessFactory' => $baseDir.'/../lib/AccessFactory.php', |
|
| 11 | + 'OCA\\User_LDAP\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
| 12 | + 'OCA\\User_LDAP\\BackendUtility' => $baseDir.'/../lib/BackendUtility.php', |
|
| 13 | + 'OCA\\User_LDAP\\Command\\CheckUser' => $baseDir.'/../lib/Command/CheckUser.php', |
|
| 14 | + 'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => $baseDir.'/../lib/Command/CreateEmptyConfig.php', |
|
| 15 | + 'OCA\\User_LDAP\\Command\\DeleteConfig' => $baseDir.'/../lib/Command/DeleteConfig.php', |
|
| 16 | + 'OCA\\User_LDAP\\Command\\Search' => $baseDir.'/../lib/Command/Search.php', |
|
| 17 | + 'OCA\\User_LDAP\\Command\\SetConfig' => $baseDir.'/../lib/Command/SetConfig.php', |
|
| 18 | + 'OCA\\User_LDAP\\Command\\ShowConfig' => $baseDir.'/../lib/Command/ShowConfig.php', |
|
| 19 | + 'OCA\\User_LDAP\\Command\\ShowRemnants' => $baseDir.'/../lib/Command/ShowRemnants.php', |
|
| 20 | + 'OCA\\User_LDAP\\Command\\TestConfig' => $baseDir.'/../lib/Command/TestConfig.php', |
|
| 21 | + 'OCA\\User_LDAP\\Configuration' => $baseDir.'/../lib/Configuration.php', |
|
| 22 | + 'OCA\\User_LDAP\\Connection' => $baseDir.'/../lib/Connection.php', |
|
| 23 | + 'OCA\\User_LDAP\\ConnectionFactory' => $baseDir.'/../lib/ConnectionFactory.php', |
|
| 24 | + 'OCA\\User_LDAP\\Controller\\ConfigAPIController' => $baseDir.'/../lib/Controller/ConfigAPIController.php', |
|
| 25 | + 'OCA\\User_LDAP\\Controller\\RenewPasswordController' => $baseDir.'/../lib/Controller/RenewPasswordController.php', |
|
| 26 | + 'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir.'/../lib/Exceptions/ConstraintViolationException.php', |
|
| 27 | + 'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir.'/../lib/Exceptions/NotOnLDAP.php', |
|
| 28 | + 'OCA\\User_LDAP\\FilesystemHelper' => $baseDir.'/../lib/FilesystemHelper.php', |
|
| 29 | + 'OCA\\User_LDAP\\GroupPluginManager' => $baseDir.'/../lib/GroupPluginManager.php', |
|
| 30 | + 'OCA\\User_LDAP\\Group_LDAP' => $baseDir.'/../lib/Group_LDAP.php', |
|
| 31 | + 'OCA\\User_LDAP\\Group_Proxy' => $baseDir.'/../lib/Group_Proxy.php', |
|
| 32 | + 'OCA\\User_LDAP\\Helper' => $baseDir.'/../lib/Helper.php', |
|
| 33 | + 'OCA\\User_LDAP\\IGroupLDAP' => $baseDir.'/../lib/IGroupLDAP.php', |
|
| 34 | + 'OCA\\User_LDAP\\ILDAPGroupPlugin' => $baseDir.'/../lib/ILDAPGroupPlugin.php', |
|
| 35 | + 'OCA\\User_LDAP\\ILDAPUserPlugin' => $baseDir.'/../lib/ILDAPUserPlugin.php', |
|
| 36 | + 'OCA\\User_LDAP\\ILDAPWrapper' => $baseDir.'/../lib/ILDAPWrapper.php', |
|
| 37 | + 'OCA\\User_LDAP\\IUserLDAP' => $baseDir.'/../lib/IUserLDAP.php', |
|
| 38 | + 'OCA\\User_LDAP\\Jobs\\CleanUp' => $baseDir.'/../lib/Jobs/CleanUp.php', |
|
| 39 | + 'OCA\\User_LDAP\\Jobs\\Sync' => $baseDir.'/../lib/Jobs/Sync.php', |
|
| 40 | + 'OCA\\User_LDAP\\Jobs\\UpdateGroups' => $baseDir.'/../lib/Jobs/UpdateGroups.php', |
|
| 41 | + 'OCA\\User_LDAP\\LDAP' => $baseDir.'/../lib/LDAP.php', |
|
| 42 | + 'OCA\\User_LDAP\\LDAPProvider' => $baseDir.'/../lib/LDAPProvider.php', |
|
| 43 | + 'OCA\\User_LDAP\\LDAPProviderFactory' => $baseDir.'/../lib/LDAPProviderFactory.php', |
|
| 44 | + 'OCA\\User_LDAP\\LDAPUtility' => $baseDir.'/../lib/LDAPUtility.php', |
|
| 45 | + 'OCA\\User_LDAP\\LogWrapper' => $baseDir.'/../lib/LogWrapper.php', |
|
| 46 | + 'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir.'/../lib/Mapping/AbstractMapping.php', |
|
| 47 | + 'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir.'/../lib/Mapping/GroupMapping.php', |
|
| 48 | + 'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir.'/../lib/Mapping/UserMapping.php', |
|
| 49 | + 'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir.'/../lib/Migration/UUIDFix.php', |
|
| 50 | + 'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir.'/../lib/Migration/UUIDFixGroup.php', |
|
| 51 | + 'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir.'/../lib/Migration/UUIDFixInsert.php', |
|
| 52 | + 'OCA\\User_LDAP\\Migration\\UUIDFixUser' => $baseDir.'/../lib/Migration/UUIDFixUser.php', |
|
| 53 | + 'OCA\\User_LDAP\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php', |
|
| 54 | + 'OCA\\User_LDAP\\Proxy' => $baseDir.'/../lib/Proxy.php', |
|
| 55 | + 'OCA\\User_LDAP\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php', |
|
| 56 | + 'OCA\\User_LDAP\\Settings\\Section' => $baseDir.'/../lib/Settings/Section.php', |
|
| 57 | + 'OCA\\User_LDAP\\UserPluginManager' => $baseDir.'/../lib/UserPluginManager.php', |
|
| 58 | + 'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir.'/../lib/User/DeletedUsersIndex.php', |
|
| 59 | + 'OCA\\User_LDAP\\User\\IUserTools' => $baseDir.'/../lib/User/IUserTools.php', |
|
| 60 | + 'OCA\\User_LDAP\\User\\Manager' => $baseDir.'/../lib/User/Manager.php', |
|
| 61 | + 'OCA\\User_LDAP\\User\\OfflineUser' => $baseDir.'/../lib/User/OfflineUser.php', |
|
| 62 | + 'OCA\\User_LDAP\\User\\User' => $baseDir.'/../lib/User/User.php', |
|
| 63 | + 'OCA\\User_LDAP\\User_LDAP' => $baseDir.'/../lib/User_LDAP.php', |
|
| 64 | + 'OCA\\User_LDAP\\User_Proxy' => $baseDir.'/../lib/User_Proxy.php', |
|
| 65 | + 'OCA\\User_LDAP\\Wizard' => $baseDir.'/../lib/Wizard.php', |
|
| 66 | + 'OCA\\User_LDAP\\WizardResult' => $baseDir.'/../lib/WizardResult.php', |
|
| 67 | 67 | ); |
@@ -28,34 +28,34 @@ |
||
| 28 | 28 | use OCP\IConfig; |
| 29 | 29 | |
| 30 | 30 | class AccessFactory { |
| 31 | - /** @var ILDAPWrapper */ |
|
| 32 | - protected $ldap; |
|
| 33 | - /** @var Manager */ |
|
| 34 | - protected $userManager; |
|
| 35 | - /** @var Helper */ |
|
| 36 | - protected $helper; |
|
| 37 | - /** @var IConfig */ |
|
| 38 | - protected $config; |
|
| 31 | + /** @var ILDAPWrapper */ |
|
| 32 | + protected $ldap; |
|
| 33 | + /** @var Manager */ |
|
| 34 | + protected $userManager; |
|
| 35 | + /** @var Helper */ |
|
| 36 | + protected $helper; |
|
| 37 | + /** @var IConfig */ |
|
| 38 | + protected $config; |
|
| 39 | 39 | |
| 40 | - public function __construct( |
|
| 41 | - ILDAPWrapper $ldap, |
|
| 42 | - Manager $userManager, |
|
| 43 | - Helper $helper, |
|
| 44 | - IConfig $config) |
|
| 45 | - { |
|
| 46 | - $this->ldap = $ldap; |
|
| 47 | - $this->userManager = $userManager; |
|
| 48 | - $this->helper = $helper; |
|
| 49 | - $this->config = $config; |
|
| 50 | - } |
|
| 40 | + public function __construct( |
|
| 41 | + ILDAPWrapper $ldap, |
|
| 42 | + Manager $userManager, |
|
| 43 | + Helper $helper, |
|
| 44 | + IConfig $config) |
|
| 45 | + { |
|
| 46 | + $this->ldap = $ldap; |
|
| 47 | + $this->userManager = $userManager; |
|
| 48 | + $this->helper = $helper; |
|
| 49 | + $this->config = $config; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function get(Connection $connection) { |
|
| 53 | - return new Access( |
|
| 54 | - $connection, |
|
| 55 | - $this->ldap, |
|
| 56 | - $this->userManager, |
|
| 57 | - $this->helper, |
|
| 58 | - $this->config |
|
| 59 | - ); |
|
| 60 | - } |
|
| 52 | + public function get(Connection $connection) { |
|
| 53 | + return new Access( |
|
| 54 | + $connection, |
|
| 55 | + $this->ldap, |
|
| 56 | + $this->userManager, |
|
| 57 | + $this->helper, |
|
| 58 | + $this->config |
|
| 59 | + ); |
|
| 60 | + } |
|
| 61 | 61 | } |
@@ -44,342 +44,342 @@ |
||
| 44 | 44 | use OCP\Notification\IManager; |
| 45 | 45 | |
| 46 | 46 | class Sync extends TimedJob { |
| 47 | - const MAX_INTERVAL = 12 * 60 * 60; // 12h |
|
| 48 | - const MIN_INTERVAL = 30 * 60; // 30min |
|
| 49 | - /** @var Helper */ |
|
| 50 | - protected $ldapHelper; |
|
| 51 | - /** @var LDAP */ |
|
| 52 | - protected $ldap; |
|
| 53 | - /** @var Manager */ |
|
| 54 | - protected $userManager; |
|
| 55 | - /** @var UserMapping */ |
|
| 56 | - protected $mapper; |
|
| 57 | - /** @var IConfig */ |
|
| 58 | - protected $config; |
|
| 59 | - /** @var IAvatarManager */ |
|
| 60 | - protected $avatarManager; |
|
| 61 | - /** @var IDBConnection */ |
|
| 62 | - protected $dbc; |
|
| 63 | - /** @var IUserManager */ |
|
| 64 | - protected $ncUserManager; |
|
| 65 | - /** @var IManager */ |
|
| 66 | - protected $notificationManager; |
|
| 67 | - /** @var ConnectionFactory */ |
|
| 68 | - protected $connectionFactory; |
|
| 69 | - /** @var AccessFactory */ |
|
| 70 | - protected $accessFactory; |
|
| 71 | - |
|
| 72 | - public function __construct() { |
|
| 73 | - $this->setInterval( |
|
| 74 | - \OC::$server->getConfig()->getAppValue( |
|
| 75 | - 'user_ldap', |
|
| 76 | - 'background_sync_interval', |
|
| 77 | - self::MIN_INTERVAL |
|
| 78 | - ) |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * updates the interval |
|
| 84 | - * |
|
| 85 | - * the idea is to adjust the interval depending on the amount of known users |
|
| 86 | - * and the attempt to update each user one day. At most it would run every |
|
| 87 | - * 30 minutes, and at least every 12 hours. |
|
| 88 | - */ |
|
| 89 | - public function updateInterval() { |
|
| 90 | - $minPagingSize = $this->getMinPagingSize(); |
|
| 91 | - $mappedUsers = $this->mapper->count(); |
|
| 92 | - |
|
| 93 | - $runsPerDay = ($minPagingSize === 0 || $mappedUsers === 0) ? self::MAX_INTERVAL |
|
| 94 | - : $mappedUsers / $minPagingSize; |
|
| 95 | - $interval = floor(24 * 60 * 60 / $runsPerDay); |
|
| 96 | - $interval = min(max($interval, self::MIN_INTERVAL), self::MAX_INTERVAL); |
|
| 97 | - |
|
| 98 | - $this->config->setAppValue('user_ldap', 'background_sync_interval', $interval); |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * returns the smallest configured paging size |
|
| 103 | - * @return int |
|
| 104 | - */ |
|
| 105 | - protected function getMinPagingSize() { |
|
| 106 | - $configKeys = $this->config->getAppKeys('user_ldap'); |
|
| 107 | - $configKeys = array_filter($configKeys, function($key) { |
|
| 108 | - return strpos($key, 'ldap_paging_size') !== false; |
|
| 109 | - }); |
|
| 110 | - $minPagingSize = null; |
|
| 111 | - foreach ($configKeys as $configKey) { |
|
| 112 | - $pagingSize = $this->config->getAppValue('user_ldap', $configKey, $minPagingSize); |
|
| 113 | - $minPagingSize = $minPagingSize === null ? $pagingSize : min($minPagingSize, $pagingSize); |
|
| 114 | - } |
|
| 115 | - return (int)$minPagingSize; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @param array $argument |
|
| 120 | - */ |
|
| 121 | - protected function run($argument) { |
|
| 122 | - $this->setArgument($argument); |
|
| 123 | - |
|
| 124 | - $isBackgroundJobModeAjax = $this->config |
|
| 125 | - ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; |
|
| 126 | - if($isBackgroundJobModeAjax) { |
|
| 127 | - return; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - $cycleData = $this->getCycle(); |
|
| 131 | - if($cycleData === null) { |
|
| 132 | - $cycleData = $this->determineNextCycle(); |
|
| 133 | - if($cycleData === null) { |
|
| 134 | - $this->updateInterval(); |
|
| 135 | - return; |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - if(!$this->qualifiesToRun($cycleData)) { |
|
| 140 | - $this->updateInterval(); |
|
| 141 | - return; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - try { |
|
| 145 | - $expectMoreResults = $this->runCycle($cycleData); |
|
| 146 | - if ($expectMoreResults) { |
|
| 147 | - $this->increaseOffset($cycleData); |
|
| 148 | - } else { |
|
| 149 | - $this->determineNextCycle(); |
|
| 150 | - } |
|
| 151 | - $this->updateInterval(); |
|
| 152 | - } catch (ServerNotAvailableException $e) { |
|
| 153 | - $this->determineNextCycle(); |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * @param array $cycleData |
|
| 159 | - * @return bool whether more results are expected from the same configuration |
|
| 160 | - */ |
|
| 161 | - public function runCycle($cycleData) { |
|
| 162 | - $connection = $this->connectionFactory->get($cycleData['prefix']); |
|
| 163 | - $access = $this->accessFactory->get($connection); |
|
| 164 | - $access->setUserMapper($this->mapper); |
|
| 165 | - |
|
| 166 | - $filter = $access->combineFilterWithAnd(array( |
|
| 167 | - $access->connection->ldapUserFilter, |
|
| 168 | - $access->connection->ldapUserDisplayName . '=*', |
|
| 169 | - $access->getFilterPartForUserSearch('') |
|
| 170 | - )); |
|
| 171 | - $results = $access->fetchListOfUsers( |
|
| 172 | - $filter, |
|
| 173 | - $access->userManager->getAttributes(), |
|
| 174 | - $connection->ldapPagingSize, |
|
| 175 | - $cycleData['offset'], |
|
| 176 | - true |
|
| 177 | - ); |
|
| 178 | - |
|
| 179 | - if($connection->ldapPagingSize === 0) { |
|
| 180 | - return true; |
|
| 181 | - } |
|
| 182 | - return count($results) >= $connection->ldapPagingSize; |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * returns the info about the current cycle that should be run, if any, |
|
| 187 | - * otherwise null |
|
| 188 | - * |
|
| 189 | - * @return array|null |
|
| 190 | - */ |
|
| 191 | - public function getCycle() { |
|
| 192 | - $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
|
| 193 | - if(count($prefixes) === 0) { |
|
| 194 | - return null; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - $cycleData = [ |
|
| 198 | - 'prefix' => $this->config->getAppValue('user_ldap', 'background_sync_prefix', null), |
|
| 199 | - 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', 0), |
|
| 200 | - ]; |
|
| 201 | - |
|
| 202 | - if( |
|
| 203 | - $cycleData['prefix'] !== null |
|
| 204 | - && in_array($cycleData['prefix'], $prefixes) |
|
| 205 | - ) { |
|
| 206 | - return $cycleData; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - return null; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Save the provided cycle information in the DB |
|
| 214 | - * |
|
| 215 | - * @param array $cycleData |
|
| 216 | - */ |
|
| 217 | - public function setCycle(array $cycleData) { |
|
| 218 | - $this->config->setAppValue('user_ldap', 'background_sync_prefix', $cycleData['prefix']); |
|
| 219 | - $this->config->setAppValue('user_ldap', 'background_sync_offset', $cycleData['offset']); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * returns data about the next cycle that should run, if any, otherwise |
|
| 224 | - * null. It also always goes for the next LDAP configuration! |
|
| 225 | - * |
|
| 226 | - * @param array|null $cycleData the old cycle |
|
| 227 | - * @return array|null |
|
| 228 | - */ |
|
| 229 | - public function determineNextCycle(array $cycleData = null) { |
|
| 230 | - $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
|
| 231 | - if(count($prefixes) === 0) { |
|
| 232 | - return null; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - // get the next prefix in line and remember it |
|
| 236 | - $oldPrefix = $cycleData === null ? null : $cycleData['prefix']; |
|
| 237 | - $prefix = $this->getNextPrefix($oldPrefix); |
|
| 238 | - if($prefix === null) { |
|
| 239 | - return null; |
|
| 240 | - } |
|
| 241 | - $cycleData['prefix'] = $prefix; |
|
| 242 | - $cycleData['offset'] = 0; |
|
| 243 | - $this->setCycle(['prefix' => $prefix, 'offset' => 0]); |
|
| 244 | - |
|
| 245 | - return $cycleData; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * Checks whether the provided cycle should be run. Currently only the |
|
| 250 | - * last configuration change goes into account (at least one hour). |
|
| 251 | - * |
|
| 252 | - * @param $cycleData |
|
| 253 | - * @return bool |
|
| 254 | - */ |
|
| 255 | - protected function qualifiesToRun($cycleData) { |
|
| 256 | - $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0); |
|
| 257 | - if((time() - $lastChange) > 60 * 30) { |
|
| 258 | - return true; |
|
| 259 | - } |
|
| 260 | - return false; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * increases the offset of the current cycle for the next run |
|
| 265 | - * |
|
| 266 | - * @param $cycleData |
|
| 267 | - */ |
|
| 268 | - protected function increaseOffset($cycleData) { |
|
| 269 | - $ldapConfig = new Configuration($cycleData['prefix']); |
|
| 270 | - $cycleData['offset'] += (int)$ldapConfig->ldapPagingSize; |
|
| 271 | - $this->setCycle($cycleData); |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * determines the next configuration prefix based on the last one (if any) |
|
| 276 | - * |
|
| 277 | - * @param string|null $lastPrefix |
|
| 278 | - * @return string|null |
|
| 279 | - */ |
|
| 280 | - protected function getNextPrefix($lastPrefix) { |
|
| 281 | - $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
|
| 282 | - $noOfPrefixes = count($prefixes); |
|
| 283 | - if($noOfPrefixes === 0) { |
|
| 284 | - return null; |
|
| 285 | - } |
|
| 286 | - $i = $lastPrefix === null ? false : array_search($lastPrefix, $prefixes, true); |
|
| 287 | - if($i === false) { |
|
| 288 | - $i = -1; |
|
| 289 | - } else { |
|
| 290 | - $i++; |
|
| 291 | - } |
|
| 292 | - |
|
| 293 | - if(!isset($prefixes[$i])) { |
|
| 294 | - $i = 0; |
|
| 295 | - } |
|
| 296 | - return $prefixes[$i]; |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * "fixes" DI |
|
| 301 | - * |
|
| 302 | - * @param array $argument |
|
| 303 | - */ |
|
| 304 | - public function setArgument($argument) { |
|
| 305 | - if(isset($argument['config'])) { |
|
| 306 | - $this->config = $argument['config']; |
|
| 307 | - } else { |
|
| 308 | - $this->config = \OC::$server->getConfig(); |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - if(isset($argument['helper'])) { |
|
| 312 | - $this->ldapHelper = $argument['helper']; |
|
| 313 | - } else { |
|
| 314 | - $this->ldapHelper = new Helper($this->config); |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - if(isset($argument['ldapWrapper'])) { |
|
| 318 | - $this->ldap = $argument['ldapWrapper']; |
|
| 319 | - } else { |
|
| 320 | - $this->ldap = new LDAP(); |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - if(isset($argument['avatarManager'])) { |
|
| 324 | - $this->avatarManager = $argument['avatarManager']; |
|
| 325 | - } else { |
|
| 326 | - $this->avatarManager = \OC::$server->getAvatarManager(); |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - if(isset($argument['dbc'])) { |
|
| 330 | - $this->dbc = $argument['dbc']; |
|
| 331 | - } else { |
|
| 332 | - $this->dbc = \OC::$server->getDatabaseConnection(); |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - if(isset($argument['ncUserManager'])) { |
|
| 336 | - $this->ncUserManager = $argument['ncUserManager']; |
|
| 337 | - } else { |
|
| 338 | - $this->ncUserManager = \OC::$server->getUserManager(); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - if(isset($argument['notificationManager'])) { |
|
| 342 | - $this->notificationManager = $argument['notificationManager']; |
|
| 343 | - } else { |
|
| 344 | - $this->notificationManager = \OC::$server->getNotificationManager(); |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - if(isset($argument['userManager'])) { |
|
| 348 | - $this->userManager = $argument['userManager']; |
|
| 349 | - } else { |
|
| 350 | - $this->userManager = new Manager( |
|
| 351 | - $this->config, |
|
| 352 | - new FilesystemHelper(), |
|
| 353 | - new LogWrapper(), |
|
| 354 | - $this->avatarManager, |
|
| 355 | - new Image(), |
|
| 356 | - $this->dbc, |
|
| 357 | - $this->ncUserManager, |
|
| 358 | - $this->notificationManager |
|
| 359 | - ); |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - if(isset($argument['mapper'])) { |
|
| 363 | - $this->mapper = $argument['mapper']; |
|
| 364 | - } else { |
|
| 365 | - $this->mapper = new UserMapping($this->dbc); |
|
| 366 | - } |
|
| 47 | + const MAX_INTERVAL = 12 * 60 * 60; // 12h |
|
| 48 | + const MIN_INTERVAL = 30 * 60; // 30min |
|
| 49 | + /** @var Helper */ |
|
| 50 | + protected $ldapHelper; |
|
| 51 | + /** @var LDAP */ |
|
| 52 | + protected $ldap; |
|
| 53 | + /** @var Manager */ |
|
| 54 | + protected $userManager; |
|
| 55 | + /** @var UserMapping */ |
|
| 56 | + protected $mapper; |
|
| 57 | + /** @var IConfig */ |
|
| 58 | + protected $config; |
|
| 59 | + /** @var IAvatarManager */ |
|
| 60 | + protected $avatarManager; |
|
| 61 | + /** @var IDBConnection */ |
|
| 62 | + protected $dbc; |
|
| 63 | + /** @var IUserManager */ |
|
| 64 | + protected $ncUserManager; |
|
| 65 | + /** @var IManager */ |
|
| 66 | + protected $notificationManager; |
|
| 67 | + /** @var ConnectionFactory */ |
|
| 68 | + protected $connectionFactory; |
|
| 69 | + /** @var AccessFactory */ |
|
| 70 | + protected $accessFactory; |
|
| 71 | + |
|
| 72 | + public function __construct() { |
|
| 73 | + $this->setInterval( |
|
| 74 | + \OC::$server->getConfig()->getAppValue( |
|
| 75 | + 'user_ldap', |
|
| 76 | + 'background_sync_interval', |
|
| 77 | + self::MIN_INTERVAL |
|
| 78 | + ) |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * updates the interval |
|
| 84 | + * |
|
| 85 | + * the idea is to adjust the interval depending on the amount of known users |
|
| 86 | + * and the attempt to update each user one day. At most it would run every |
|
| 87 | + * 30 minutes, and at least every 12 hours. |
|
| 88 | + */ |
|
| 89 | + public function updateInterval() { |
|
| 90 | + $minPagingSize = $this->getMinPagingSize(); |
|
| 91 | + $mappedUsers = $this->mapper->count(); |
|
| 92 | + |
|
| 93 | + $runsPerDay = ($minPagingSize === 0 || $mappedUsers === 0) ? self::MAX_INTERVAL |
|
| 94 | + : $mappedUsers / $minPagingSize; |
|
| 95 | + $interval = floor(24 * 60 * 60 / $runsPerDay); |
|
| 96 | + $interval = min(max($interval, self::MIN_INTERVAL), self::MAX_INTERVAL); |
|
| 97 | + |
|
| 98 | + $this->config->setAppValue('user_ldap', 'background_sync_interval', $interval); |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * returns the smallest configured paging size |
|
| 103 | + * @return int |
|
| 104 | + */ |
|
| 105 | + protected function getMinPagingSize() { |
|
| 106 | + $configKeys = $this->config->getAppKeys('user_ldap'); |
|
| 107 | + $configKeys = array_filter($configKeys, function($key) { |
|
| 108 | + return strpos($key, 'ldap_paging_size') !== false; |
|
| 109 | + }); |
|
| 110 | + $minPagingSize = null; |
|
| 111 | + foreach ($configKeys as $configKey) { |
|
| 112 | + $pagingSize = $this->config->getAppValue('user_ldap', $configKey, $minPagingSize); |
|
| 113 | + $minPagingSize = $minPagingSize === null ? $pagingSize : min($minPagingSize, $pagingSize); |
|
| 114 | + } |
|
| 115 | + return (int)$minPagingSize; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @param array $argument |
|
| 120 | + */ |
|
| 121 | + protected function run($argument) { |
|
| 122 | + $this->setArgument($argument); |
|
| 123 | + |
|
| 124 | + $isBackgroundJobModeAjax = $this->config |
|
| 125 | + ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; |
|
| 126 | + if($isBackgroundJobModeAjax) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + $cycleData = $this->getCycle(); |
|
| 131 | + if($cycleData === null) { |
|
| 132 | + $cycleData = $this->determineNextCycle(); |
|
| 133 | + if($cycleData === null) { |
|
| 134 | + $this->updateInterval(); |
|
| 135 | + return; |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + if(!$this->qualifiesToRun($cycleData)) { |
|
| 140 | + $this->updateInterval(); |
|
| 141 | + return; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + try { |
|
| 145 | + $expectMoreResults = $this->runCycle($cycleData); |
|
| 146 | + if ($expectMoreResults) { |
|
| 147 | + $this->increaseOffset($cycleData); |
|
| 148 | + } else { |
|
| 149 | + $this->determineNextCycle(); |
|
| 150 | + } |
|
| 151 | + $this->updateInterval(); |
|
| 152 | + } catch (ServerNotAvailableException $e) { |
|
| 153 | + $this->determineNextCycle(); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * @param array $cycleData |
|
| 159 | + * @return bool whether more results are expected from the same configuration |
|
| 160 | + */ |
|
| 161 | + public function runCycle($cycleData) { |
|
| 162 | + $connection = $this->connectionFactory->get($cycleData['prefix']); |
|
| 163 | + $access = $this->accessFactory->get($connection); |
|
| 164 | + $access->setUserMapper($this->mapper); |
|
| 165 | + |
|
| 166 | + $filter = $access->combineFilterWithAnd(array( |
|
| 167 | + $access->connection->ldapUserFilter, |
|
| 168 | + $access->connection->ldapUserDisplayName . '=*', |
|
| 169 | + $access->getFilterPartForUserSearch('') |
|
| 170 | + )); |
|
| 171 | + $results = $access->fetchListOfUsers( |
|
| 172 | + $filter, |
|
| 173 | + $access->userManager->getAttributes(), |
|
| 174 | + $connection->ldapPagingSize, |
|
| 175 | + $cycleData['offset'], |
|
| 176 | + true |
|
| 177 | + ); |
|
| 178 | + |
|
| 179 | + if($connection->ldapPagingSize === 0) { |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 182 | + return count($results) >= $connection->ldapPagingSize; |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * returns the info about the current cycle that should be run, if any, |
|
| 187 | + * otherwise null |
|
| 188 | + * |
|
| 189 | + * @return array|null |
|
| 190 | + */ |
|
| 191 | + public function getCycle() { |
|
| 192 | + $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
|
| 193 | + if(count($prefixes) === 0) { |
|
| 194 | + return null; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + $cycleData = [ |
|
| 198 | + 'prefix' => $this->config->getAppValue('user_ldap', 'background_sync_prefix', null), |
|
| 199 | + 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', 0), |
|
| 200 | + ]; |
|
| 201 | + |
|
| 202 | + if( |
|
| 203 | + $cycleData['prefix'] !== null |
|
| 204 | + && in_array($cycleData['prefix'], $prefixes) |
|
| 205 | + ) { |
|
| 206 | + return $cycleData; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + return null; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Save the provided cycle information in the DB |
|
| 214 | + * |
|
| 215 | + * @param array $cycleData |
|
| 216 | + */ |
|
| 217 | + public function setCycle(array $cycleData) { |
|
| 218 | + $this->config->setAppValue('user_ldap', 'background_sync_prefix', $cycleData['prefix']); |
|
| 219 | + $this->config->setAppValue('user_ldap', 'background_sync_offset', $cycleData['offset']); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * returns data about the next cycle that should run, if any, otherwise |
|
| 224 | + * null. It also always goes for the next LDAP configuration! |
|
| 225 | + * |
|
| 226 | + * @param array|null $cycleData the old cycle |
|
| 227 | + * @return array|null |
|
| 228 | + */ |
|
| 229 | + public function determineNextCycle(array $cycleData = null) { |
|
| 230 | + $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
|
| 231 | + if(count($prefixes) === 0) { |
|
| 232 | + return null; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + // get the next prefix in line and remember it |
|
| 236 | + $oldPrefix = $cycleData === null ? null : $cycleData['prefix']; |
|
| 237 | + $prefix = $this->getNextPrefix($oldPrefix); |
|
| 238 | + if($prefix === null) { |
|
| 239 | + return null; |
|
| 240 | + } |
|
| 241 | + $cycleData['prefix'] = $prefix; |
|
| 242 | + $cycleData['offset'] = 0; |
|
| 243 | + $this->setCycle(['prefix' => $prefix, 'offset' => 0]); |
|
| 244 | + |
|
| 245 | + return $cycleData; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * Checks whether the provided cycle should be run. Currently only the |
|
| 250 | + * last configuration change goes into account (at least one hour). |
|
| 251 | + * |
|
| 252 | + * @param $cycleData |
|
| 253 | + * @return bool |
|
| 254 | + */ |
|
| 255 | + protected function qualifiesToRun($cycleData) { |
|
| 256 | + $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0); |
|
| 257 | + if((time() - $lastChange) > 60 * 30) { |
|
| 258 | + return true; |
|
| 259 | + } |
|
| 260 | + return false; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * increases the offset of the current cycle for the next run |
|
| 265 | + * |
|
| 266 | + * @param $cycleData |
|
| 267 | + */ |
|
| 268 | + protected function increaseOffset($cycleData) { |
|
| 269 | + $ldapConfig = new Configuration($cycleData['prefix']); |
|
| 270 | + $cycleData['offset'] += (int)$ldapConfig->ldapPagingSize; |
|
| 271 | + $this->setCycle($cycleData); |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * determines the next configuration prefix based on the last one (if any) |
|
| 276 | + * |
|
| 277 | + * @param string|null $lastPrefix |
|
| 278 | + * @return string|null |
|
| 279 | + */ |
|
| 280 | + protected function getNextPrefix($lastPrefix) { |
|
| 281 | + $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
|
| 282 | + $noOfPrefixes = count($prefixes); |
|
| 283 | + if($noOfPrefixes === 0) { |
|
| 284 | + return null; |
|
| 285 | + } |
|
| 286 | + $i = $lastPrefix === null ? false : array_search($lastPrefix, $prefixes, true); |
|
| 287 | + if($i === false) { |
|
| 288 | + $i = -1; |
|
| 289 | + } else { |
|
| 290 | + $i++; |
|
| 291 | + } |
|
| 292 | + |
|
| 293 | + if(!isset($prefixes[$i])) { |
|
| 294 | + $i = 0; |
|
| 295 | + } |
|
| 296 | + return $prefixes[$i]; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * "fixes" DI |
|
| 301 | + * |
|
| 302 | + * @param array $argument |
|
| 303 | + */ |
|
| 304 | + public function setArgument($argument) { |
|
| 305 | + if(isset($argument['config'])) { |
|
| 306 | + $this->config = $argument['config']; |
|
| 307 | + } else { |
|
| 308 | + $this->config = \OC::$server->getConfig(); |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + if(isset($argument['helper'])) { |
|
| 312 | + $this->ldapHelper = $argument['helper']; |
|
| 313 | + } else { |
|
| 314 | + $this->ldapHelper = new Helper($this->config); |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + if(isset($argument['ldapWrapper'])) { |
|
| 318 | + $this->ldap = $argument['ldapWrapper']; |
|
| 319 | + } else { |
|
| 320 | + $this->ldap = new LDAP(); |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + if(isset($argument['avatarManager'])) { |
|
| 324 | + $this->avatarManager = $argument['avatarManager']; |
|
| 325 | + } else { |
|
| 326 | + $this->avatarManager = \OC::$server->getAvatarManager(); |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + if(isset($argument['dbc'])) { |
|
| 330 | + $this->dbc = $argument['dbc']; |
|
| 331 | + } else { |
|
| 332 | + $this->dbc = \OC::$server->getDatabaseConnection(); |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + if(isset($argument['ncUserManager'])) { |
|
| 336 | + $this->ncUserManager = $argument['ncUserManager']; |
|
| 337 | + } else { |
|
| 338 | + $this->ncUserManager = \OC::$server->getUserManager(); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + if(isset($argument['notificationManager'])) { |
|
| 342 | + $this->notificationManager = $argument['notificationManager']; |
|
| 343 | + } else { |
|
| 344 | + $this->notificationManager = \OC::$server->getNotificationManager(); |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + if(isset($argument['userManager'])) { |
|
| 348 | + $this->userManager = $argument['userManager']; |
|
| 349 | + } else { |
|
| 350 | + $this->userManager = new Manager( |
|
| 351 | + $this->config, |
|
| 352 | + new FilesystemHelper(), |
|
| 353 | + new LogWrapper(), |
|
| 354 | + $this->avatarManager, |
|
| 355 | + new Image(), |
|
| 356 | + $this->dbc, |
|
| 357 | + $this->ncUserManager, |
|
| 358 | + $this->notificationManager |
|
| 359 | + ); |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + if(isset($argument['mapper'])) { |
|
| 363 | + $this->mapper = $argument['mapper']; |
|
| 364 | + } else { |
|
| 365 | + $this->mapper = new UserMapping($this->dbc); |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | - if(isset($argument['connectionFactory'])) { |
|
| 369 | - $this->connectionFactory = $argument['connectionFactory']; |
|
| 370 | - } else { |
|
| 371 | - $this->connectionFactory = new ConnectionFactory($this->ldap); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - if(isset($argument['accessFactory'])) { |
|
| 375 | - $this->accessFactory = $argument['accessFactory']; |
|
| 376 | - } else { |
|
| 377 | - $this->accessFactory = new AccessFactory( |
|
| 378 | - $this->ldap, |
|
| 379 | - $this->userManager, |
|
| 380 | - $this->ldapHelper, |
|
| 381 | - $this->config |
|
| 382 | - ); |
|
| 383 | - } |
|
| 384 | - } |
|
| 368 | + if(isset($argument['connectionFactory'])) { |
|
| 369 | + $this->connectionFactory = $argument['connectionFactory']; |
|
| 370 | + } else { |
|
| 371 | + $this->connectionFactory = new ConnectionFactory($this->ldap); |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + if(isset($argument['accessFactory'])) { |
|
| 375 | + $this->accessFactory = $argument['accessFactory']; |
|
| 376 | + } else { |
|
| 377 | + $this->accessFactory = new AccessFactory( |
|
| 378 | + $this->ldap, |
|
| 379 | + $this->userManager, |
|
| 380 | + $this->ldapHelper, |
|
| 381 | + $this->config |
|
| 382 | + ); |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | 385 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $pagingSize = $this->config->getAppValue('user_ldap', $configKey, $minPagingSize); |
| 113 | 113 | $minPagingSize = $minPagingSize === null ? $pagingSize : min($minPagingSize, $pagingSize); |
| 114 | 114 | } |
| 115 | - return (int)$minPagingSize; |
|
| 115 | + return (int) $minPagingSize; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -123,20 +123,20 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $isBackgroundJobModeAjax = $this->config |
| 125 | 125 | ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; |
| 126 | - if($isBackgroundJobModeAjax) { |
|
| 126 | + if ($isBackgroundJobModeAjax) { |
|
| 127 | 127 | return; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $cycleData = $this->getCycle(); |
| 131 | - if($cycleData === null) { |
|
| 131 | + if ($cycleData === null) { |
|
| 132 | 132 | $cycleData = $this->determineNextCycle(); |
| 133 | - if($cycleData === null) { |
|
| 133 | + if ($cycleData === null) { |
|
| 134 | 134 | $this->updateInterval(); |
| 135 | 135 | return; |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if(!$this->qualifiesToRun($cycleData)) { |
|
| 139 | + if (!$this->qualifiesToRun($cycleData)) { |
|
| 140 | 140 | $this->updateInterval(); |
| 141 | 141 | return; |
| 142 | 142 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $filter = $access->combineFilterWithAnd(array( |
| 167 | 167 | $access->connection->ldapUserFilter, |
| 168 | - $access->connection->ldapUserDisplayName . '=*', |
|
| 168 | + $access->connection->ldapUserDisplayName.'=*', |
|
| 169 | 169 | $access->getFilterPartForUserSearch('') |
| 170 | 170 | )); |
| 171 | 171 | $results = $access->fetchListOfUsers( |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | true |
| 177 | 177 | ); |
| 178 | 178 | |
| 179 | - if($connection->ldapPagingSize === 0) { |
|
| 179 | + if ($connection->ldapPagingSize === 0) { |
|
| 180 | 180 | return true; |
| 181 | 181 | } |
| 182 | 182 | return count($results) >= $connection->ldapPagingSize; |
@@ -190,16 +190,16 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function getCycle() { |
| 192 | 192 | $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
| 193 | - if(count($prefixes) === 0) { |
|
| 193 | + if (count($prefixes) === 0) { |
|
| 194 | 194 | return null; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $cycleData = [ |
| 198 | 198 | 'prefix' => $this->config->getAppValue('user_ldap', 'background_sync_prefix', null), |
| 199 | - 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', 0), |
|
| 199 | + 'offset' => (int) $this->config->getAppValue('user_ldap', 'background_sync_offset', 0), |
|
| 200 | 200 | ]; |
| 201 | 201 | |
| 202 | - if( |
|
| 202 | + if ( |
|
| 203 | 203 | $cycleData['prefix'] !== null |
| 204 | 204 | && in_array($cycleData['prefix'], $prefixes) |
| 205 | 205 | ) { |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function determineNextCycle(array $cycleData = null) { |
| 230 | 230 | $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
| 231 | - if(count($prefixes) === 0) { |
|
| 231 | + if (count($prefixes) === 0) { |
|
| 232 | 232 | return null; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // get the next prefix in line and remember it |
| 236 | 236 | $oldPrefix = $cycleData === null ? null : $cycleData['prefix']; |
| 237 | 237 | $prefix = $this->getNextPrefix($oldPrefix); |
| 238 | - if($prefix === null) { |
|
| 238 | + if ($prefix === null) { |
|
| 239 | 239 | return null; |
| 240 | 240 | } |
| 241 | 241 | $cycleData['prefix'] = $prefix; |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | * @return bool |
| 254 | 254 | */ |
| 255 | 255 | protected function qualifiesToRun($cycleData) { |
| 256 | - $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0); |
|
| 257 | - if((time() - $lastChange) > 60 * 30) { |
|
| 256 | + $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'].'_lastChange', 0); |
|
| 257 | + if ((time() - $lastChange) > 60 * 30) { |
|
| 258 | 258 | return true; |
| 259 | 259 | } |
| 260 | 260 | return false; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | protected function increaseOffset($cycleData) { |
| 269 | 269 | $ldapConfig = new Configuration($cycleData['prefix']); |
| 270 | - $cycleData['offset'] += (int)$ldapConfig->ldapPagingSize; |
|
| 270 | + $cycleData['offset'] += (int) $ldapConfig->ldapPagingSize; |
|
| 271 | 271 | $this->setCycle($cycleData); |
| 272 | 272 | } |
| 273 | 273 | |
@@ -280,17 +280,17 @@ discard block |
||
| 280 | 280 | protected function getNextPrefix($lastPrefix) { |
| 281 | 281 | $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); |
| 282 | 282 | $noOfPrefixes = count($prefixes); |
| 283 | - if($noOfPrefixes === 0) { |
|
| 283 | + if ($noOfPrefixes === 0) { |
|
| 284 | 284 | return null; |
| 285 | 285 | } |
| 286 | 286 | $i = $lastPrefix === null ? false : array_search($lastPrefix, $prefixes, true); |
| 287 | - if($i === false) { |
|
| 287 | + if ($i === false) { |
|
| 288 | 288 | $i = -1; |
| 289 | 289 | } else { |
| 290 | 290 | $i++; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if(!isset($prefixes[$i])) { |
|
| 293 | + if (!isset($prefixes[$i])) { |
|
| 294 | 294 | $i = 0; |
| 295 | 295 | } |
| 296 | 296 | return $prefixes[$i]; |
@@ -302,49 +302,49 @@ discard block |
||
| 302 | 302 | * @param array $argument |
| 303 | 303 | */ |
| 304 | 304 | public function setArgument($argument) { |
| 305 | - if(isset($argument['config'])) { |
|
| 305 | + if (isset($argument['config'])) { |
|
| 306 | 306 | $this->config = $argument['config']; |
| 307 | 307 | } else { |
| 308 | 308 | $this->config = \OC::$server->getConfig(); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if(isset($argument['helper'])) { |
|
| 311 | + if (isset($argument['helper'])) { |
|
| 312 | 312 | $this->ldapHelper = $argument['helper']; |
| 313 | 313 | } else { |
| 314 | 314 | $this->ldapHelper = new Helper($this->config); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if(isset($argument['ldapWrapper'])) { |
|
| 317 | + if (isset($argument['ldapWrapper'])) { |
|
| 318 | 318 | $this->ldap = $argument['ldapWrapper']; |
| 319 | 319 | } else { |
| 320 | 320 | $this->ldap = new LDAP(); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if(isset($argument['avatarManager'])) { |
|
| 323 | + if (isset($argument['avatarManager'])) { |
|
| 324 | 324 | $this->avatarManager = $argument['avatarManager']; |
| 325 | 325 | } else { |
| 326 | 326 | $this->avatarManager = \OC::$server->getAvatarManager(); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if(isset($argument['dbc'])) { |
|
| 329 | + if (isset($argument['dbc'])) { |
|
| 330 | 330 | $this->dbc = $argument['dbc']; |
| 331 | 331 | } else { |
| 332 | 332 | $this->dbc = \OC::$server->getDatabaseConnection(); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if(isset($argument['ncUserManager'])) { |
|
| 335 | + if (isset($argument['ncUserManager'])) { |
|
| 336 | 336 | $this->ncUserManager = $argument['ncUserManager']; |
| 337 | 337 | } else { |
| 338 | 338 | $this->ncUserManager = \OC::$server->getUserManager(); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if(isset($argument['notificationManager'])) { |
|
| 341 | + if (isset($argument['notificationManager'])) { |
|
| 342 | 342 | $this->notificationManager = $argument['notificationManager']; |
| 343 | 343 | } else { |
| 344 | 344 | $this->notificationManager = \OC::$server->getNotificationManager(); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if(isset($argument['userManager'])) { |
|
| 347 | + if (isset($argument['userManager'])) { |
|
| 348 | 348 | $this->userManager = $argument['userManager']; |
| 349 | 349 | } else { |
| 350 | 350 | $this->userManager = new Manager( |
@@ -359,19 +359,19 @@ discard block |
||
| 359 | 359 | ); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if(isset($argument['mapper'])) { |
|
| 362 | + if (isset($argument['mapper'])) { |
|
| 363 | 363 | $this->mapper = $argument['mapper']; |
| 364 | 364 | } else { |
| 365 | 365 | $this->mapper = new UserMapping($this->dbc); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | - if(isset($argument['connectionFactory'])) { |
|
| 368 | + if (isset($argument['connectionFactory'])) { |
|
| 369 | 369 | $this->connectionFactory = $argument['connectionFactory']; |
| 370 | 370 | } else { |
| 371 | 371 | $this->connectionFactory = new ConnectionFactory($this->ldap); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - if(isset($argument['accessFactory'])) { |
|
| 374 | + if (isset($argument['accessFactory'])) { |
|
| 375 | 375 | $this->accessFactory = $argument['accessFactory']; |
| 376 | 376 | } else { |
| 377 | 377 | $this->accessFactory = new AccessFactory( |
@@ -25,14 +25,14 @@ |
||
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | class ConnectionFactory { |
| 28 | - /** @var ILDAPWrapper */ |
|
| 29 | - private $ldap; |
|
| 28 | + /** @var ILDAPWrapper */ |
|
| 29 | + private $ldap; |
|
| 30 | 30 | |
| 31 | - public function __construct(ILDAPWrapper $ldap) { |
|
| 32 | - $this->ldap = $ldap; |
|
| 33 | - } |
|
| 31 | + public function __construct(ILDAPWrapper $ldap) { |
|
| 32 | + $this->ldap = $ldap; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function get($prefix) { |
|
| 36 | - return new Connection($this->ldap, $prefix, 'user_ldap'); |
|
| 37 | - } |
|
| 35 | + public function get($prefix) { |
|
| 36 | + return new Connection($this->ldap, $prefix, 'user_ldap'); |
|
| 37 | + } |
|
| 38 | 38 | } |