Skip to content

Commit 0a8ccd5

Browse files
Migrate LDAP's install.php to a repair step
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent 7718a8a commit 0a8ccd5

5 files changed

Lines changed: 64 additions & 33 deletions

File tree

apps/user_ldap/appinfo/info.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ A user logs into Nextcloud with their LDAP or AD credentials, and is granted acc
3434
</background-jobs>
3535

3636
<repair-steps>
37+
<install>
38+
<step>OCA\User_LDAP\Migration\SetDefaultProvider</step>
39+
</install>
3740
<post-migration>
3841
<step>OCA\User_LDAP\Migration\UUIDFixInsert</step>
3942
<step>OCA\User_LDAP\Migration\RemoveRefreshTime</step>

apps/user_ldap/appinfo/install.php

Lines changed: 0 additions & 33 deletions
This file was deleted.

apps/user_ldap/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
'OCA\\User_LDAP\\Mapping\\GroupMapping' => $baseDir . '/../lib/Mapping/GroupMapping.php',
5252
'OCA\\User_LDAP\\Mapping\\UserMapping' => $baseDir . '/../lib/Mapping/UserMapping.php',
5353
'OCA\\User_LDAP\\Migration\\RemoveRefreshTime' => $baseDir . '/../lib/Migration/RemoveRefreshTime.php',
54+
'OCA\\User_LDAP\\Migration\\SetDefaultProvider' => $baseDir . '/../lib/Migration/SetDefaultProvider.php',
5455
'OCA\\User_LDAP\\Migration\\UUIDFix' => $baseDir . '/../lib/Migration/UUIDFix.php',
5556
'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => $baseDir . '/../lib/Migration/UUIDFixGroup.php',
5657
'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => $baseDir . '/../lib/Migration/UUIDFixInsert.php',

apps/user_ldap/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ComposerStaticInitUser_LDAP
6666
'OCA\\User_LDAP\\Mapping\\GroupMapping' => __DIR__ . '/..' . '/../lib/Mapping/GroupMapping.php',
6767
'OCA\\User_LDAP\\Mapping\\UserMapping' => __DIR__ . '/..' . '/../lib/Mapping/UserMapping.php',
6868
'OCA\\User_LDAP\\Migration\\RemoveRefreshTime' => __DIR__ . '/..' . '/../lib/Migration/RemoveRefreshTime.php',
69+
'OCA\\User_LDAP\\Migration\\SetDefaultProvider' => __DIR__ . '/..' . '/../lib/Migration/SetDefaultProvider.php',
6970
'OCA\\User_LDAP\\Migration\\UUIDFix' => __DIR__ . '/..' . '/../lib/Migration/UUIDFix.php',
7071
'OCA\\User_LDAP\\Migration\\UUIDFixGroup' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixGroup.php',
7172
'OCA\\User_LDAP\\Migration\\UUIDFixInsert' => __DIR__ . '/..' . '/../lib/Migration/UUIDFixInsert.php',
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
7+
*
8+
* @author 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
9+
*
10+
* @license GNU AGPL version 3 or any later version
11+
*
12+
* This program is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU Affero General Public License as
14+
* published by the Free Software Foundation, either version 3 of the
15+
* License, or (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU Affero General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU Affero General Public License
23+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24+
*/
25+
26+
namespace OCA\User_LDAP\Migration;
27+
28+
use OCA\User_LDAP\Helper;
29+
use OCP\IConfig;
30+
use OCP\Migration\IOutput;
31+
use OCP\Migration\IRepairStep;
32+
33+
class SetDefaultProvider implements IRepairStep {
34+
35+
/** @var IConfig */
36+
private $config;
37+
38+
/** @var Helper */
39+
private $helper;
40+
41+
public function __construct(IConfig $config,
42+
Helper $helper) {
43+
$this->config = $config;
44+
$this->helper = $helper;
45+
}
46+
47+
public function getName(): string {
48+
return 'Set default LDAP provider';
49+
}
50+
51+
public function run(IOutput $output): void {
52+
$state = $this->config->getSystemValue('ldapIgnoreNamingRules', 'doSet');
53+
if ($state === 'doSet') {
54+
$this->config->setSystemValue('ldapIgnoreNamingRules', false);
55+
}
56+
57+
$this->helper->setLDAPProvider();
58+
}
59+
}

0 commit comments

Comments
 (0)