diff options
author | Joas Schilling <coding@schilljs.com> | 2023-11-23 10:22:34 +0100 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2023-11-23 10:36:13 +0100 |
commit | aa5f037af71c915424c6dcfd5ad2dc82797dc0d6 (patch) | |
tree | 843203cd1346158aab3515687e37a90e78c929e9 /apps/user_ldap/lib/Command | |
parent | 272719ed1cba6836ea0a597bb9767754eeb1e0d4 (diff) | |
download | nextcloud-server-aa5f037af71c915424c6dcfd5ad2dc82797dc0d6.tar.gz nextcloud-server-aa5f037af71c915424c6dcfd5ad2dc82797dc0d6.zip |
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'apps/user_ldap/lib/Command')
-rw-r--r-- | apps/user_ldap/lib/Command/CheckUser.php | 18 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/DeleteConfig.php | 8 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/Search.php | 42 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/SetConfig.php | 24 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/ShowConfig.php | 30 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/UpdateUUID.php | 27 |
6 files changed, 74 insertions, 75 deletions
diff --git a/apps/user_ldap/lib/Command/CheckUser.php b/apps/user_ldap/lib/Command/CheckUser.php index 6ccfc9c19ea..1174408cb49 100644 --- a/apps/user_ldap/lib/Command/CheckUser.php +++ b/apps/user_ldap/lib/Command/CheckUser.php @@ -62,16 +62,16 @@ class CheckUser extends Command { ->setName('ldap:check-user') ->setDescription('checks whether a user exists on LDAP.') ->addArgument( - 'ocName', - InputArgument::REQUIRED, - 'the user name as used in Nextcloud, or the LDAP DN' - ) + 'ocName', + InputArgument::REQUIRED, + 'the user name as used in Nextcloud, or the LDAP DN' + ) ->addOption( - 'force', - null, - InputOption::VALUE_NONE, - 'ignores disabled LDAP configuration' - ) + 'force', + null, + InputOption::VALUE_NONE, + 'ignores disabled LDAP configuration' + ) ->addOption( 'update', null, diff --git a/apps/user_ldap/lib/Command/DeleteConfig.php b/apps/user_ldap/lib/Command/DeleteConfig.php index 707fd455611..8da77c29671 100644 --- a/apps/user_ldap/lib/Command/DeleteConfig.php +++ b/apps/user_ldap/lib/Command/DeleteConfig.php @@ -47,10 +47,10 @@ class DeleteConfig extends Command { ->setName('ldap:delete-config') ->setDescription('deletes an existing LDAP configuration') ->addArgument( - 'configID', - InputArgument::REQUIRED, - 'the configuration ID' - ) + 'configID', + InputArgument::REQUIRED, + 'the configuration ID' + ) ; } diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index 96c4df4b2bf..748bf873e64 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -58,30 +58,30 @@ class Search extends Command { ->setName('ldap:search') ->setDescription('executes a user or group search') ->addArgument( - 'search', - InputArgument::REQUIRED, - 'the search string (can be empty)' - ) + 'search', + InputArgument::REQUIRED, + 'the search string (can be empty)' + ) ->addOption( - 'group', - null, - InputOption::VALUE_NONE, - 'searches groups instead of users' - ) + 'group', + null, + InputOption::VALUE_NONE, + 'searches groups instead of users' + ) ->addOption( - 'offset', - null, - InputOption::VALUE_REQUIRED, - 'The offset of the result set. Needs to be a multiple of limit. defaults to 0.', - '0' - ) + 'offset', + null, + InputOption::VALUE_REQUIRED, + 'The offset of the result set. Needs to be a multiple of limit. defaults to 0.', + '0' + ) ->addOption( - 'limit', - null, - InputOption::VALUE_REQUIRED, - 'limit the results. 0 means no limit, defaults to 15', - '15' - ) + 'limit', + null, + InputOption::VALUE_REQUIRED, + 'limit the results. 0 means no limit, defaults to 15', + '15' + ) ; } diff --git a/apps/user_ldap/lib/Command/SetConfig.php b/apps/user_ldap/lib/Command/SetConfig.php index 2b487787c8a..8cf100ecd0a 100644 --- a/apps/user_ldap/lib/Command/SetConfig.php +++ b/apps/user_ldap/lib/Command/SetConfig.php @@ -40,20 +40,20 @@ class SetConfig extends Command { ->setName('ldap:set-config') ->setDescription('modifies an LDAP configuration') ->addArgument( - 'configID', - InputArgument::REQUIRED, - 'the configuration ID' - ) + 'configID', + InputArgument::REQUIRED, + 'the configuration ID' + ) ->addArgument( - 'configKey', - InputArgument::REQUIRED, - 'the configuration key' - ) + 'configKey', + InputArgument::REQUIRED, + 'the configuration key' + ) ->addArgument( - 'configValue', - InputArgument::REQUIRED, - 'the new configuration value' - ) + 'configValue', + InputArgument::REQUIRED, + 'the new configuration value' + ) ; } diff --git a/apps/user_ldap/lib/Command/ShowConfig.php b/apps/user_ldap/lib/Command/ShowConfig.php index 4997d9737a5..6ff30739217 100644 --- a/apps/user_ldap/lib/Command/ShowConfig.php +++ b/apps/user_ldap/lib/Command/ShowConfig.php @@ -52,23 +52,23 @@ class ShowConfig extends Base { ->setName('ldap:show-config') ->setDescription('shows the LDAP configuration') ->addArgument( - 'configID', - InputArgument::OPTIONAL, - 'will show the configuration of the specified id' - ) + 'configID', + InputArgument::OPTIONAL, + 'will show the configuration of the specified id' + ) ->addOption( - 'show-password', - null, - InputOption::VALUE_NONE, - 'show ldap bind password' - ) + 'show-password', + null, + InputOption::VALUE_NONE, + 'show ldap bind password' + ) ->addOption( - 'output', - null, - InputOption::VALUE_OPTIONAL, - 'Output format (table, plain, json or json_pretty, default is table)', - 'table' - ) + 'output', + null, + InputOption::VALUE_OPTIONAL, + 'Output format (table, plain, json or json_pretty, default is table)', + 'table' + ) ; } diff --git a/apps/user_ldap/lib/Command/UpdateUUID.php b/apps/user_ldap/lib/Command/UpdateUUID.php index 716bc2d0563..57863a11ec8 100644 --- a/apps/user_ldap/lib/Command/UpdateUUID.php +++ b/apps/user_ldap/lib/Command/UpdateUUID.php @@ -42,12 +42,12 @@ use Symfony\Component\Console\Output\OutputInterface; use function sprintf; class UuidUpdateReport { - const UNCHANGED = 0; - const UNKNOWN = 1; - const UNREADABLE = 2; - const UPDATED = 3; - const UNWRITABLE = 4; - const UNMAPPED = 5; + public const UNCHANGED = 0; + public const UNKNOWN = 1; + public const UNREADABLE = 2; + public const UPDATED = 3; + public const UNWRITABLE = 4; + public const UNMAPPED = 5; public $id = ''; public $dn = ''; @@ -178,7 +178,7 @@ class UpdateUUID extends Command { if (!empty($report->id)) { $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); - } else if (!empty($report->dn)) { + } elseif (!empty($report->dn)) { $output->writeln(sprintf(' DN: %s', $report->dn)); } } @@ -190,7 +190,7 @@ class UpdateUUID extends Command { if ($output->isVerbose()) { /** @var UuidUpdateReport $report */ foreach ($this->reports[UuidUpdateReport::UNKNOWN] as $report) { - $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id)); + $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); } $output->writeln(PHP_EOL . 'Old users can be removed along with their data per occ user:delete.' . PHP_EOL); } @@ -201,7 +201,7 @@ class UpdateUUID extends Command { if ($output->isVerbose()) { /** @var UuidUpdateReport $report */ foreach ($this->reports[UuidUpdateReport::UNREADABLE] as $report) { - $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id)); + $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); } } } @@ -211,7 +211,7 @@ class UpdateUUID extends Command { if ($output->isVerbose()) { /** @var UuidUpdateReport $report */ foreach ($this->reports[UuidUpdateReport::UNWRITABLE] as $report) { - $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id)); + $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id)); } } } @@ -222,7 +222,7 @@ class UpdateUUID extends Command { foreach($this->handleMappingBasedUpdates(false) as $_) { yield; } - } else if ($input->getOption('userId') + } elseif ($input->getOption('userId') || $input->getOption('groupId') || $input->getOption('dn') ) { @@ -326,8 +326,7 @@ class UpdateUUID extends Command { foreach ($list as $row) { $access = $backendProxy->getLDAPAccess($row['name']); if ($access instanceof Access - && $dn = $mapping->getDNByName($row['name'])) - { + && $dn = $mapping->getDNByName($row['name'])) { if ($uuid = $access->getUUID($dn, $isUser)) { if ($uuid !== $row['uuid']) { if ($this->dryRun || $mapping->setUUIDbyDN($uuid, $dn)) { @@ -359,7 +358,7 @@ class UpdateUUID extends Command { protected function estimateNumberOfUpdates(InputInterface $input): int { if ($input->getOption('all')) { return $this->userMapping->count() + $this->groupMapping->count(); - } else if ($input->getOption('userId') + } elseif ($input->getOption('userId') || $input->getOption('groupId') || $input->getOption('dn') ) { |