Passed
Push — master ( 356350...344eac )
by Morris
20:06 queued 02:55
created
apps/user_ldap/composer/composer/autoload_classmap.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -6,72 +6,72 @@
 block discarded – undo
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\\Events\\GroupBackendRegistered' => $baseDir . '/../lib/Events/GroupBackendRegistered.php',
27
-    'OCA\\User_LDAP\\Events\\UserBackendRegistered' => $baseDir . '/../lib/Events/UserBackendRegistered.php',
28
-    'OCA\\User_LDAP\\Exceptions\\AttributeNotSet' => $baseDir . '/../lib/Exceptions/AttributeNotSet.php',
29
-    'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir . '/../lib/Exceptions/ConstraintViolationException.php',
30
-    'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir . '/../lib/Exceptions/NotOnLDAP.php',
31
-    'OCA\\User_LDAP\\FilesystemHelper' => $baseDir . '/../lib/FilesystemHelper.php',
32
-    'OCA\\User_LDAP\\GroupPluginManager' => $baseDir . '/../lib/GroupPluginManager.php',
33
-    'OCA\\User_LDAP\\Group_LDAP' => $baseDir . '/../lib/Group_LDAP.php',
34
-    'OCA\\User_LDAP\\Group_Proxy' => $baseDir . '/../lib/Group_Proxy.php',
35
-    'OCA\\User_LDAP\\Handler\\ExtStorageConfigHandler' => $baseDir . '/../lib/Handler/ExtStorageConfigHandler.php',
36
-    'OCA\\User_LDAP\\Helper' => $baseDir . '/../lib/Helper.php',
37
-    'OCA\\User_LDAP\\IGroupLDAP' => $baseDir . '/../lib/IGroupLDAP.php',
38
-    'OCA\\User_LDAP\\ILDAPGroupPlugin' => $baseDir . '/../lib/ILDAPGroupPlugin.php',
39
-    'OCA\\User_LDAP\\ILDAPUserPlugin' => $baseDir . '/../lib/ILDAPUserPlugin.php',
40
-    'OCA\\User_LDAP\\ILDAPWrapper' => $baseDir . '/../lib/ILDAPWrapper.php',
41
-    'OCA\\User_LDAP\\IUserLDAP' => $baseDir . '/../lib/IUserLDAP.php',
42
-    'OCA\\User_LDAP\\Jobs\\CleanUp' => $baseDir . '/../lib/Jobs/CleanUp.php',
43
-    'OCA\\User_LDAP\\Jobs\\Sync' => $baseDir . '/../lib/Jobs/Sync.php',
44
-    'OCA\\User_LDAP\\Jobs\\UpdateGroups' => $baseDir . '/../lib/Jobs/UpdateGroups.php',
45
-    'OCA\\User_LDAP\\LDAP' => $baseDir . '/../lib/LDAP.php',
46
-    'OCA\\User_LDAP\\LDAPProvider' => $baseDir . '/../lib/LDAPProvider.php',
47
-    'OCA\\User_LDAP\\LDAPProviderFactory' => $baseDir . '/../lib/LDAPProviderFactory.php',
48
-    'OCA\\User_LDAP\\LDAPUtility' => $baseDir . '/../lib/LDAPUtility.php',
49
-    'OCA\\User_LDAP\\LogWrapper' => $baseDir . '/../lib/LogWrapper.php',
50
-    'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir . '/../lib/Mapping/AbstractMapping.php',
51
-    'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir . '/../lib/Mapping/GroupMapping.php',
52
-    'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir . '/../lib/Mapping/UserMapping.php',
53
-    'OCA\\User_LDAP\\Migration\\RemoveRefreshTime' => $baseDir . '/../lib/Migration/RemoveRefreshTime.php',
54
-    'OCA\\User_LDAP\\Migration\\SetDefaultProvider' => $baseDir . '/../lib/Migration/SetDefaultProvider.php',
55
-    'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir . '/../lib/Migration/UUIDFix.php',
56
-    'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir . '/../lib/Migration/UUIDFixGroup.php',
57
-    'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir . '/../lib/Migration/UUIDFixInsert.php',
58
-    'OCA\\User_LDAP\\Migration\\UUIDFixUser' => $baseDir . '/../lib/Migration/UUIDFixUser.php',
59
-    'OCA\\User_LDAP\\Migration\\Version1010Date20200630192842' => $baseDir . '/../lib/Migration/Version1010Date20200630192842.php',
60
-    'OCA\\User_LDAP\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
61
-    'OCA\\User_LDAP\\PagedResults\\IAdapter' => $baseDir . '/../lib/PagedResults/IAdapter.php',
62
-    'OCA\\User_LDAP\\PagedResults\\Php54' => $baseDir . '/../lib/PagedResults/Php54.php',
63
-    'OCA\\User_LDAP\\PagedResults\\Php73' => $baseDir . '/../lib/PagedResults/Php73.php',
64
-    'OCA\\User_LDAP\\PagedResults\\TLinkId' => $baseDir . '/../lib/PagedResults/TLinkId.php',
65
-    'OCA\\User_LDAP\\Proxy' => $baseDir . '/../lib/Proxy.php',
66
-    'OCA\\User_LDAP\\Settings\\Admin' => $baseDir . '/../lib/Settings/Admin.php',
67
-    'OCA\\User_LDAP\\Settings\\Section' => $baseDir . '/../lib/Settings/Section.php',
68
-    'OCA\\User_LDAP\\UserPluginManager' => $baseDir . '/../lib/UserPluginManager.php',
69
-    'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir . '/../lib/User/DeletedUsersIndex.php',
70
-    'OCA\\User_LDAP\\User\\Manager' => $baseDir . '/../lib/User/Manager.php',
71
-    'OCA\\User_LDAP\\User\\OfflineUser' => $baseDir . '/../lib/User/OfflineUser.php',
72
-    'OCA\\User_LDAP\\User\\User' => $baseDir . '/../lib/User/User.php',
73
-    'OCA\\User_LDAP\\User_LDAP' => $baseDir . '/../lib/User_LDAP.php',
74
-    'OCA\\User_LDAP\\User_Proxy' => $baseDir . '/../lib/User_Proxy.php',
75
-    'OCA\\User_LDAP\\Wizard' => $baseDir . '/../lib/Wizard.php',
76
-    '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\\Events\\GroupBackendRegistered' => $baseDir.'/../lib/Events/GroupBackendRegistered.php',
27
+    'OCA\\User_LDAP\\Events\\UserBackendRegistered' => $baseDir.'/../lib/Events/UserBackendRegistered.php',
28
+    'OCA\\User_LDAP\\Exceptions\\AttributeNotSet' => $baseDir.'/../lib/Exceptions/AttributeNotSet.php',
29
+    'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => $baseDir.'/../lib/Exceptions/ConstraintViolationException.php',
30
+    'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => $baseDir.'/../lib/Exceptions/NotOnLDAP.php',
31
+    'OCA\\User_LDAP\\FilesystemHelper' => $baseDir.'/../lib/FilesystemHelper.php',
32
+    'OCA\\User_LDAP\\GroupPluginManager' => $baseDir.'/../lib/GroupPluginManager.php',
33
+    'OCA\\User_LDAP\\Group_LDAP' => $baseDir.'/../lib/Group_LDAP.php',
34
+    'OCA\\User_LDAP\\Group_Proxy' => $baseDir.'/../lib/Group_Proxy.php',
35
+    'OCA\\User_LDAP\\Handler\\ExtStorageConfigHandler' => $baseDir.'/../lib/Handler/ExtStorageConfigHandler.php',
36
+    'OCA\\User_LDAP\\Helper' => $baseDir.'/../lib/Helper.php',
37
+    'OCA\\User_LDAP\\IGroupLDAP' => $baseDir.'/../lib/IGroupLDAP.php',
38
+    'OCA\\User_LDAP\\ILDAPGroupPlugin' => $baseDir.'/../lib/ILDAPGroupPlugin.php',
39
+    'OCA\\User_LDAP\\ILDAPUserPlugin' => $baseDir.'/../lib/ILDAPUserPlugin.php',
40
+    'OCA\\User_LDAP\\ILDAPWrapper' => $baseDir.'/../lib/ILDAPWrapper.php',
41
+    'OCA\\User_LDAP\\IUserLDAP' => $baseDir.'/../lib/IUserLDAP.php',
42
+    'OCA\\User_LDAP\\Jobs\\CleanUp' => $baseDir.'/../lib/Jobs/CleanUp.php',
43
+    'OCA\\User_LDAP\\Jobs\\Sync' => $baseDir.'/../lib/Jobs/Sync.php',
44
+    'OCA\\User_LDAP\\Jobs\\UpdateGroups' => $baseDir.'/../lib/Jobs/UpdateGroups.php',
45
+    'OCA\\User_LDAP\\LDAP' => $baseDir.'/../lib/LDAP.php',
46
+    'OCA\\User_LDAP\\LDAPProvider' => $baseDir.'/../lib/LDAPProvider.php',
47
+    'OCA\\User_LDAP\\LDAPProviderFactory' => $baseDir.'/../lib/LDAPProviderFactory.php',
48
+    'OCA\\User_LDAP\\LDAPUtility' => $baseDir.'/../lib/LDAPUtility.php',
49
+    'OCA\\User_LDAP\\LogWrapper' => $baseDir.'/../lib/LogWrapper.php',
50
+    'OCA\\User_LDAP\\Mapping\\AbstractMapping' => $baseDir.'/../lib/Mapping/AbstractMapping.php',
51
+    'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir.'/../lib/Mapping/GroupMapping.php',
52
+    'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir.'/../lib/Mapping/UserMapping.php',
53
+    'OCA\\User_LDAP\\Migration\\RemoveRefreshTime' => $baseDir.'/../lib/Migration/RemoveRefreshTime.php',
54
+    'OCA\\User_LDAP\\Migration\\SetDefaultProvider' => $baseDir.'/../lib/Migration/SetDefaultProvider.php',
55
+    'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir.'/../lib/Migration/UUIDFix.php',
56
+    'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir.'/../lib/Migration/UUIDFixGroup.php',
57
+    'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir.'/../lib/Migration/UUIDFixInsert.php',
58
+    'OCA\\User_LDAP\\Migration\\UUIDFixUser' => $baseDir.'/../lib/Migration/UUIDFixUser.php',
59
+    'OCA\\User_LDAP\\Migration\\Version1010Date20200630192842' => $baseDir.'/../lib/Migration/Version1010Date20200630192842.php',
60
+    'OCA\\User_LDAP\\Notification\\Notifier' => $baseDir.'/../lib/Notification/Notifier.php',
61
+    'OCA\\User_LDAP\\PagedResults\\IAdapter' => $baseDir.'/../lib/PagedResults/IAdapter.php',
62
+    'OCA\\User_LDAP\\PagedResults\\Php54' => $baseDir.'/../lib/PagedResults/Php54.php',
63
+    'OCA\\User_LDAP\\PagedResults\\Php73' => $baseDir.'/../lib/PagedResults/Php73.php',
64
+    'OCA\\User_LDAP\\PagedResults\\TLinkId' => $baseDir.'/../lib/PagedResults/TLinkId.php',
65
+    'OCA\\User_LDAP\\Proxy' => $baseDir.'/../lib/Proxy.php',
66
+    'OCA\\User_LDAP\\Settings\\Admin' => $baseDir.'/../lib/Settings/Admin.php',
67
+    'OCA\\User_LDAP\\Settings\\Section' => $baseDir.'/../lib/Settings/Section.php',
68
+    'OCA\\User_LDAP\\UserPluginManager' => $baseDir.'/../lib/UserPluginManager.php',
69
+    'OCA\\User_LDAP\\User\\DeletedUsersIndex' => $baseDir.'/../lib/User/DeletedUsersIndex.php',
70
+    'OCA\\User_LDAP\\User\\Manager' => $baseDir.'/../lib/User/Manager.php',
71
+    'OCA\\User_LDAP\\User\\OfflineUser' => $baseDir.'/../lib/User/OfflineUser.php',
72
+    'OCA\\User_LDAP\\User\\User' => $baseDir.'/../lib/User/User.php',
73
+    'OCA\\User_LDAP\\User_LDAP' => $baseDir.'/../lib/User_LDAP.php',
74
+    'OCA\\User_LDAP\\User_Proxy' => $baseDir.'/../lib/User_Proxy.php',
75
+    'OCA\\User_LDAP\\Wizard' => $baseDir.'/../lib/Wizard.php',
76
+    'OCA\\User_LDAP\\WizardResult' => $baseDir.'/../lib/WizardResult.php',
77 77
 );
Please login to merge, or discard this patch.
apps/user_ldap/composer/composer/autoload_static.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -6,94 +6,94 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitUser_LDAP
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\User_LDAP\\' => 14,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\User_LDAP\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\User_LDAP\\Access' => __DIR__ . '/..' . '/../lib/Access.php',
25
-        'OCA\\User_LDAP\\AccessFactory' => __DIR__ . '/..' . '/../lib/AccessFactory.php',
26
-        'OCA\\User_LDAP\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
27
-        'OCA\\User_LDAP\\BackendUtility' => __DIR__ . '/..' . '/../lib/BackendUtility.php',
28
-        'OCA\\User_LDAP\\Command\\CheckUser' => __DIR__ . '/..' . '/../lib/Command/CheckUser.php',
29
-        'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => __DIR__ . '/..' . '/../lib/Command/CreateEmptyConfig.php',
30
-        'OCA\\User_LDAP\\Command\\DeleteConfig' => __DIR__ . '/..' . '/../lib/Command/DeleteConfig.php',
31
-        'OCA\\User_LDAP\\Command\\Search' => __DIR__ . '/..' . '/../lib/Command/Search.php',
32
-        'OCA\\User_LDAP\\Command\\SetConfig' => __DIR__ . '/..' . '/../lib/Command/SetConfig.php',
33
-        'OCA\\User_LDAP\\Command\\ShowConfig' => __DIR__ . '/..' . '/../lib/Command/ShowConfig.php',
34
-        'OCA\\User_LDAP\\Command\\ShowRemnants' => __DIR__ . '/..' . '/../lib/Command/ShowRemnants.php',
35
-        'OCA\\User_LDAP\\Command\\TestConfig' => __DIR__ . '/..' . '/../lib/Command/TestConfig.php',
36
-        'OCA\\User_LDAP\\Configuration' => __DIR__ . '/..' . '/../lib/Configuration.php',
37
-        'OCA\\User_LDAP\\Connection' => __DIR__ . '/..' . '/../lib/Connection.php',
38
-        'OCA\\User_LDAP\\ConnectionFactory' => __DIR__ . '/..' . '/../lib/ConnectionFactory.php',
39
-        'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__ . '/..' . '/../lib/Controller/ConfigAPIController.php',
40
-        'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__ . '/..' . '/../lib/Controller/RenewPasswordController.php',
41
-        'OCA\\User_LDAP\\Events\\GroupBackendRegistered' => __DIR__ . '/..' . '/../lib/Events/GroupBackendRegistered.php',
42
-        'OCA\\User_LDAP\\Events\\UserBackendRegistered' => __DIR__ . '/..' . '/../lib/Events/UserBackendRegistered.php',
43
-        'OCA\\User_LDAP\\Exceptions\\AttributeNotSet' => __DIR__ . '/..' . '/../lib/Exceptions/AttributeNotSet.php',
44
-        'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__ . '/..' . '/../lib/Exceptions/ConstraintViolationException.php',
45
-        'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__ . '/..' . '/../lib/Exceptions/NotOnLDAP.php',
46
-        'OCA\\User_LDAP\\FilesystemHelper' => __DIR__ . '/..' . '/../lib/FilesystemHelper.php',
47
-        'OCA\\User_LDAP\\GroupPluginManager' => __DIR__ . '/..' . '/../lib/GroupPluginManager.php',
48
-        'OCA\\User_LDAP\\Group_LDAP' => __DIR__ . '/..' . '/../lib/Group_LDAP.php',
49
-        'OCA\\User_LDAP\\Group_Proxy' => __DIR__ . '/..' . '/../lib/Group_Proxy.php',
50
-        'OCA\\User_LDAP\\Handler\\ExtStorageConfigHandler' => __DIR__ . '/..' . '/../lib/Handler/ExtStorageConfigHandler.php',
51
-        'OCA\\User_LDAP\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
52
-        'OCA\\User_LDAP\\IGroupLDAP' => __DIR__ . '/..' . '/../lib/IGroupLDAP.php',
53
-        'OCA\\User_LDAP\\ILDAPGroupPlugin' => __DIR__ . '/..' . '/../lib/ILDAPGroupPlugin.php',
54
-        'OCA\\User_LDAP\\ILDAPUserPlugin' => __DIR__ . '/..' . '/../lib/ILDAPUserPlugin.php',
55
-        'OCA\\User_LDAP\\ILDAPWrapper' => __DIR__ . '/..' . '/../lib/ILDAPWrapper.php',
56
-        'OCA\\User_LDAP\\IUserLDAP' => __DIR__ . '/..' . '/../lib/IUserLDAP.php',
57
-        'OCA\\User_LDAP\\Jobs\\CleanUp' => __DIR__ . '/..' . '/../lib/Jobs/CleanUp.php',
58
-        'OCA\\User_LDAP\\Jobs\\Sync' => __DIR__ . '/..' . '/../lib/Jobs/Sync.php',
59
-        'OCA\\User_LDAP\\Jobs\\UpdateGroups' => __DIR__ . '/..' . '/../lib/Jobs/UpdateGroups.php',
60
-        'OCA\\User_LDAP\\LDAP' => __DIR__ . '/..' . '/../lib/LDAP.php',
61
-        'OCA\\User_LDAP\\LDAPProvider' => __DIR__ . '/..' . '/../lib/LDAPProvider.php',
62
-        'OCA\\User_LDAP\\LDAPProviderFactory' => __DIR__ . '/..' . '/../lib/LDAPProviderFactory.php',
63
-        'OCA\\User_LDAP\\LDAPUtility' => __DIR__ . '/..' . '/../lib/LDAPUtility.php',
64
-        'OCA\\User_LDAP\\LogWrapper' => __DIR__ . '/..' . '/../lib/LogWrapper.php',
65
-        'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__ . '/..' . '/../lib/Mapping/AbstractMapping.php',
66
-        'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__ . '/..' . '/../lib/Mapping/GroupMapping.php',
67
-        'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__ . '/..' . '/../lib/Mapping/UserMapping.php',
68
-        'OCA\\User_LDAP\\Migration\\RemoveRefreshTime' => __DIR__ . '/..' . '/../lib/Migration/RemoveRefreshTime.php',
69
-        'OCA\\User_LDAP\\Migration\\SetDefaultProvider' => __DIR__ . '/..' . '/../lib/Migration/SetDefaultProvider.php',
70
-        'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__ . '/..' . '/../lib/Migration/UUIDFix.php',
71
-        'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixGroup.php',
72
-        'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixInsert.php',
73
-        'OCA\\User_LDAP\\Migration\\UUIDFixUser' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixUser.php',
74
-        'OCA\\User_LDAP\\Migration\\Version1010Date20200630192842' => __DIR__ . '/..' . '/../lib/Migration/Version1010Date20200630192842.php',
75
-        'OCA\\User_LDAP\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
76
-        'OCA\\User_LDAP\\PagedResults\\IAdapter' => __DIR__ . '/..' . '/../lib/PagedResults/IAdapter.php',
77
-        'OCA\\User_LDAP\\PagedResults\\Php54' => __DIR__ . '/..' . '/../lib/PagedResults/Php54.php',
78
-        'OCA\\User_LDAP\\PagedResults\\Php73' => __DIR__ . '/..' . '/../lib/PagedResults/Php73.php',
79
-        'OCA\\User_LDAP\\PagedResults\\TLinkId' => __DIR__ . '/..' . '/../lib/PagedResults/TLinkId.php',
80
-        'OCA\\User_LDAP\\Proxy' => __DIR__ . '/..' . '/../lib/Proxy.php',
81
-        'OCA\\User_LDAP\\Settings\\Admin' => __DIR__ . '/..' . '/../lib/Settings/Admin.php',
82
-        'OCA\\User_LDAP\\Settings\\Section' => __DIR__ . '/..' . '/../lib/Settings/Section.php',
83
-        'OCA\\User_LDAP\\UserPluginManager' => __DIR__ . '/..' . '/../lib/UserPluginManager.php',
84
-        'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__ . '/..' . '/../lib/User/DeletedUsersIndex.php',
85
-        'OCA\\User_LDAP\\User\\Manager' => __DIR__ . '/..' . '/../lib/User/Manager.php',
86
-        'OCA\\User_LDAP\\User\\OfflineUser' => __DIR__ . '/..' . '/../lib/User/OfflineUser.php',
87
-        'OCA\\User_LDAP\\User\\User' => __DIR__ . '/..' . '/../lib/User/User.php',
88
-        'OCA\\User_LDAP\\User_LDAP' => __DIR__ . '/..' . '/../lib/User_LDAP.php',
89
-        'OCA\\User_LDAP\\User_Proxy' => __DIR__ . '/..' . '/../lib/User_Proxy.php',
90
-        'OCA\\User_LDAP\\Wizard' => __DIR__ . '/..' . '/../lib/Wizard.php',
91
-        'OCA\\User_LDAP\\WizardResult' => __DIR__ . '/..' . '/../lib/WizardResult.php',
23
+    public static $classMap = array(
24
+        'OCA\\User_LDAP\\Access' => __DIR__.'/..'.'/../lib/Access.php',
25
+        'OCA\\User_LDAP\\AccessFactory' => __DIR__.'/..'.'/../lib/AccessFactory.php',
26
+        'OCA\\User_LDAP\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
27
+        'OCA\\User_LDAP\\BackendUtility' => __DIR__.'/..'.'/../lib/BackendUtility.php',
28
+        'OCA\\User_LDAP\\Command\\CheckUser' => __DIR__.'/..'.'/../lib/Command/CheckUser.php',
29
+        'OCA\\User_LDAP\\Command\\CreateEmptyConfig' => __DIR__.'/..'.'/../lib/Command/CreateEmptyConfig.php',
30
+        'OCA\\User_LDAP\\Command\\DeleteConfig' => __DIR__.'/..'.'/../lib/Command/DeleteConfig.php',
31
+        'OCA\\User_LDAP\\Command\\Search' => __DIR__.'/..'.'/../lib/Command/Search.php',
32
+        'OCA\\User_LDAP\\Command\\SetConfig' => __DIR__.'/..'.'/../lib/Command/SetConfig.php',
33
+        'OCA\\User_LDAP\\Command\\ShowConfig' => __DIR__.'/..'.'/../lib/Command/ShowConfig.php',
34
+        'OCA\\User_LDAP\\Command\\ShowRemnants' => __DIR__.'/..'.'/../lib/Command/ShowRemnants.php',
35
+        'OCA\\User_LDAP\\Command\\TestConfig' => __DIR__.'/..'.'/../lib/Command/TestConfig.php',
36
+        'OCA\\User_LDAP\\Configuration' => __DIR__.'/..'.'/../lib/Configuration.php',
37
+        'OCA\\User_LDAP\\Connection' => __DIR__.'/..'.'/../lib/Connection.php',
38
+        'OCA\\User_LDAP\\ConnectionFactory' => __DIR__.'/..'.'/../lib/ConnectionFactory.php',
39
+        'OCA\\User_LDAP\\Controller\\ConfigAPIController' => __DIR__.'/..'.'/../lib/Controller/ConfigAPIController.php',
40
+        'OCA\\User_LDAP\\Controller\\RenewPasswordController' => __DIR__.'/..'.'/../lib/Controller/RenewPasswordController.php',
41
+        'OCA\\User_LDAP\\Events\\GroupBackendRegistered' => __DIR__.'/..'.'/../lib/Events/GroupBackendRegistered.php',
42
+        'OCA\\User_LDAP\\Events\\UserBackendRegistered' => __DIR__.'/..'.'/../lib/Events/UserBackendRegistered.php',
43
+        'OCA\\User_LDAP\\Exceptions\\AttributeNotSet' => __DIR__.'/..'.'/../lib/Exceptions/AttributeNotSet.php',
44
+        'OCA\\User_LDAP\\Exceptions\\ConstraintViolationException' => __DIR__.'/..'.'/../lib/Exceptions/ConstraintViolationException.php',
45
+        'OCA\\User_LDAP\\Exceptions\\NotOnLDAP' => __DIR__.'/..'.'/../lib/Exceptions/NotOnLDAP.php',
46
+        'OCA\\User_LDAP\\FilesystemHelper' => __DIR__.'/..'.'/../lib/FilesystemHelper.php',
47
+        'OCA\\User_LDAP\\GroupPluginManager' => __DIR__.'/..'.'/../lib/GroupPluginManager.php',
48
+        'OCA\\User_LDAP\\Group_LDAP' => __DIR__.'/..'.'/../lib/Group_LDAP.php',
49
+        'OCA\\User_LDAP\\Group_Proxy' => __DIR__.'/..'.'/../lib/Group_Proxy.php',
50
+        'OCA\\User_LDAP\\Handler\\ExtStorageConfigHandler' => __DIR__.'/..'.'/../lib/Handler/ExtStorageConfigHandler.php',
51
+        'OCA\\User_LDAP\\Helper' => __DIR__.'/..'.'/../lib/Helper.php',
52
+        'OCA\\User_LDAP\\IGroupLDAP' => __DIR__.'/..'.'/../lib/IGroupLDAP.php',
53
+        'OCA\\User_LDAP\\ILDAPGroupPlugin' => __DIR__.'/..'.'/../lib/ILDAPGroupPlugin.php',
54
+        'OCA\\User_LDAP\\ILDAPUserPlugin' => __DIR__.'/..'.'/../lib/ILDAPUserPlugin.php',
55
+        'OCA\\User_LDAP\\ILDAPWrapper' => __DIR__.'/..'.'/../lib/ILDAPWrapper.php',
56
+        'OCA\\User_LDAP\\IUserLDAP' => __DIR__.'/..'.'/../lib/IUserLDAP.php',
57
+        'OCA\\User_LDAP\\Jobs\\CleanUp' => __DIR__.'/..'.'/../lib/Jobs/CleanUp.php',
58
+        'OCA\\User_LDAP\\Jobs\\Sync' => __DIR__.'/..'.'/../lib/Jobs/Sync.php',
59
+        'OCA\\User_LDAP\\Jobs\\UpdateGroups' => __DIR__.'/..'.'/../lib/Jobs/UpdateGroups.php',
60
+        'OCA\\User_LDAP\\LDAP' => __DIR__.'/..'.'/../lib/LDAP.php',
61
+        'OCA\\User_LDAP\\LDAPProvider' => __DIR__.'/..'.'/../lib/LDAPProvider.php',
62
+        'OCA\\User_LDAP\\LDAPProviderFactory' => __DIR__.'/..'.'/../lib/LDAPProviderFactory.php',
63
+        'OCA\\User_LDAP\\LDAPUtility' => __DIR__.'/..'.'/../lib/LDAPUtility.php',
64
+        'OCA\\User_LDAP\\LogWrapper' => __DIR__.'/..'.'/../lib/LogWrapper.php',
65
+        'OCA\\User_LDAP\\Mapping\\AbstractMapping' => __DIR__.'/..'.'/../lib/Mapping/AbstractMapping.php',
66
+        'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__.'/..'.'/../lib/Mapping/GroupMapping.php',
67
+        'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__.'/..'.'/../lib/Mapping/UserMapping.php',
68
+        'OCA\\User_LDAP\\Migration\\RemoveRefreshTime' => __DIR__.'/..'.'/../lib/Migration/RemoveRefreshTime.php',
69
+        'OCA\\User_LDAP\\Migration\\SetDefaultProvider' => __DIR__.'/..'.'/../lib/Migration/SetDefaultProvider.php',
70
+        'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__.'/..'.'/../lib/Migration/UUIDFix.php',
71
+        'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__.'/..'.'/../lib/Migration/UUIDFixGroup.php',
72
+        'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__.'/..'.'/../lib/Migration/UUIDFixInsert.php',
73
+        'OCA\\User_LDAP\\Migration\\UUIDFixUser' => __DIR__.'/..'.'/../lib/Migration/UUIDFixUser.php',
74
+        'OCA\\User_LDAP\\Migration\\Version1010Date20200630192842' => __DIR__.'/..'.'/../lib/Migration/Version1010Date20200630192842.php',
75
+        'OCA\\User_LDAP\\Notification\\Notifier' => __DIR__.'/..'.'/../lib/Notification/Notifier.php',
76
+        'OCA\\User_LDAP\\PagedResults\\IAdapter' => __DIR__.'/..'.'/../lib/PagedResults/IAdapter.php',
77
+        'OCA\\User_LDAP\\PagedResults\\Php54' => __DIR__.'/..'.'/../lib/PagedResults/Php54.php',
78
+        'OCA\\User_LDAP\\PagedResults\\Php73' => __DIR__.'/..'.'/../lib/PagedResults/Php73.php',
79
+        'OCA\\User_LDAP\\PagedResults\\TLinkId' => __DIR__.'/..'.'/../lib/PagedResults/TLinkId.php',
80
+        'OCA\\User_LDAP\\Proxy' => __DIR__.'/..'.'/../lib/Proxy.php',
81
+        'OCA\\User_LDAP\\Settings\\Admin' => __DIR__.'/..'.'/../lib/Settings/Admin.php',
82
+        'OCA\\User_LDAP\\Settings\\Section' => __DIR__.'/..'.'/../lib/Settings/Section.php',
83
+        'OCA\\User_LDAP\\UserPluginManager' => __DIR__.'/..'.'/../lib/UserPluginManager.php',
84
+        'OCA\\User_LDAP\\User\\DeletedUsersIndex' => __DIR__.'/..'.'/../lib/User/DeletedUsersIndex.php',
85
+        'OCA\\User_LDAP\\User\\Manager' => __DIR__.'/..'.'/../lib/User/Manager.php',
86
+        'OCA\\User_LDAP\\User\\OfflineUser' => __DIR__.'/..'.'/../lib/User/OfflineUser.php',
87
+        'OCA\\User_LDAP\\User\\User' => __DIR__.'/..'.'/../lib/User/User.php',
88
+        'OCA\\User_LDAP\\User_LDAP' => __DIR__.'/..'.'/../lib/User_LDAP.php',
89
+        'OCA\\User_LDAP\\User_Proxy' => __DIR__.'/..'.'/../lib/User_Proxy.php',
90
+        'OCA\\User_LDAP\\Wizard' => __DIR__.'/..'.'/../lib/Wizard.php',
91
+        'OCA\\User_LDAP\\WizardResult' => __DIR__.'/..'.'/../lib/WizardResult.php',
92 92
     );
93 93
 
94 94
     public static function getInitializer(ClassLoader $loader)
95 95
     {
96
-        return \Closure::bind(function () use ($loader) {
96
+        return \Closure::bind(function() use ($loader) {
97 97
             $loader->prefixLengthsPsr4 = ComposerStaticInitUser_LDAP::$prefixLengthsPsr4;
98 98
             $loader->prefixDirsPsr4 = ComposerStaticInitUser_LDAP::$prefixDirsPsr4;
99 99
             $loader->classMap = ComposerStaticInitUser_LDAP::$classMap;
Please login to merge, or discard this patch.
apps/user_ldap/lib/Helper.php 1 patch
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -41,257 +41,257 @@
 block discarded – undo
41 41
 
42 42
 class Helper {
43 43
 
44
-	/** @var IConfig */
45
-	private $config;
46
-
47
-	/** @var IDBConnection */
48
-	private $connection;
49
-
50
-	/** @var CappedMemoryCache */
51
-	protected $sanitizeDnCache;
52
-
53
-	public function __construct(IConfig $config,
54
-								IDBConnection $connection) {
55
-		$this->config = $config;
56
-		$this->connection = $connection;
57
-		$this->sanitizeDnCache = new CappedMemoryCache(10000);
58
-	}
59
-
60
-	/**
61
-	 * returns prefixes for each saved LDAP/AD server configuration.
62
-	 *
63
-	 * @param bool $activeConfigurations optional, whether only active configuration shall be
64
-	 * retrieved, defaults to false
65
-	 * @return array with a list of the available prefixes
66
-	 *
67
-	 * Configuration prefixes are used to set up configurations for n LDAP or
68
-	 * AD servers. Since configuration is stored in the database, table
69
-	 * appconfig under appid user_ldap, the common identifiers in column
70
-	 * 'configkey' have a prefix. The prefix for the very first server
71
-	 * configuration is empty.
72
-	 * Configkey Examples:
73
-	 * Server 1: ldap_login_filter
74
-	 * Server 2: s1_ldap_login_filter
75
-	 * Server 3: s2_ldap_login_filter
76
-	 *
77
-	 * The prefix needs to be passed to the constructor of Connection class,
78
-	 * except the default (first) server shall be connected to.
79
-	 *
80
-	 */
81
-	public function getServerConfigurationPrefixes($activeConfigurations = false): array {
82
-		$referenceConfigkey = 'ldap_configuration_active';
83
-
84
-		$keys = $this->getServersConfig($referenceConfigkey);
85
-
86
-		$prefixes = [];
87
-		foreach ($keys as $key) {
88
-			if ($activeConfigurations && $this->config->getAppValue('user_ldap', $key, '0') !== '1') {
89
-				continue;
90
-			}
91
-
92
-			$len = strlen($key) - strlen($referenceConfigkey);
93
-			$prefixes[] = substr($key, 0, $len);
94
-		}
95
-		asort($prefixes);
96
-
97
-		return $prefixes;
98
-	}
99
-
100
-	/**
101
-	 *
102
-	 * determines the host for every configured connection
103
-	 *
104
-	 * @return array an array with configprefix as keys
105
-	 *
106
-	 */
107
-	public function getServerConfigurationHosts() {
108
-		$referenceConfigkey = 'ldap_host';
109
-
110
-		$keys = $this->getServersConfig($referenceConfigkey);
111
-
112
-		$result = [];
113
-		foreach ($keys as $key) {
114
-			$len = strlen($key) - strlen($referenceConfigkey);
115
-			$prefix = substr($key, 0, $len);
116
-			$result[$prefix] = $this->config->getAppValue('user_ldap', $key);
117
-		}
118
-
119
-		return $result;
120
-	}
121
-
122
-	/**
123
-	 * return the next available configuration prefix
124
-	 *
125
-	 * @return string
126
-	 */
127
-	public function getNextServerConfigurationPrefix() {
128
-		$serverConnections = $this->getServerConfigurationPrefixes();
129
-
130
-		if (count($serverConnections) === 0) {
131
-			return 's01';
132
-		}
133
-
134
-		sort($serverConnections);
135
-		$lastKey = array_pop($serverConnections);
136
-		$lastNumber = (int)str_replace('s', '', $lastKey);
137
-		return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
138
-	}
139
-
140
-	private function getServersConfig($value) {
141
-		$regex = '/' . $value . '$/S';
142
-
143
-		$keys = $this->config->getAppKeys('user_ldap');
144
-		$result = [];
145
-		foreach ($keys as $key) {
146
-			if (preg_match($regex, $key) === 1) {
147
-				$result[] = $key;
148
-			}
149
-		}
150
-
151
-		return $result;
152
-	}
153
-
154
-	/**
155
-	 * deletes a given saved LDAP/AD server configuration.
156
-	 *
157
-	 * @param string $prefix the configuration prefix of the config to delete
158
-	 * @return bool true on success, false otherwise
159
-	 */
160
-	public function deleteServerConfiguration($prefix) {
161
-		if (!in_array($prefix, self::getServerConfigurationPrefixes())) {
162
-			return false;
163
-		}
164
-
165
-		$query = $this->connection->getQueryBuilder();
166
-		$query->delete('appconfig')
167
-			->where($query->expr()->eq('appid', $query->createNamedParameter('user_ldap')))
168
-			->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string)$prefix . '%')))
169
-			->andWhere($query->expr()->notIn('configkey', $query->createNamedParameter([
170
-				'enabled',
171
-				'installed_version',
172
-				'types',
173
-				'bgjUpdateGroupsLastRun',
174
-			], IQueryBuilder::PARAM_STR_ARRAY)));
175
-
176
-		if (empty($prefix)) {
177
-			$query->andWhere($query->expr()->notLike('configkey', $query->createNamedParameter('s%')));
178
-		}
179
-
180
-		$deletedRows = $query->execute();
181
-		return $deletedRows !== 0;
182
-	}
183
-
184
-	/**
185
-	 * checks whether there is one or more disabled LDAP configurations
186
-	 */
187
-	public function haveDisabledConfigurations(): bool {
188
-		$all = $this->getServerConfigurationPrefixes(false);
189
-		$active = $this->getServerConfigurationPrefixes(true);
190
-
191
-		return count($all) !== count($active) || count($all) === 0;
192
-	}
193
-
194
-	/**
195
-	 * extracts the domain from a given URL
196
-	 *
197
-	 * @param string $url the URL
198
-	 * @return string|false domain as string on success, false otherwise
199
-	 */
200
-	public function getDomainFromURL($url) {
201
-		$uinfo = parse_url($url);
202
-		if (!is_array($uinfo)) {
203
-			return false;
204
-		}
205
-
206
-		$domain = false;
207
-		if (isset($uinfo['host'])) {
208
-			$domain = $uinfo['host'];
209
-		} elseif (isset($uinfo['path'])) {
210
-			$domain = $uinfo['path'];
211
-		}
212
-
213
-		return $domain;
214
-	}
215
-
216
-	/**
217
-	 * sanitizes a DN received from the LDAP server
218
-	 *
219
-	 * @param array $dn the DN in question
220
-	 * @return array|string the sanitized DN
221
-	 */
222
-	public function sanitizeDN($dn) {
223
-		//treating multiple base DNs
224
-		if (is_array($dn)) {
225
-			$result = [];
226
-			foreach ($dn as $singleDN) {
227
-				$result[] = $this->sanitizeDN($singleDN);
228
-			}
229
-			return $result;
230
-		}
231
-
232
-		if (!is_string($dn)) {
233
-			throw new \LogicException('String expected ' . \gettype($dn) . ' given');
234
-		}
235
-
236
-		if (($sanitizedDn = $this->sanitizeDnCache->get($dn)) !== null) {
237
-			return $sanitizedDn;
238
-		}
239
-
240
-		//OID sometimes gives back DNs with whitespace after the comma
241
-		// a la "uid=foo, cn=bar, dn=..." We need to tackle this!
242
-		$sanitizedDn = preg_replace('/([^\\\]),(\s+)/u', '\1,', $dn);
243
-
244
-		//make comparisons and everything work
245
-		$sanitizedDn = mb_strtolower($sanitizedDn, 'UTF-8');
246
-
247
-		//escape DN values according to RFC 2253 – this is already done by ldap_explode_dn
248
-		//to use the DN in search filters, \ needs to be escaped to \5c additionally
249
-		//to use them in bases, we convert them back to simple backslashes in readAttribute()
250
-		$replacements = [
251
-			'\,' => '\5c2C',
252
-			'\=' => '\5c3D',
253
-			'\+' => '\5c2B',
254
-			'\<' => '\5c3C',
255
-			'\>' => '\5c3E',
256
-			'\;' => '\5c3B',
257
-			'\"' => '\5c22',
258
-			'\#' => '\5c23',
259
-			'(' => '\28',
260
-			')' => '\29',
261
-			'*' => '\2A',
262
-		];
263
-		$sanitizedDn = str_replace(array_keys($replacements), array_values($replacements), $sanitizedDn);
264
-		$this->sanitizeDnCache->set($dn, $sanitizedDn);
265
-
266
-		return $sanitizedDn;
267
-	}
268
-
269
-	/**
270
-	 * converts a stored DN so it can be used as base parameter for LDAP queries, internally we store them for usage in LDAP filters
271
-	 *
272
-	 * @param string $dn the DN
273
-	 * @return string
274
-	 */
275
-	public function DNasBaseParameter($dn) {
276
-		return str_ireplace('\\5c', '\\', $dn);
277
-	}
278
-
279
-	/**
280
-	 * listens to a hook thrown by server2server sharing and replaces the given
281
-	 * login name by a username, if it matches an LDAP user.
282
-	 *
283
-	 * @param array $param
284
-	 * @throws \Exception
285
-	 */
286
-	public static function loginName2UserName($param) {
287
-		if (!isset($param['uid'])) {
288
-			throw new \Exception('key uid is expected to be set in $param');
289
-		}
290
-
291
-		$userBackend = \OC::$server->get(User_Proxy::class);
292
-		$uid = $userBackend->loginName2UserName($param['uid']);
293
-		if ($uid !== false) {
294
-			$param['uid'] = $uid;
295
-		}
296
-	}
44
+    /** @var IConfig */
45
+    private $config;
46
+
47
+    /** @var IDBConnection */
48
+    private $connection;
49
+
50
+    /** @var CappedMemoryCache */
51
+    protected $sanitizeDnCache;
52
+
53
+    public function __construct(IConfig $config,
54
+                                IDBConnection $connection) {
55
+        $this->config = $config;
56
+        $this->connection = $connection;
57
+        $this->sanitizeDnCache = new CappedMemoryCache(10000);
58
+    }
59
+
60
+    /**
61
+     * returns prefixes for each saved LDAP/AD server configuration.
62
+     *
63
+     * @param bool $activeConfigurations optional, whether only active configuration shall be
64
+     * retrieved, defaults to false
65
+     * @return array with a list of the available prefixes
66
+     *
67
+     * Configuration prefixes are used to set up configurations for n LDAP or
68
+     * AD servers. Since configuration is stored in the database, table
69
+     * appconfig under appid user_ldap, the common identifiers in column
70
+     * 'configkey' have a prefix. The prefix for the very first server
71
+     * configuration is empty.
72
+     * Configkey Examples:
73
+     * Server 1: ldap_login_filter
74
+     * Server 2: s1_ldap_login_filter
75
+     * Server 3: s2_ldap_login_filter
76
+     *
77
+     * The prefix needs to be passed to the constructor of Connection class,
78
+     * except the default (first) server shall be connected to.
79
+     *
80
+     */
81
+    public function getServerConfigurationPrefixes($activeConfigurations = false): array {
82
+        $referenceConfigkey = 'ldap_configuration_active';
83
+
84
+        $keys = $this->getServersConfig($referenceConfigkey);
85
+
86
+        $prefixes = [];
87
+        foreach ($keys as $key) {
88
+            if ($activeConfigurations && $this->config->getAppValue('user_ldap', $key, '0') !== '1') {
89
+                continue;
90
+            }
91
+
92
+            $len = strlen($key) - strlen($referenceConfigkey);
93
+            $prefixes[] = substr($key, 0, $len);
94
+        }
95
+        asort($prefixes);
96
+
97
+        return $prefixes;
98
+    }
99
+
100
+    /**
101
+     *
102
+     * determines the host for every configured connection
103
+     *
104
+     * @return array an array with configprefix as keys
105
+     *
106
+     */
107
+    public function getServerConfigurationHosts() {
108
+        $referenceConfigkey = 'ldap_host';
109
+
110
+        $keys = $this->getServersConfig($referenceConfigkey);
111
+
112
+        $result = [];
113
+        foreach ($keys as $key) {
114
+            $len = strlen($key) - strlen($referenceConfigkey);
115
+            $prefix = substr($key, 0, $len);
116
+            $result[$prefix] = $this->config->getAppValue('user_ldap', $key);
117
+        }
118
+
119
+        return $result;
120
+    }
121
+
122
+    /**
123
+     * return the next available configuration prefix
124
+     *
125
+     * @return string
126
+     */
127
+    public function getNextServerConfigurationPrefix() {
128
+        $serverConnections = $this->getServerConfigurationPrefixes();
129
+
130
+        if (count($serverConnections) === 0) {
131
+            return 's01';
132
+        }
133
+
134
+        sort($serverConnections);
135
+        $lastKey = array_pop($serverConnections);
136
+        $lastNumber = (int)str_replace('s', '', $lastKey);
137
+        return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
138
+    }
139
+
140
+    private function getServersConfig($value) {
141
+        $regex = '/' . $value . '$/S';
142
+
143
+        $keys = $this->config->getAppKeys('user_ldap');
144
+        $result = [];
145
+        foreach ($keys as $key) {
146
+            if (preg_match($regex, $key) === 1) {
147
+                $result[] = $key;
148
+            }
149
+        }
150
+
151
+        return $result;
152
+    }
153
+
154
+    /**
155
+     * deletes a given saved LDAP/AD server configuration.
156
+     *
157
+     * @param string $prefix the configuration prefix of the config to delete
158
+     * @return bool true on success, false otherwise
159
+     */
160
+    public function deleteServerConfiguration($prefix) {
161
+        if (!in_array($prefix, self::getServerConfigurationPrefixes())) {
162
+            return false;
163
+        }
164
+
165
+        $query = $this->connection->getQueryBuilder();
166
+        $query->delete('appconfig')
167
+            ->where($query->expr()->eq('appid', $query->createNamedParameter('user_ldap')))
168
+            ->andWhere($query->expr()->like('configkey', $query->createNamedParameter((string)$prefix . '%')))
169
+            ->andWhere($query->expr()->notIn('configkey', $query->createNamedParameter([
170
+                'enabled',
171
+                'installed_version',
172
+                'types',
173
+                'bgjUpdateGroupsLastRun',
174
+            ], IQueryBuilder::PARAM_STR_ARRAY)));
175
+
176
+        if (empty($prefix)) {
177
+            $query->andWhere($query->expr()->notLike('configkey', $query->createNamedParameter('s%')));
178
+        }
179
+
180
+        $deletedRows = $query->execute();
181
+        return $deletedRows !== 0;
182
+    }
183
+
184
+    /**
185
+     * checks whether there is one or more disabled LDAP configurations
186
+     */
187
+    public function haveDisabledConfigurations(): bool {
188
+        $all = $this->getServerConfigurationPrefixes(false);
189
+        $active = $this->getServerConfigurationPrefixes(true);
190
+
191
+        return count($all) !== count($active) || count($all) === 0;
192
+    }
193
+
194
+    /**
195
+     * extracts the domain from a given URL
196
+     *
197
+     * @param string $url the URL
198
+     * @return string|false domain as string on success, false otherwise
199
+     */
200
+    public function getDomainFromURL($url) {
201
+        $uinfo = parse_url($url);
202
+        if (!is_array($uinfo)) {
203
+            return false;
204
+        }
205
+
206
+        $domain = false;
207
+        if (isset($uinfo['host'])) {
208
+            $domain = $uinfo['host'];
209
+        } elseif (isset($uinfo['path'])) {
210
+            $domain = $uinfo['path'];
211
+        }
212
+
213
+        return $domain;
214
+    }
215
+
216
+    /**
217
+     * sanitizes a DN received from the LDAP server
218
+     *
219
+     * @param array $dn the DN in question
220
+     * @return array|string the sanitized DN
221
+     */
222
+    public function sanitizeDN($dn) {
223
+        //treating multiple base DNs
224
+        if (is_array($dn)) {
225
+            $result = [];
226
+            foreach ($dn as $singleDN) {
227
+                $result[] = $this->sanitizeDN($singleDN);
228
+            }
229
+            return $result;
230
+        }
231
+
232
+        if (!is_string($dn)) {
233
+            throw new \LogicException('String expected ' . \gettype($dn) . ' given');
234
+        }
235
+
236
+        if (($sanitizedDn = $this->sanitizeDnCache->get($dn)) !== null) {
237
+            return $sanitizedDn;
238
+        }
239
+
240
+        //OID sometimes gives back DNs with whitespace after the comma
241
+        // a la "uid=foo, cn=bar, dn=..." We need to tackle this!
242
+        $sanitizedDn = preg_replace('/([^\\\]),(\s+)/u', '\1,', $dn);
243
+
244
+        //make comparisons and everything work
245
+        $sanitizedDn = mb_strtolower($sanitizedDn, 'UTF-8');
246
+
247
+        //escape DN values according to RFC 2253 – this is already done by ldap_explode_dn
248
+        //to use the DN in search filters, \ needs to be escaped to \5c additionally
249
+        //to use them in bases, we convert them back to simple backslashes in readAttribute()
250
+        $replacements = [
251
+            '\,' => '\5c2C',
252
+            '\=' => '\5c3D',
253
+            '\+' => '\5c2B',
254
+            '\<' => '\5c3C',
255
+            '\>' => '\5c3E',
256
+            '\;' => '\5c3B',
257
+            '\"' => '\5c22',
258
+            '\#' => '\5c23',
259
+            '(' => '\28',
260
+            ')' => '\29',
261
+            '*' => '\2A',
262
+        ];
263
+        $sanitizedDn = str_replace(array_keys($replacements), array_values($replacements), $sanitizedDn);
264
+        $this->sanitizeDnCache->set($dn, $sanitizedDn);
265
+
266
+        return $sanitizedDn;
267
+    }
268
+
269
+    /**
270
+     * converts a stored DN so it can be used as base parameter for LDAP queries, internally we store them for usage in LDAP filters
271
+     *
272
+     * @param string $dn the DN
273
+     * @return string
274
+     */
275
+    public function DNasBaseParameter($dn) {
276
+        return str_ireplace('\\5c', '\\', $dn);
277
+    }
278
+
279
+    /**
280
+     * listens to a hook thrown by server2server sharing and replaces the given
281
+     * login name by a username, if it matches an LDAP user.
282
+     *
283
+     * @param array $param
284
+     * @throws \Exception
285
+     */
286
+    public static function loginName2UserName($param) {
287
+        if (!isset($param['uid'])) {
288
+            throw new \Exception('key uid is expected to be set in $param');
289
+        }
290
+
291
+        $userBackend = \OC::$server->get(User_Proxy::class);
292
+        $uid = $userBackend->loginName2UserName($param['uid']);
293
+        if ($uid !== false) {
294
+            $param['uid'] = $uid;
295
+        }
296
+    }
297 297
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/SetDefaultProvider.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@
 block discarded – undo
33 33
 
34 34
 class SetDefaultProvider implements IRepairStep {
35 35
 
36
-	/** @var IConfig */
37
-	private $config;
38
-
39
-	/** @var Helper */
40
-	private $helper;
41
-
42
-	public function __construct(IConfig $config,
43
-								Helper $helper) {
44
-		$this->config = $config;
45
-		$this->helper = $helper;
46
-	}
47
-
48
-	public function getName(): string {
49
-		return 'Set default LDAP provider';
50
-	}
51
-
52
-	public function run(IOutput $output): void {
53
-		$current = $this->config->getSystemValue('ldapProviderFactory', null);
54
-		if ($current === null) {
55
-			$this->config->setSystemValue('ldapProviderFactory', LDAPProviderFactory::class);
56
-		}
57
-	}
36
+    /** @var IConfig */
37
+    private $config;
38
+
39
+    /** @var Helper */
40
+    private $helper;
41
+
42
+    public function __construct(IConfig $config,
43
+                                Helper $helper) {
44
+        $this->config = $config;
45
+        $this->helper = $helper;
46
+    }
47
+
48
+    public function getName(): string {
49
+        return 'Set default LDAP provider';
50
+    }
51
+
52
+    public function run(IOutput $output): void {
53
+        $current = $this->config->getSystemValue('ldapProviderFactory', null);
54
+        if ($current === null) {
55
+            $this->config->setSystemValue('ldapProviderFactory', LDAPProviderFactory::class);
56
+        }
57
+    }
58 58
 }
Please login to merge, or discard this patch.