diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-19 11:10:31 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-19 14:21:20 +0200 |
commit | 9836e9b16484582d309c8437ab46d82e34956941 (patch) | |
tree | d3da87bb7dfd1a8877ed25072ecf609def844089 /apps/user_ldap | |
parent | 8c60ffa0f21414e6e671c567d664a9b9e5253e26 (diff) | |
download | nextcloud-server-9836e9b16484582d309c8437ab46d82e34956941.tar.gz nextcloud-server-9836e9b16484582d309c8437ab46d82e34956941.zip |
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/user_ldap')
34 files changed, 106 insertions, 106 deletions
diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index 8064ce92833..ccd96250d52 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -15,7 +15,7 @@ $serverConnections = $helper->getServerConfigurationPrefixes(); sort($serverConnections); $lk = array_pop($serverConnections); $ln = (int)str_replace('s', '', $lk); -$nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT); +$nk = 's' . str_pad($ln + 1, 2, '0', STR_PAD_LEFT); $resultData = ['configPrefix' => $nk]; diff --git a/apps/user_ldap/ajax/wizard.php b/apps/user_ldap/ajax/wizard.php index 5c2cddc7672..f1778677327 100644 --- a/apps/user_ldap/ajax/wizard.php +++ b/apps/user_ldap/ajax/wizard.php @@ -98,7 +98,7 @@ switch ($action) { $setParameters = []; $configuration->setConfiguration($cfg, $setParameters); if (!in_array($key, $setParameters)) { - \OC_JSON::error(['message' => $l->t($key. + \OC_JSON::error(['message' => $l->t($key . ' Could not set configuration %s', $setParameters[0])]); exit; } diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index dab8db20c99..81f3dc6cb70 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -624,7 +624,7 @@ class Access extends LDAPUtility { string $fdn, string $name, string $uuid, - bool $isUser + bool $isUser, ): bool { if ($mapper->map($fdn, $name, $uuid)) { if ($isUser) { @@ -1118,7 +1118,7 @@ class Access extends LDAPUtility { string $base, ?array &$attr, ?int $pageSize, - ?int $offset + ?int $offset, ) { // See if we have a resource, in case not cancel with message $cr = $this->connection->getConnectionResource(); @@ -1158,7 +1158,7 @@ class Access extends LDAPUtility { int $foundItems, int $limit, bool $pagedSearchOK, - bool $skipHandling + bool $skipHandling, ): bool { $cookie = ''; if ($pagedSearchOK) { @@ -1213,7 +1213,7 @@ class Access extends LDAPUtility { ?array $attr = null, int $limit = 0, int $offset = 0, - bool $skipHandling = false + bool $skipHandling = false, ) { $this->logger->debug('Count filter: {filter}', [ 'app' => 'user_ldap', @@ -1278,7 +1278,7 @@ class Access extends LDAPUtility { ?array $attr = null, ?int $limit = null, ?int $offset = null, - bool $skipHandling = false + bool $skipHandling = false, ): array { $limitPerPage = (int)$this->connection->ldapPagingSize; if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) { @@ -1983,7 +1983,7 @@ class Access extends LDAPUtility { string $base, ?array $attr, int $pageSize, - int $offset + int $offset, ): array { $pagedSearchOK = false; if ($pageSize !== 0) { diff --git a/apps/user_ldap/lib/AppInfo/Application.php b/apps/user_ldap/lib/AppInfo/Application.php index 400315442bb..e3f6f56152c 100644 --- a/apps/user_ldap/lib/AppInfo/Application.php +++ b/apps/user_ldap/lib/AppInfo/Application.php @@ -109,7 +109,7 @@ class Application extends App implements IBootstrap { IGroupManager $groupManager, User_Proxy $userBackend, Group_Proxy $groupBackend, - Helper $helper + Helper $helper, ) { $configPrefixes = $helper->getServerConfigurationPrefixes(true); if (count($configPrefixes) > 0) { diff --git a/apps/user_ldap/lib/Command/CheckGroup.php b/apps/user_ldap/lib/Command/CheckGroup.php index c376d0f890a..9c7ccb9d3b3 100644 --- a/apps/user_ldap/lib/Command/CheckGroup.php +++ b/apps/user_ldap/lib/Command/CheckGroup.php @@ -99,25 +99,25 @@ class CheckGroup extends Command { throw new \Exception('The given group is not a recognized LDAP group.'); } catch (\Exception $e) { - $output->writeln('<error>' . $e->getMessage(). '</error>'); + $output->writeln('<error>' . $e->getMessage() . '</error>'); return self::FAILURE; } } public function onGroupCreatedEvent(GroupCreatedEvent $event, OutputInterface $output): void { - $output->writeln('<info>The group '.$event->getGroup()->getGID().' was added to Nextcloud with '.$event->getGroup()->count().' users</info>'); + $output->writeln('<info>The group ' . $event->getGroup()->getGID() . ' was added to Nextcloud with ' . $event->getGroup()->count() . ' users</info>'); } public function onUserAddedEvent(UserAddedEvent $event, OutputInterface $output): void { $user = $event->getUser(); $group = $event->getGroup(); - $output->writeln('<info>The user '.$user->getUID().' was added to group '.$group->getGID().'</info>'); + $output->writeln('<info>The user ' . $user->getUID() . ' was added to group ' . $group->getGID() . '</info>'); } public function onUserRemovedEvent(UserRemovedEvent $event, OutputInterface $output): void { $user = $event->getUser(); $group = $event->getGroup(); - $output->writeln('<info>The user '.$user->getUID().' was removed from group '.$group->getGID().'</info>'); + $output->writeln('<info>The user ' . $user->getUID() . ' was removed from group ' . $group->getGID() . '</info>'); } /** diff --git a/apps/user_ldap/lib/Command/CheckUser.php b/apps/user_ldap/lib/Command/CheckUser.php index ebb416c24a6..d5bd0235b2c 100644 --- a/apps/user_ldap/lib/Command/CheckUser.php +++ b/apps/user_ldap/lib/Command/CheckUser.php @@ -84,7 +84,7 @@ class CheckUser extends Command { throw new \Exception('The given user is not a recognized LDAP user.'); } catch (\Exception $e) { - $output->writeln('<error>' . $e->getMessage(). '</error>'); + $output->writeln('<error>' . $e->getMessage() . '</error>'); return self::FAILURE; } } diff --git a/apps/user_ldap/lib/Command/PromoteGroup.php b/apps/user_ldap/lib/Command/PromoteGroup.php index bb5362e4700..b203a910b14 100644 --- a/apps/user_ldap/lib/Command/PromoteGroup.php +++ b/apps/user_ldap/lib/Command/PromoteGroup.php @@ -22,7 +22,7 @@ class PromoteGroup extends Command { public function __construct( private IGroupManager $groupManager, - private Group_Proxy $backend + private Group_Proxy $backend, ) { parent::__construct(); } diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index 4886e0c7638..fe1b9f34988 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -106,7 +106,7 @@ class Search extends Command { $result = $proxy->$getMethod($input->getArgument('search'), $limit, $offset); foreach ($result as $id => $name) { - $line = $name . ($printID ? ' ('.$id.')' : ''); + $line = $name . ($printID ? ' (' . $id . ')' : ''); $output->writeln($line); } return self::SUCCESS; diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index 9de180cad76..989d0bd3929 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -241,7 +241,7 @@ class Configuration { case 'homeFolderNamingRule': $trimmedVal = trim($val); if ($trimmedVal !== '' && !str_contains($val, 'attr:')) { - $val = 'attr:'.$trimmedVal; + $val = 'attr:' . $trimmedVal; } break; case 'ldapBase': @@ -450,7 +450,7 @@ class Configuration { $defaults = $this->getDefaults(); } return \OC::$server->getConfig()->getAppValue('user_ldap', - $this->configPrefix.$varName, + $this->configPrefix . $varName, $defaults[$varName]); } @@ -480,7 +480,7 @@ class Configuration { protected function saveValue(string $varName, string $value): bool { \OC::$server->getConfig()->setAppValue( 'user_ldap', - $this->configPrefix.$varName, + $this->configPrefix . $varName, $value ); return true; diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index b74c964eb72..757ba2d8e8a 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -259,11 +259,11 @@ class Connection extends LDAPUtility { * @param string|null $key */ private function getCacheKey($key): string { - $prefix = 'LDAP-'.$this->configID.'-'.$this->configPrefix.'-'; + $prefix = 'LDAP-' . $this->configID . '-' . $this->configPrefix . '-'; if (is_null($key)) { return $prefix; } - return $prefix.hash('sha256', $key); + return $prefix . hash('sha256', $key); } /** @@ -410,7 +410,7 @@ class Connection extends LDAPUtility { $this->configuration->$effectiveSetting = 'auto'; $this->configuration->saveConfiguration(); $this->logger->info( - 'Illegal value for the '.$effectiveSetting.', reset to autodetect.', + 'Illegal value for the ' . $effectiveSetting . ', reset to autodetect.', ['app' => 'user_ldap'] ); } @@ -480,7 +480,7 @@ class Connection extends LDAPUtility { } $configurationOK = false; $this->logger->warning( - $errorStr.'No '.$subj.' given!', + $errorStr . 'No ' . $subj . ' given!', ['app' => 'user_ldap'] ); } @@ -494,7 +494,7 @@ class Connection extends LDAPUtility { || ($agent !== '' && $pwd === '') ) { $this->logger->warning( - $errorStr.'either no password is given for the user ' . + $errorStr . 'either no password is given for the user ' . 'agent or a password is given, but not an LDAP agent.', ['app' => 'user_ldap'] ); @@ -507,7 +507,7 @@ class Connection extends LDAPUtility { if (empty($base) && empty($baseUsers) && empty($baseGroups)) { $this->logger->warning( - $errorStr.'Not a single Base DN given.', + $errorStr . 'Not a single Base DN given.', ['app' => 'user_ldap'] ); $configurationOK = false; @@ -516,7 +516,7 @@ class Connection extends LDAPUtility { if (mb_strpos((string)$this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8') === false) { $this->logger->warning( - $errorStr.'login filter does not contain %uid place holder.', + $errorStr . 'login filter does not contain %uid place holder.', ['app' => 'user_ldap'] ); $configurationOK = false; diff --git a/apps/user_ldap/lib/Controller/ConfigAPIController.php b/apps/user_ldap/lib/Controller/ConfigAPIController.php index 978aa005559..f4f55217ef1 100644 --- a/apps/user_ldap/lib/Controller/ConfigAPIController.php +++ b/apps/user_ldap/lib/Controller/ConfigAPIController.php @@ -33,7 +33,7 @@ class ConfigAPIController extends OCSController { Manager $keyManager, private Helper $ldapHelper, private LoggerInterface $logger, - private ConnectionFactory $connectionFactory + private ConnectionFactory $connectionFactory, ) { parent::__construct( $appName, diff --git a/apps/user_ldap/lib/GroupPluginManager.php b/apps/user_ldap/lib/GroupPluginManager.php index fca9f37d092..37622a53480 100644 --- a/apps/user_ldap/lib/GroupPluginManager.php +++ b/apps/user_ldap/lib/GroupPluginManager.php @@ -41,7 +41,7 @@ class GroupPluginManager { foreach ($this->which as $action => $v) { if ((bool)($respondToActions & $action)) { $this->which[$action] = $plugin; - \OCP\Server::get(LoggerInterface::class)->debug('Registered action '.$action.' to plugin '.get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug('Registered action ' . $action . ' to plugin ' . get_class($plugin), ['app' => 'user_ldap']); } } } diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index d4d67b546d6..5fe5abf4c13 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -46,7 +46,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis Access $access, GroupPluginManager $groupPluginManager, IConfig $config, - IUserManager $ncUserManager + IUserManager $ncUserManager, ) { $this->access = $access; $filter = $this->access->connection->ldapGroupFilter; @@ -454,7 +454,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis string $groupDN, string $search = '', ?int $limit = -1, - ?int $offset = 0 + ?int $offset = 0, ): array { try { $filter = $this->prepareFilterForUsersHasGidNumber($groupDN, $search); @@ -578,7 +578,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis string $groupDN, string $search = '', ?int $limit = -1, - ?int $offset = 0 + ?int $offset = 0, ): array { try { $filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search); @@ -603,7 +603,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis string $groupDN, string $search = '', int $limit = -1, - int $offset = 0 + int $offset = 0, ): int { try { $filter = $this->prepareFilterForUsersInPrimaryGroup($groupDN, $search); @@ -1266,7 +1266,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis // Getting dn, if false the group is not mapped $dn = $this->access->groupname2dn($gid); if (!$dn) { - throw new Exception('Could not delete unknown group '.$gid.' in LDAP backend.'); + throw new Exception('Could not delete unknown group ' . $gid . ' in LDAP backend.'); } if (!$this->groupExists($gid)) { @@ -1276,7 +1276,7 @@ class Group_LDAP extends ABackend implements GroupInterface, IGroupLDAP, IGetDis return true; } - throw new Exception('Could not delete existing group '.$gid.' in LDAP backend.'); + throw new Exception('Could not delete existing group ' . $gid . ' in LDAP backend.'); } /** diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index 22c878ed067..b04dc67ef49 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -50,7 +50,7 @@ class CleanUp extends TimedJob { public function __construct( ITimeFactory $timeFactory, User_Proxy $userBackend, - DeletedUsersIndex $dui + DeletedUsersIndex $dui, ) { parent::__construct($timeFactory); $minutes = \OC::$server->getConfig()->getSystemValue( diff --git a/apps/user_ldap/lib/LDAPProvider.php b/apps/user_ldap/lib/LDAPProvider.php index 3b1568d1748..e7c507a265f 100644 --- a/apps/user_ldap/lib/LDAPProvider.php +++ b/apps/user_ldap/lib/LDAPProvider.php @@ -37,7 +37,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { $userBackendFound = false; $groupBackendFound = false; foreach ($serverContainer->getUserManager()->getBackends() as $backend) { - $this->logger->debug('instance '.get_class($backend).' user backend.', ['app' => 'user_ldap']); + $this->logger->debug('instance ' . get_class($backend) . ' user backend.', ['app' => 'user_ldap']); if ($backend instanceof IUserLDAP) { $this->userBackend = $backend; $userBackendFound = true; @@ -45,7 +45,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { } } foreach ($serverContainer->getGroupManager()->getBackends() as $backend) { - $this->logger->debug('instance '.get_class($backend).' group backend.', ['app' => 'user_ldap']); + $this->logger->debug('instance ' . get_class($backend) . ' group backend.', ['app' => 'user_ldap']); if ($backend instanceof IGroupLDAP) { $this->groupBackend = $backend; $groupBackendFound = true; diff --git a/apps/user_ldap/lib/Proxy.php b/apps/user_ldap/lib/Proxy.php index 285427bfd4d..88a55f6462d 100644 --- a/apps/user_ldap/lib/Proxy.php +++ b/apps/user_ldap/lib/Proxy.php @@ -22,7 +22,7 @@ abstract class Proxy { public function __construct( ILDAPWrapper $ldap, - AccessFactory $accessFactory + AccessFactory $accessFactory, ) { $this->ldap = $ldap; $this->accessFactory = $accessFactory; diff --git a/apps/user_ldap/lib/Settings/Admin.php b/apps/user_ldap/lib/Settings/Admin.php index 71532846b91..8fc0915c6fe 100644 --- a/apps/user_ldap/lib/Settings/Admin.php +++ b/apps/user_ldap/lib/Settings/Admin.php @@ -55,7 +55,7 @@ class Admin implements IDelegatedSettings { } $defaults = $config->getDefaults(); foreach ($defaults as $key => $default) { - $parameters[$key.'_default'] = $default; + $parameters[$key . '_default'] = $default; } return new TemplateResponse('user_ldap', 'settings', $parameters); diff --git a/apps/user_ldap/lib/SetupChecks/LdapConnection.php b/apps/user_ldap/lib/SetupChecks/LdapConnection.php index a33dd10f063..ee8c4ddd595 100644 --- a/apps/user_ldap/lib/SetupChecks/LdapConnection.php +++ b/apps/user_ldap/lib/SetupChecks/LdapConnection.php @@ -61,7 +61,7 @@ class LdapConnection implements ISetupCheck { 'Binding failed for %n LDAP configurations: %s', count($bindFailedConfigurations), [implode(',', $bindFailedConfigurations)] - )."\n"; + ) . "\n"; } if (!empty($searchFailedConfigurations)) { $output .= $this->l10n->n( @@ -69,7 +69,7 @@ class LdapConnection implements ISetupCheck { 'Searching failed for %n LDAP configurations: %s', count($searchFailedConfigurations), [implode(',', $searchFailedConfigurations)] - )."\n"; + ) . "\n"; } if (!empty($inactiveConfigurations)) { $output .= $this->l10n->n( @@ -77,7 +77,7 @@ class LdapConnection implements ISetupCheck { 'There are %n inactive LDAP configurations: %s', count($inactiveConfigurations), [implode(',', $inactiveConfigurations)] - )."\n"; + ) . "\n"; } if (!empty($bindFailedConfigurations) || !empty($searchFailedConfigurations)) { return SetupResult::error($output); diff --git a/apps/user_ldap/lib/User/DeletedUsersIndex.php b/apps/user_ldap/lib/User/DeletedUsersIndex.php index 4b5bb26fa96..515233b3825 100644 --- a/apps/user_ldap/lib/User/DeletedUsersIndex.php +++ b/apps/user_ldap/lib/User/DeletedUsersIndex.php @@ -22,7 +22,7 @@ class DeletedUsersIndex { public function __construct( IConfig $config, UserMapping $mapping, - IManager $shareManager + IManager $shareManager, ) { $this->config = $config; $this->mapping = $mapping; diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index bf1da54823c..5d5ad8b2658 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -49,7 +49,7 @@ class Manager { Image $image, IUserManager $userManager, INotificationManager $notificationManager, - IManager $shareManager + IManager $shareManager, ) { $this->ocConfig = $ocConfig; $this->ocFilesystem = $ocFilesystem; diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php index 24f11a5a1f9..eed715ccc1c 100644 --- a/apps/user_ldap/lib/User/OfflineUser.php +++ b/apps/user_ldap/lib/User/OfflineUser.php @@ -70,7 +70,7 @@ class OfflineUser { $ocName, IConfig $config, UserMapping $mapping, - IManager $shareManager + IManager $shareManager, ) { $this->ocName = $ocName; $this->config = $config; diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index f2a9ba49f2f..0688a843bd7 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -201,7 +201,7 @@ class User { } //memberOf groups - $cacheKey = 'getMemberOf'.$this->getUsername(); + $cacheKey = 'getMemberOf' . $this->getUsername(); $groups = false; if (isset($ldapEntry['memberof'])) { $groups = $ldapEntry['memberof']; @@ -217,7 +217,7 @@ class User { // check for cached profile data $username = $this->getUsername(); // buffer variable, to save resource - $cacheKey = 'getUserProfile-'.$username; + $cacheKey = 'getUserProfile-' . $username; $profileCached = $this->connection->getFromCache($cacheKey); // honoring profile disabled in config.php and check if user profile was refreshed if ($this->config->getSystemValueBool('profile.enabled', true) && @@ -404,7 +404,7 @@ class User { && $path[1] === ':' && ($path[2] === '\\' || $path[2] === '/')) ) { $path = $this->config->getSystemValue('datadirectory', - \OC::$SERVERROOT.'/data') . '/' . $path; + \OC::$SERVERROOT . '/data') . '/' . $path; } //we need it to store it in the DB as well in case a user gets //deleted so we can clean up afterwards @@ -427,7 +427,7 @@ class User { } public function getMemberOfGroups() { - $cacheKey = 'getMemberOf'.$this->getUsername(); + $cacheKey = 'getMemberOf' . $this->getUsername(); $memberOfGroups = $this->connection->getFromCache($cacheKey); if (!is_null($memberOfGroups)) { return $memberOfGroups; @@ -637,7 +637,7 @@ class User { // fetch/prepare user $user = $this->userManager->get($this->uid); if (is_null($user)) { - $this->logger->error('could not get user for uid='.$this->uid.'', ['app' => 'user_ldap']); + $this->logger->error('could not get user for uid=' . $this->uid . '', ['app' => 'user_ldap']); return; } // prepare AccountManager and Account @@ -654,22 +654,22 @@ class User { $currentValue = $accountProperty->getValue(); $scope = ($accountProperty->getScope() ?: $defaultScopes[$property]); } catch (PropertyDoesNotExistException $e) { // thrown at getProperty - $this->logger->error('property does not exist: '.$property - .' for uid='.$this->uid.'', ['app' => 'user_ldap', 'exception' => $e]); + $this->logger->error('property does not exist: ' . $property + . ' for uid=' . $this->uid . '', ['app' => 'user_ldap', 'exception' => $e]); $currentValue = ''; $scope = $defaultScopes[$property]; } $verified = IAccountManager::VERIFIED; // trust the LDAP admin knew what he put there if ($currentValue !== $value) { $account->setProperty($property, $value, $scope, $verified); - $this->logger->debug('update user profile: '.$property.'='.$value - .' for uid='.$this->uid.'', ['app' => 'user_ldap']); + $this->logger->debug('update user profile: ' . $property . '=' . $value + . ' for uid=' . $this->uid . '', ['app' => 'user_ldap']); } } try { $accountManager->updateAccount($account); // may throw InvalidArgumentException } catch (\InvalidArgumentException $e) { - $this->logger->error('invalid data from LDAP: for uid='.$this->uid.'', ['app' => 'user_ldap', 'func' => 'updateProfile' + $this->logger->error('invalid data from LDAP: for uid=' . $this->uid . '', ['app' => 'user_ldap', 'func' => 'updateProfile' , 'exception' => $e]); } } @@ -735,7 +735,7 @@ class User { */ private function setOwnCloudAvatar() { if (!$this->image->valid()) { - $this->logger->error('avatar image data from LDAP invalid for '.$this->dn, ['app' => 'user_ldap']); + $this->logger->error('avatar image data from LDAP invalid for ' . $this->dn, ['app' => 'user_ldap']); return false; } @@ -743,7 +743,7 @@ class User { //make sure it is a square and not bigger than 512x512 $size = min([$this->image->width(), $this->image->height(), 512]); if (!$this->image->centerCrop($size)) { - $this->logger->error('croping image for avatar failed for '.$this->dn, ['app' => 'user_ldap']); + $this->logger->error('croping image for avatar failed for ' . $this->dn, ['app' => 'user_ldap']); return false; } @@ -845,10 +845,10 @@ class User { if (!empty($pwdGraceAuthNLimit) && count($pwdGraceUseTime) < (int)$pwdGraceAuthNLimit[0]) { //at least one more grace login available? $this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true'); - header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( + header('Location: ' . \OC::$server->getURLGenerator()->linkToRouteAbsolute( 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid])); } else { //no more grace login available - header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( + header('Location: ' . \OC::$server->getURLGenerator()->linkToRouteAbsolute( 'user_ldap.renewPassword.showLoginFormInvalidPassword', ['user' => $uid])); } exit(); @@ -856,7 +856,7 @@ class User { //handle pwdReset attribute if (!empty($pwdReset) && $pwdReset[0] === 'TRUE') { //user must change his password $this->config->setUserValue($uid, 'user_ldap', 'needsPasswordReset', 'true'); - header('Location: '.\OC::$server->getURLGenerator()->linkToRouteAbsolute( + header('Location: ' . \OC::$server->getURLGenerator()->linkToRouteAbsolute( 'user_ldap.renewPassword.showRenewPasswordForm', ['user' => $uid])); exit(); } @@ -868,7 +868,7 @@ class User { $pwdExpireWarningInt = (int)$pwdExpireWarning[0]; if ($pwdMaxAgeInt > 0 && $pwdExpireWarningInt > 0) { $pwdChangedTimeDt = \DateTime::createFromFormat('YmdHisZ', $pwdChangedTime[0]); - $pwdChangedTimeDt->add(new \DateInterval('PT'.$pwdMaxAgeInt.'S')); + $pwdChangedTimeDt->add(new \DateInterval('PT' . $pwdMaxAgeInt . 'S')); $currentDateTime = new \DateTime(); $secondsToExpiry = $pwdChangedTimeDt->getTimestamp() - $currentDateTime->getTimestamp(); if ($secondsToExpiry <= $pwdExpireWarningInt) { diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php index ddf23ddfe3e..4a36794bca5 100644 --- a/apps/user_ldap/lib/UserPluginManager.php +++ b/apps/user_ldap/lib/UserPluginManager.php @@ -43,12 +43,12 @@ class UserPluginManager { foreach ($this->which as $action => $v) { if (is_int($action) && (bool)($respondToActions & $action)) { $this->which[$action] = $plugin; - \OCP\Server::get(LoggerInterface::class)->debug('Registered action '.$action.' to plugin '.get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug('Registered action ' . $action . ' to plugin ' . get_class($plugin), ['app' => 'user_ldap']); } } if (method_exists($plugin, 'deleteUser')) { $this->which['deleteUser'] = $plugin; - \OCP\Server::get(LoggerInterface::class)->debug('Registered action deleteUser to plugin '.get_class($plugin), ['app' => 'user_ldap']); + \OCP\Server::get(LoggerInterface::class)->debug('Registered action deleteUser to plugin ' . get_class($plugin), ['app' => 'user_ldap']); } } diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index b1065fcf7a7..e34f0fcb185 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -217,7 +217,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I */ public function getUsers($search = '', $limit = 10, $offset = 0) { $search = $this->access->escapeFilterPart($search, true); - $cachekey = 'getUsers-'.$search.'-'.$limit.'-'.$offset; + $cachekey = 'getUsers-' . $search . '-' . $limit . '-' . $offset; //check if users are cached, if so return $ldap_users = $this->access->connection->getFromCache($cachekey); @@ -237,7 +237,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I ]); $this->logger->debug( - 'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset.' Filter: '.$filter, + 'getUsers: Options: search ' . $search . ' limit ' . $limit . ' offset ' . $offset . ' Filter: ' . $filter, ['app' => 'user_ldap'] ); //do the search and translate results to Nextcloud names @@ -247,7 +247,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I $limit, $offset); $ldap_users = $this->access->nextcloudUserNames($ldap_users); $this->logger->debug( - 'getUsers: '.count($ldap_users). ' Users found', + 'getUsers: ' . count($ldap_users) . ' Users found', ['app' => 'user_ldap'] ); @@ -318,7 +318,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @throws \Exception when connection could not be established */ public function userExists($uid) { - $userExists = $this->access->connection->getFromCache('userExists'.$uid); + $userExists = $this->access->connection->getFromCache('userExists' . $uid); if (!is_null($userExists)) { return (bool)$userExists; } @@ -326,14 +326,14 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I if (!$userExists) { $this->logger->debug( - 'No DN found for '.$uid.' on '.$this->access->connection->ldapHost, + 'No DN found for ' . $uid . ' on ' . $this->access->connection->ldapHost, ['app' => 'user_ldap'] ); - $this->access->connection->writeToCache('userExists'.$uid, false); + $this->access->connection->writeToCache('userExists' . $uid, false); return false; } - $this->access->connection->writeToCache('userExists'.$uid, true); + $this->access->connection->writeToCache('userExists' . $uid, true); return true; } @@ -367,7 +367,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I } if (!$marked) { $this->logger->notice( - 'User '.$uid . ' is not marked as deleted, not cleaning up.', + 'User ' . $uid . ' is not marked as deleted, not cleaning up.', ['app' => 'user_ldap'] ); return false; @@ -400,7 +400,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I return $this->userPluginManager->getHome($uid); } - $cacheKey = 'getHome'.$uid; + $cacheKey = 'getHome' . $uid; $path = $this->access->connection->getFromCache($cacheKey); if (!is_null($path)) { return $path; @@ -432,7 +432,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I return false; } - $cacheKey = 'getDisplayName'.$uid; + $cacheKey = 'getDisplayName' . $uid; if (!is_null($displayName = $this->access->connection->getFromCache($cacheKey))) { return $displayName; } @@ -495,7 +495,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I * @return array an array of all displayNames (value) and the corresponding uids (key) */ public function getDisplayNames($search = '', $limit = null, $offset = null) { - $cacheKey = 'getDisplayNames-'.$search.'-'.$limit.'-'.$offset; + $cacheKey = 'getDisplayNames-' . $search . '-' . $limit . '-' . $offset; if (!is_null($displayNames = $this->access->connection->getFromCache($cacheKey))) { return $displayNames; } @@ -546,7 +546,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I } $filter = $this->access->getFilterForUserCount(); - $cacheKey = 'countUsers-'.$filter; + $cacheKey = 'countUsers-' . $filter; if (!is_null($entries = $this->access->connection->getFromCache($cacheKey))) { return $entries; } diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index fd5f12ce0cf..87f0d04f497 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -37,7 +37,7 @@ class Wizard extends LDAPUtility { public function __construct( Configuration $configuration, ILDAPWrapper $ldap, - Access $access + Access $access, ) { parent::__construct($ldap); $this->configuration = $configuration; @@ -262,7 +262,7 @@ class Wizard extends LDAPUtility { $this->applyFind('ldap_email_attr', $winner); if ($writeLog) { $this->logger->info( - 'The mail attribute has automatically been reset, '. + 'The mail attribute has automatically been reset, ' . 'because the original value did not return any results.', ['app' => 'user_ldap'] ); @@ -402,7 +402,7 @@ class Wizard extends LDAPUtility { $filterParts = []; foreach ($obclasses as $obclass) { - $filterParts[] = 'objectclass='.$obclass; + $filterParts[] = 'objectclass=' . $obclass; } //we filter for everything //- that looks like a group and @@ -647,7 +647,7 @@ class Wizard extends LDAPUtility { $p = $setting['port']; $t = $setting['tls']; $this->logger->debug( - 'Wiz: trying port '. $p . ', TLS '. $t, + 'Wiz: trying port ' . $p . ', TLS ' . $t, ['app' => 'user_ldap'] ); //connectAndBind may throw Exception, it needs to be caught by the @@ -755,7 +755,7 @@ class Wizard extends LDAPUtility { //removes Port from Host if (is_array($hostInfo) && isset($hostInfo['port'])) { $port = $hostInfo['port']; - $host = str_replace(':'.$port, '', $host); + $host = str_replace(':' . $port, '', $host); $this->applyFind('ldap_host', $host); $this->applyFind('ldap_port', (string)$port); } @@ -824,7 +824,7 @@ class Wizard extends LDAPUtility { $errorNo = $this->ldap->errno($cr); $errorMsg = $this->ldap->error($cr); $this->logger->info( - 'Wiz: Could not search base '.$base.' Error '.$errorNo.': '.$errorMsg, + 'Wiz: Could not search base ' . $base . ' Error ' . $errorNo . ': ' . $errorMsg, ['app' => 'user_ldap'] ); return false; @@ -902,7 +902,7 @@ class Wizard extends LDAPUtility { $filterPart = '(memberof=' . ldap_escape($dn, '', LDAP_ESCAPE_FILTER) . ')'; if (isset($attrs['primaryGroupToken'])) { $pgt = $attrs['primaryGroupToken'][0]; - $primaryFilterPart = '(primaryGroupID=' . ldap_escape($pgt, '', LDAP_ESCAPE_FILTER) .')'; + $primaryFilterPart = '(primaryGroupID=' . ldap_escape($pgt, '', LDAP_ESCAPE_FILTER) . ')'; $filterPart = '(|' . $filterPart . $primaryFilterPart . ')'; } $filter .= $filterPart; @@ -1002,12 +1002,12 @@ class Wizard extends LDAPUtility { $filterLogin .= ')'; } - $filter = '(&'.$ulf.$filterLogin.')'; + $filter = '(&' . $ulf . $filterLogin . ')'; break; } $this->logger->debug( - 'Wiz: Final filter '.$filter, + 'Wiz: Final filter ' . $filter, ['app' => 'user_ldap'] ); @@ -1069,7 +1069,7 @@ class Wizard extends LDAPUtility { if ($login === true) { $this->logger->debug( - 'Wiz: Bind successful to Port '. $port . ' TLS ' . (int)$tls, + 'Wiz: Bind successful to Port ' . $port . ' TLS ' . (int)$tls, ['app' => 'user_ldap'] ); return true; @@ -1203,7 +1203,7 @@ class Wizard extends LDAPUtility { } $p = 'objectclass='; foreach ($objectclasses as $key => $value) { - $objectclasses[$key] = $p.$value; + $objectclasses[$key] = $p . $value; } $maxEntryObjC = ''; diff --git a/apps/user_ldap/templates/part.wizard-server.php b/apps/user_ldap/templates/part.wizard-server.php index 94bd59f7b96..9fb67342247 100644 --- a/apps/user_ldap/templates/part.wizard-server.php +++ b/apps/user_ldap/templates/part.wizard-server.php @@ -15,7 +15,7 @@ $sel = ' selected'; foreach ($_['serverConfigurationPrefixes'] as $prefix) { ?> <option value="<?php p($prefix); ?>"<?php p($sel); - $sel = ''; ?>><?php p($l->t('%s. Server:', [$i++])); ?> <?php p(' '.$_['serverConfigurationHosts'][$prefix]); ?></option> + $sel = ''; ?>><?php p($l->t('%s. Server:', [$i++])); ?> <?php p(' ' . $_['serverConfigurationHosts'][$prefix]); ?></option> <?php } ?> diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 4be24095e99..9117a9f533c 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -73,7 +73,7 @@ style('user_ldap', 'settings'); </ul> <?php if (!function_exists('ldap_connect')) { - print_unescaped('<p class="ldapwarning">'.$l->t('<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.').'</p>'); + print_unescaped('<p class="ldapwarning">' . $l->t('<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.') . '</p>'); } ?> <?php require_once __DIR__ . '/part.wizard-server.php'; ?> diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 79c0f3216a2..a9eeceeb86b 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -526,7 +526,7 @@ class AccessTest extends TestCase { $base, $fakeConnection, $fakeSearchResultResource, - $fakeLdapEntries + $fakeLdapEntries, ) { $this->connection ->expects($this->any()) diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index 58006627410..13c5d35dce4 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -1033,10 +1033,10 @@ class Group_LDAPTest extends TestCase { $this->assertTrue(str_contains($filter, $groupFilter)); } [$memberFilter] = explode('&', $filter); - if ($memberFilter === 'member='.$dn) { + if ($memberFilter === 'member=' . $dn) { return [$group1, $group2]; return []; - } elseif ($memberFilter === 'member='.$group2['dn'][0]) { + } elseif ($memberFilter === 'member=' . $group2['dn'][0]) { return [$group3]; } else { return []; diff --git a/apps/user_ldap/tests/Integration/Bootstrap.php b/apps/user_ldap/tests/Integration/Bootstrap.php index 872e06139ff..1e270aa6f8a 100644 --- a/apps/user_ldap/tests/Integration/Bootstrap.php +++ b/apps/user_ldap/tests/Integration/Bootstrap.php @@ -4,5 +4,5 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ define('CLI_TEST_RUN', true); -require_once __DIR__ . '/../../../../lib/base.php'; +require_once __DIR__ . '/../../../../lib/base.php'; require_once __DIR__ . '/setup-scripts/config.php'; diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php index f42c6d4bccd..4618179f8ab 100644 --- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php +++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php @@ -77,7 +77,7 @@ class ExceptionOnLostConnection { * @throws \Exception */ public function setUp(): void { - require_once __DIR__ . '/../../../../lib/base.php'; + require_once __DIR__ . '/../../../../lib/base.php'; \OC_App::loadApps(['user_ldap']); $ch = $this->getCurl(); diff --git a/apps/user_ldap/tests/Settings/AdminTest.php b/apps/user_ldap/tests/Settings/AdminTest.php index e06563d1856..099cc09c068 100644 --- a/apps/user_ldap/tests/Settings/AdminTest.php +++ b/apps/user_ldap/tests/Settings/AdminTest.php @@ -52,7 +52,7 @@ class AdminTest extends TestCase { $config = new Configuration('', false); $defaults = $config->getDefaults(); foreach ($defaults as $key => $default) { - $parameters[$key.'_default'] = $default; + $parameters[$key . '_default'] = $default; } $expected = new TemplateResponse('user_ldap', 'settings', $parameters); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index aca4e2434e2..d596402d322 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -1110,7 +1110,7 @@ class UserTest extends \Test\TestCase { if ($base === $this->dn) { return [ [ - 'pwdchangedtime' => [(new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'], + 'pwdchangedtime' => [(new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis') . 'Z'], 'pwdgraceusetime' => [], ], ]; @@ -1174,7 +1174,7 @@ class UserTest extends \Test\TestCase { return [ [ 'pwdpolicysubentry' => ['cn=custom,ou=policies,dc=foo,dc=bar'], - 'pwdchangedtime' => [(new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'], + 'pwdchangedtime' => [(new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis') . 'Z'], 'pwdgraceusetime' => [], ] ]; diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 90166beccff..f766c7f583a 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -654,7 +654,7 @@ class User_LDAPTest extends TestCase { $this->prepareMockForUserExists(); $dataDir = \OC::$server->getConfig()->getSystemValue( - 'datadirectory', \OC::$SERVERROOT.'/data'); + 'datadirectory', \OC::$SERVERROOT . '/data'); $this->connection->expects($this->any()) ->method('__get') @@ -689,7 +689,7 @@ class User_LDAPTest extends TestCase { ->willReturn('dnOfLadyOfShadows,dc=test'); $user->expects($this->any()) ->method('getHomePath') - ->willReturn($dataDir.'/susannah/'); + ->willReturn($dataDir . '/susannah/'); $this->userManager->expects($this->atLeastOnce()) ->method('get') @@ -701,7 +701,7 @@ class User_LDAPTest extends TestCase { /** @noinspection PhpUnhandledExceptionInspection */ $result = $backend->getHome('ladyofshadows'); - $this->assertEquals($dataDir.'/susannah/', $result); + $this->assertEquals($dataDir . '/susannah/', $result); } @@ -1078,11 +1078,11 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->exactly(2)) ->method('getFromCache') - ->with($this->equalTo('loginName2UserName-'.$loginName)) + ->with($this->equalTo('loginName2UserName-' . $loginName)) ->willReturnOnConsecutiveCalls(null, $username); $this->connection->expects($this->once()) ->method('writeToCache') - ->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo($username)); + ->with($this->equalTo('loginName2UserName-' . $loginName), $this->equalTo($username)); $backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); $user = $this->createMock(User::class); @@ -1121,11 +1121,11 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->exactly(2)) ->method('getFromCache') - ->with($this->equalTo('loginName2UserName-'.$loginName)) + ->with($this->equalTo('loginName2UserName-' . $loginName)) ->willReturnOnConsecutiveCalls(null, false); $this->connection->expects($this->once()) ->method('writeToCache') - ->with($this->equalTo('loginName2UserName-'.$loginName), false); + ->with($this->equalTo('loginName2UserName-' . $loginName), false); $this->userManager->expects($this->any()) ->method('getAttributes') @@ -1154,11 +1154,11 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->exactly(2)) ->method('getFromCache') - ->with($this->equalTo('loginName2UserName-'.$loginName)) + ->with($this->equalTo('loginName2UserName-' . $loginName)) ->willReturnOnConsecutiveCalls(null, false); $this->connection->expects($this->once()) ->method('writeToCache') - ->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo(false)); + ->with($this->equalTo('loginName2UserName-' . $loginName), $this->equalTo(false)); $this->userManager->expects($this->any()) ->method('get') @@ -1196,7 +1196,7 @@ class User_LDAPTest extends TestCase { $this->connection->expects($this->any()) ->method('getFromCache') ->willReturnCallback(function ($uid) { - if ($uid === 'userExists'.'roland') { + if ($uid === 'userExists' . 'roland') { return true; } return null; |