diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-05 15:12:57 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-10-05 20:25:24 +0200 |
commit | d9015a8c94bfd71fe484618a06d276701d3bf9ff (patch) | |
tree | 3f7a1cd6ec2fd982dd02de71b76076f7f01cef70 /apps/user_ldap | |
parent | d357f4b10fe1b59e1e07bb90641d647522c7bfe2 (diff) | |
download | nextcloud-server-d9015a8c94bfd71fe484618a06d276701d3bf9ff.tar.gz nextcloud-server-d9015a8c94bfd71fe484618a06d276701d3bf9ff.zip |
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_ldap')
24 files changed, 181 insertions, 181 deletions
diff --git a/apps/user_ldap/ajax/getNewServerConfigPrefix.php b/apps/user_ldap/ajax/getNewServerConfigPrefix.php index 6118ac18566..4e95d6e02b5 100644 --- a/apps/user_ldap/ajax/getNewServerConfigPrefix.php +++ b/apps/user_ldap/ajax/getNewServerConfigPrefix.php @@ -34,7 +34,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/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index 9592241924c..5086f3a0c1a 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -96,7 +96,7 @@ class Search extends Command { if ($limit < 0) { throw new \InvalidArgumentException('limit must be 0 or greater'); } - if ($offset < 0) { + if ($offset < 0) { throw new \InvalidArgumentException('offset must be 0 or greater'); } if ($limit === 0 && $offset !== 0) { diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php index 5a7c732ab7b..efa9d34b83f 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -433,60 +433,60 @@ class Configuration { */ public function getDefaults() { return [ - 'ldap_host' => '', - 'ldap_port' => '', - 'ldap_backup_host' => '', - 'ldap_backup_port' => '', - 'ldap_override_main_server' => '', - 'ldap_dn' => '', - 'ldap_agent_password' => '', - 'ldap_base' => '', - 'ldap_base_users' => '', - 'ldap_base_groups' => '', - 'ldap_userlist_filter' => '', - 'ldap_user_filter_mode' => 0, - 'ldap_userfilter_objectclass' => '', - 'ldap_userfilter_groups' => '', - 'ldap_login_filter' => '', - 'ldap_login_filter_mode' => 0, - 'ldap_loginfilter_email' => 0, - 'ldap_loginfilter_username' => 1, - 'ldap_loginfilter_attributes' => '', - 'ldap_group_filter' => '', - 'ldap_group_filter_mode' => 0, - 'ldap_groupfilter_objectclass' => '', - 'ldap_groupfilter_groups' => '', - 'ldap_gid_number' => 'gidNumber', - 'ldap_display_name' => 'displayName', - 'ldap_user_display_name_2' => '', - 'ldap_group_display_name' => 'cn', - 'ldap_tls' => 0, - 'ldap_quota_def' => '', - 'ldap_quota_attr' => '', - 'ldap_email_attr' => '', + 'ldap_host' => '', + 'ldap_port' => '', + 'ldap_backup_host' => '', + 'ldap_backup_port' => '', + 'ldap_override_main_server' => '', + 'ldap_dn' => '', + 'ldap_agent_password' => '', + 'ldap_base' => '', + 'ldap_base_users' => '', + 'ldap_base_groups' => '', + 'ldap_userlist_filter' => '', + 'ldap_user_filter_mode' => 0, + 'ldap_userfilter_objectclass' => '', + 'ldap_userfilter_groups' => '', + 'ldap_login_filter' => '', + 'ldap_login_filter_mode' => 0, + 'ldap_loginfilter_email' => 0, + 'ldap_loginfilter_username' => 1, + 'ldap_loginfilter_attributes' => '', + 'ldap_group_filter' => '', + 'ldap_group_filter_mode' => 0, + 'ldap_groupfilter_objectclass' => '', + 'ldap_groupfilter_groups' => '', + 'ldap_gid_number' => 'gidNumber', + 'ldap_display_name' => 'displayName', + 'ldap_user_display_name_2' => '', + 'ldap_group_display_name' => 'cn', + 'ldap_tls' => 0, + 'ldap_quota_def' => '', + 'ldap_quota_attr' => '', + 'ldap_email_attr' => '', 'ldap_group_member_assoc_attribute' => '', - 'ldap_cache_ttl' => 600, - 'ldap_uuid_user_attribute' => 'auto', - 'ldap_uuid_group_attribute' => 'auto', - 'home_folder_naming_rule' => '', - 'ldap_turn_off_cert_check' => 0, - 'ldap_configuration_active' => 0, - 'ldap_attributes_for_user_search' => '', - 'ldap_attributes_for_group_search' => '', - 'ldap_expert_username_attr' => '', - 'ldap_expert_uuid_user_attr' => '', - 'ldap_expert_uuid_group_attr' => '', - 'has_memberof_filter_support' => 0, + 'ldap_cache_ttl' => 600, + 'ldap_uuid_user_attribute' => 'auto', + 'ldap_uuid_group_attribute' => 'auto', + 'home_folder_naming_rule' => '', + 'ldap_turn_off_cert_check' => 0, + 'ldap_configuration_active' => 0, + 'ldap_attributes_for_user_search' => '', + 'ldap_attributes_for_group_search' => '', + 'ldap_expert_username_attr' => '', + 'ldap_expert_uuid_user_attr' => '', + 'ldap_expert_uuid_group_attr' => '', + 'has_memberof_filter_support' => 0, 'use_memberof_to_detect_membership' => 1, - 'last_jpegPhoto_lookup' => 0, - 'ldap_nested_groups' => 0, - 'ldap_paging_size' => 500, - 'ldap_turn_on_pwd_change' => 0, - 'ldap_experienced_admin' => 0, - 'ldap_dynamic_group_member_url' => '', - 'ldap_default_ppolicy_dn' => '', - 'ldap_user_avatar_rule' => 'default', - 'ldap_ext_storage_home_attribute' => '', + 'last_jpegPhoto_lookup' => 0, + 'ldap_nested_groups' => 0, + 'ldap_paging_size' => 500, + 'ldap_turn_on_pwd_change' => 0, + 'ldap_experienced_admin' => 0, + 'ldap_dynamic_group_member_url' => '', + 'ldap_default_ppolicy_dn' => '', + 'ldap_user_avatar_rule' => 'default', + 'ldap_ext_storage_home_attribute' => '', 'ldap_matching_rule_in_chain_state' => self::LDAP_SERVER_FEATURE_UNKNOWN, ]; } @@ -497,60 +497,60 @@ class Configuration { public function getConfigTranslationArray() { //TODO: merge them into one representation static $array = [ - 'ldap_host' => 'ldapHost', - 'ldap_port' => 'ldapPort', - 'ldap_backup_host' => 'ldapBackupHost', - 'ldap_backup_port' => 'ldapBackupPort', - 'ldap_override_main_server' => 'ldapOverrideMainServer', - 'ldap_dn' => 'ldapAgentName', - 'ldap_agent_password' => 'ldapAgentPassword', - 'ldap_base' => 'ldapBase', - 'ldap_base_users' => 'ldapBaseUsers', - 'ldap_base_groups' => 'ldapBaseGroups', - 'ldap_userfilter_objectclass' => 'ldapUserFilterObjectclass', - 'ldap_userfilter_groups' => 'ldapUserFilterGroups', - 'ldap_userlist_filter' => 'ldapUserFilter', - 'ldap_user_filter_mode' => 'ldapUserFilterMode', - 'ldap_user_avatar_rule' => 'ldapUserAvatarRule', - 'ldap_login_filter' => 'ldapLoginFilter', - 'ldap_login_filter_mode' => 'ldapLoginFilterMode', - 'ldap_loginfilter_email' => 'ldapLoginFilterEmail', - 'ldap_loginfilter_username' => 'ldapLoginFilterUsername', - 'ldap_loginfilter_attributes' => 'ldapLoginFilterAttributes', - 'ldap_group_filter' => 'ldapGroupFilter', - 'ldap_group_filter_mode' => 'ldapGroupFilterMode', - 'ldap_groupfilter_objectclass' => 'ldapGroupFilterObjectclass', - 'ldap_groupfilter_groups' => 'ldapGroupFilterGroups', - 'ldap_gid_number' => 'ldapGidNumber', - 'ldap_display_name' => 'ldapUserDisplayName', - 'ldap_user_display_name_2' => 'ldapUserDisplayName2', - 'ldap_group_display_name' => 'ldapGroupDisplayName', - 'ldap_tls' => 'ldapTLS', - 'ldap_quota_def' => 'ldapQuotaDefault', - 'ldap_quota_attr' => 'ldapQuotaAttribute', - 'ldap_email_attr' => 'ldapEmailAttribute', + 'ldap_host' => 'ldapHost', + 'ldap_port' => 'ldapPort', + 'ldap_backup_host' => 'ldapBackupHost', + 'ldap_backup_port' => 'ldapBackupPort', + 'ldap_override_main_server' => 'ldapOverrideMainServer', + 'ldap_dn' => 'ldapAgentName', + 'ldap_agent_password' => 'ldapAgentPassword', + 'ldap_base' => 'ldapBase', + 'ldap_base_users' => 'ldapBaseUsers', + 'ldap_base_groups' => 'ldapBaseGroups', + 'ldap_userfilter_objectclass' => 'ldapUserFilterObjectclass', + 'ldap_userfilter_groups' => 'ldapUserFilterGroups', + 'ldap_userlist_filter' => 'ldapUserFilter', + 'ldap_user_filter_mode' => 'ldapUserFilterMode', + 'ldap_user_avatar_rule' => 'ldapUserAvatarRule', + 'ldap_login_filter' => 'ldapLoginFilter', + 'ldap_login_filter_mode' => 'ldapLoginFilterMode', + 'ldap_loginfilter_email' => 'ldapLoginFilterEmail', + 'ldap_loginfilter_username' => 'ldapLoginFilterUsername', + 'ldap_loginfilter_attributes' => 'ldapLoginFilterAttributes', + 'ldap_group_filter' => 'ldapGroupFilter', + 'ldap_group_filter_mode' => 'ldapGroupFilterMode', + 'ldap_groupfilter_objectclass' => 'ldapGroupFilterObjectclass', + 'ldap_groupfilter_groups' => 'ldapGroupFilterGroups', + 'ldap_gid_number' => 'ldapGidNumber', + 'ldap_display_name' => 'ldapUserDisplayName', + 'ldap_user_display_name_2' => 'ldapUserDisplayName2', + 'ldap_group_display_name' => 'ldapGroupDisplayName', + 'ldap_tls' => 'ldapTLS', + 'ldap_quota_def' => 'ldapQuotaDefault', + 'ldap_quota_attr' => 'ldapQuotaAttribute', + 'ldap_email_attr' => 'ldapEmailAttribute', 'ldap_group_member_assoc_attribute' => 'ldapGroupMemberAssocAttr', - 'ldap_cache_ttl' => 'ldapCacheTTL', - 'home_folder_naming_rule' => 'homeFolderNamingRule', - 'ldap_turn_off_cert_check' => 'turnOffCertCheck', - 'ldap_configuration_active' => 'ldapConfigurationActive', - 'ldap_attributes_for_user_search' => 'ldapAttributesForUserSearch', - 'ldap_attributes_for_group_search' => 'ldapAttributesForGroupSearch', - 'ldap_expert_username_attr' => 'ldapExpertUsernameAttr', - 'ldap_expert_uuid_user_attr' => 'ldapExpertUUIDUserAttr', - 'ldap_expert_uuid_group_attr' => 'ldapExpertUUIDGroupAttr', - 'has_memberof_filter_support' => 'hasMemberOfFilterSupport', + 'ldap_cache_ttl' => 'ldapCacheTTL', + 'home_folder_naming_rule' => 'homeFolderNamingRule', + 'ldap_turn_off_cert_check' => 'turnOffCertCheck', + 'ldap_configuration_active' => 'ldapConfigurationActive', + 'ldap_attributes_for_user_search' => 'ldapAttributesForUserSearch', + 'ldap_attributes_for_group_search' => 'ldapAttributesForGroupSearch', + 'ldap_expert_username_attr' => 'ldapExpertUsernameAttr', + 'ldap_expert_uuid_user_attr' => 'ldapExpertUUIDUserAttr', + 'ldap_expert_uuid_group_attr' => 'ldapExpertUUIDGroupAttr', + 'has_memberof_filter_support' => 'hasMemberOfFilterSupport', 'use_memberof_to_detect_membership' => 'useMemberOfToDetectMembership', - 'last_jpegPhoto_lookup' => 'lastJpegPhotoLookup', - 'ldap_nested_groups' => 'ldapNestedGroups', - 'ldap_paging_size' => 'ldapPagingSize', - 'ldap_turn_on_pwd_change' => 'turnOnPasswordChange', - 'ldap_experienced_admin' => 'ldapExperiencedAdmin', - 'ldap_dynamic_group_member_url' => 'ldapDynamicGroupMemberURL', - 'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN', - 'ldap_ext_storage_home_attribute' => 'ldapExtStorageHomeAttribute', + 'last_jpegPhoto_lookup' => 'lastJpegPhotoLookup', + 'ldap_nested_groups' => 'ldapNestedGroups', + 'ldap_paging_size' => 'ldapPagingSize', + 'ldap_turn_on_pwd_change' => 'turnOnPasswordChange', + 'ldap_experienced_admin' => 'ldapExperiencedAdmin', + 'ldap_dynamic_group_member_url' => 'ldapDynamicGroupMemberURL', + 'ldap_default_ppolicy_dn' => 'ldapDefaultPPolicyDN', + 'ldap_ext_storage_home_attribute' => 'ldapExtStorageHomeAttribute', 'ldap_matching_rule_in_chain_state' => 'ldapMatchingRuleInChainState', - 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig + 'ldapIgnoreNamingRules' => 'ldapIgnoreNamingRules', // sysconfig ]; return $array; } diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index b7556bf236e..af10aadc6bb 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -273,7 +273,7 @@ class Connection extends LDAPUtility { || !$this->configuration->ldapConfigurationActive) { return null; } - $key = $this->getCacheKey($key); + $key = $this->getCacheKey($key); $value = base64_encode(json_encode($value)); $this->cache->set($key, $value, $this->configuration->ldapCacheTTL); } @@ -371,7 +371,7 @@ class Connection extends LDAPUtility { } } - foreach (['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', + foreach (['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) { $uuidOverride = $this->configuration->$expertSetting; @@ -466,7 +466,7 @@ class Connection extends LDAPUtility { $agent = $this->configuration->ldapAgentName; $pwd = $this->configuration->ldapAgentPassword; if ( - ($agent === '' && $pwd !== '') + ($agent === '' && $pwd !== '') || ($agent !== '' && $pwd === '') ) { \OCP\Util::writeLog( diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index b516e08b9e1..8f729ae4372 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -100,7 +100,7 @@ class CleanUp extends TimedJob { if (isset($arguments['userBackend'])) { $this->userBackend = $arguments['userBackend']; } else { - $this->userBackend = new User_Proxy( + $this->userBackend = new User_Proxy( $this->ldapHelper->getServerConfigurationPrefixes(true), new LDAP(), $this->ocConfig, diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index 8cbac261e9f..33587f8bdb2 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -207,7 +207,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob { $connector = new Connection($ldapWrapper, $configPrefixes[0]); $ldapAccess = new Access($connector, $ldapWrapper, $userManager, $helper, \OC::$server->getConfig(), \OC::$server->getUserManager()); $groupMapper = new GroupMapping($dbc); - $userMapper = new UserMapping($dbc); + $userMapper = new UserMapping($dbc); $ldapAccess->setGroupMapper($groupMapper); $ldapAccess->setUserMapper($userMapper); self::$groupBE = new \OCA\User_LDAP\Group_LDAP($ldapAccess, \OC::$server->query(GroupPluginManager::class)); diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index 63b2b9adcb9..c55e08618e8 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -369,7 +369,7 @@ class LDAP implements ILDAPWrapper { if ($errorCode === 0) { return; } - $errorMsg = ldap_error($resource); + $errorMsg = ldap_error($resource); if ($this->curFunc === 'ldap_get_entries' && $errorCode === -4) { diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index 898a0ae0f86..a3d7fd9c2b4 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -98,16 +98,16 @@ class Manager { IAvatarManager $avatarManager, Image $image, IDBConnection $db, IUserManager $userManager, INotificationManager $notificationManager) { - $this->ocConfig = $ocConfig; - $this->ocFilesystem = $ocFilesystem; - $this->ocLog = $ocLog; - $this->avatarManager = $avatarManager; - $this->image = $image; - $this->db = $db; - $this->userManager = $userManager; + $this->ocConfig = $ocConfig; + $this->ocFilesystem = $ocFilesystem; + $this->ocLog = $ocLog; + $this->avatarManager = $avatarManager; + $this->image = $image; + $this->db = $db; + $this->userManager = $userManager; $this->notificationManager = $notificationManager; - $this->usersByDN = new CappedMemoryCache(); - $this->usersByUid = new CappedMemoryCache(); + $this->usersByDN = new CappedMemoryCache(); + $this->usersByUid = new CappedMemoryCache(); } /** @@ -132,7 +132,7 @@ class Manager { $this->ocFilesystem, clone $this->image, $this->ocLog, $this->avatarManager, $this->userManager, $this->notificationManager); - $this->usersByDN[$dn] = $user; + $this->usersByDN[$dn] = $user; $this->usersByUid[$uid] = $user; return $user; } diff --git a/apps/user_ldap/lib/User/OfflineUser.php b/apps/user_ldap/lib/User/OfflineUser.php index 72d29dd5441..1abef861852 100644 --- a/apps/user_ldap/lib/User/OfflineUser.php +++ b/apps/user_ldap/lib/User/OfflineUser.php @@ -196,12 +196,12 @@ class OfflineUser { */ protected function fetchDetails() { $properties = [ - 'displayName' => 'user_ldap', - 'uid' => 'user_ldap', - 'homePath' => 'user_ldap', + 'displayName' => 'user_ldap', + 'uid' => 'user_ldap', + 'homePath' => 'user_ldap', 'foundDeleted' => 'user_ldap', - 'email' => 'settings', - 'lastLogin' => 'login', + 'email' => 'settings', + 'lastLogin' => 'login', ]; foreach ($properties as $property => $app) { $this->$property = $this->config->getUserValue($this->ocName, $app, $property, ''); diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index 6117f34a0c6..91ad8c81be6 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -107,7 +107,7 @@ class User { /** * DB config keys for user preferences */ - public const USER_PREFKEY_FIRSTLOGIN = 'firstLoginAccomplished'; + public const USER_PREFKEY_FIRSTLOGIN = 'firstLoginAccomplished'; /** * @brief constructor, make sure the subclasses call this one! @@ -134,16 +134,16 @@ class User { throw new \InvalidArgumentException('uid must not be an empty string!'); } - $this->access = $access; - $this->connection = $access->getConnection(); - $this->config = $config; - $this->fs = $fs; - $this->dn = $dn; - $this->uid = $username; - $this->image = $image; - $this->log = $log; - $this->avatarManager = $avatarManager; - $this->userManager = $userManager; + $this->access = $access; + $this->connection = $access->getConnection(); + $this->config = $config; + $this->fs = $fs; + $this->dn = $dn; + $this->uid = $username; + $this->image = $image; + $this->log = $log; + $this->avatarManager = $avatarManager; + $this->userManager = $userManager; $this->notificationManager = $notificationManager; \OCP\Util::connectHook('OC_User', 'post_login', $this, 'handlePasswordExpiry'); diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 78337ff32b1..0d614f5b1fb 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -55,8 +55,8 @@ class Wizard extends LDAPUtility { public const LRESULT_PROCESSED_INVALID = 3; public const LRESULT_PROCESSED_SKIP = 4; - public const LFILTER_LOGIN = 2; - public const LFILTER_USER_LIST = 3; + public const LFILTER_LOGIN = 2; + public const LFILTER_USER_LIST = 3; public const LFILTER_GROUP_LIST = 4; public const LFILTER_MODE_ASSISTED = 2; @@ -106,7 +106,7 @@ class Wizard extends LDAPUtility { $attr = ['dn']; // default $limit = 1001; if ($type === 'groups') { - $result = $this->access->countGroups($filter, $attr, $limit); + $result = $this->access->countGroups($filter, $attr, $limit); } elseif ($type === 'users') { $result = $this->access->countUsers($filter, $attr, $limit); } elseif ($type === 'objects') { @@ -847,7 +847,7 @@ class Wizard extends LDAPUtility { //get a result set > 0 on a proper base $rr = $this->ldap->search($cr, $base, 'objectClass=*', ['dn'], 0, 1); if (!$this->ldap->isResource($rr)) { - $errorNo = $this->ldap->errno($cr); + $errorNo = $this->ldap->errno($cr); $errorMsg = $this->ldap->error($cr); \OCP\Util::writeLog('user_ldap', 'Wiz: Could not search base '.$base. ' Error '.$errorNo.': '.$errorMsg, ILogger::INFO); @@ -872,7 +872,7 @@ class Wizard extends LDAPUtility { throw new \Exception('Could not connect to LDAP'); } $result = $this->access->countUsers('memberOf=*', ['memberOf'], 1); - if (is_int($result) && $result > 0) { + if (is_int($result) && $result > 0) { return true; } return false; @@ -1102,7 +1102,7 @@ class Wizard extends LDAPUtility { return ($agent !== '' && $pwd !== '') - || ($agent === '' && $pwd === '') + || ($agent === '' && $pwd === '') ; } @@ -1146,8 +1146,8 @@ class Wizard extends LDAPUtility { return false; } $lastFilter = null; - if (isset($filters[count($filters)-1])) { - $lastFilter = $filters[count($filters)-1]; + if (isset($filters[count($filters) - 1])) { + $lastFilter = $filters[count($filters) - 1]; } foreach ($filters as $filter) { if ($lastFilter === $filter && count($foundItems) > 0) { @@ -1320,11 +1320,11 @@ class Wizard extends LDAPUtility { private function getDefaultLdapPortSettings() { static $settings = [ ['port' => 7636, 'tls' => false], - ['port' => 636, 'tls' => false], + ['port' => 636, 'tls' => false], ['port' => 7389, 'tls' => true], - ['port' => 389, 'tls' => true], + ['port' => 389, 'tls' => true], ['port' => 7389, 'tls' => false], - ['port' => 389, 'tls' => false], + ['port' => 389, 'tls' => false], ]; return $settings; } @@ -1348,7 +1348,7 @@ class Wizard extends LDAPUtility { && stripos($hostInfo['scheme'], 'ldaps') !== false)) { $portSettings[] = ['port' => $port, 'tls' => true]; } - $portSettings[] =['port' => $port, 'tls' => false]; + $portSettings[] = ['port' => $port, 'tls' => false]; } //default ports diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php index 549f6600b4d..d01cd80b3a0 100644 --- a/apps/user_ldap/tests/AccessTest.php +++ b/apps/user_ldap/tests/AccessTest.php @@ -84,7 +84,7 @@ class AccessTest extends TestCase { $this->ldap = $this->createMock(LDAP::class); $this->userManager = $this->createMock(Manager::class); $this->helper = $this->createMock(Helper::class); - $this->config = $this->createMock(IConfig::class); + $this->config = $this->createMock(IConfig::class); $this->userMapper = $this->createMock(UserMapping::class); $this->ncUserManager = $this->createMock(IUserManager::class); @@ -100,7 +100,7 @@ class AccessTest extends TestCase { } private function getConnectorAndLdapMock() { - $lw = $this->createMock(ILDAPWrapper::class); + $lw = $this->createMock(ILDAPWrapper::class); $connector = $this->getMockBuilder(Connection::class) ->setConstructorArgs([$lw, null, null]) ->getMock(); diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php index db119eb3bfe..6239bab68b0 100644 --- a/apps/user_ldap/tests/ConfigurationTest.php +++ b/apps/user_ldap/tests/ConfigurationTest.php @@ -74,23 +74,23 @@ class ConfigurationTest extends \Test\TestCase { return [ 'set general base' => ['ldapBase', $inputWithDN, $expectWithDN], - 'set user base' => ['ldapBaseUsers', $inputWithDN, $expectWithDN], - 'set group base' => ['ldapBaseGroups', $inputWithDN, $expectWithDN], + 'set user base' => ['ldapBaseUsers', $inputWithDN, $expectWithDN], + 'set group base' => ['ldapBaseGroups', $inputWithDN, $expectWithDN], - 'set search attributes users' => ['ldapAttributesForUserSearch', $inputNames, $expectedNames], + 'set search attributes users' => ['ldapAttributesForUserSearch', $inputNames, $expectedNames], 'set search attributes groups' => ['ldapAttributesForGroupSearch', $inputNames, $expectedNames], - 'set user filter objectclasses' => ['ldapUserFilterObjectclass', $inputNames, $expectedNames], - 'set user filter groups' => ['ldapUserFilterGroups', $inputNames, $expectedNames], + 'set user filter objectclasses' => ['ldapUserFilterObjectclass', $inputNames, $expectedNames], + 'set user filter groups' => ['ldapUserFilterGroups', $inputNames, $expectedNames], 'set group filter objectclasses' => ['ldapGroupFilterObjectclass', $inputNames, $expectedNames], - 'set group filter groups' => ['ldapGroupFilterGroups', $inputNames, $expectedNames], - 'set login filter attributes' => ['ldapLoginFilterAttributes', $inputNames, $expectedNames], + 'set group filter groups' => ['ldapGroupFilterGroups', $inputNames, $expectedNames], + 'set login filter attributes' => ['ldapLoginFilterAttributes', $inputNames, $expectedNames], 'set agent password' => ['ldapAgentPassword', $password, $password], 'set home folder, variant 1' => ['homeFolderNamingRule', $inputHomeFolder[0], $expectedHomeFolder[0]], 'set home folder, variant 2' => ['homeFolderNamingRule', $inputHomeFolder[1], $expectedHomeFolder[1]], - 'set home folder, empty' => ['homeFolderNamingRule', $inputHomeFolder[2], $expectedHomeFolder[2]], + 'set home folder, empty' => ['homeFolderNamingRule', $inputHomeFolder[2], $expectedHomeFolder[2]], // default behaviour, one case is enough, special needs must be tested // individually diff --git a/apps/user_ldap/tests/ConnectionTest.php b/apps/user_ldap/tests/ConnectionTest.php index a4fcf030083..1269a5d7e43 100644 --- a/apps/user_ldap/tests/ConnectionTest.php +++ b/apps/user_ldap/tests/ConnectionTest.php @@ -50,7 +50,7 @@ class ConnectionTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->ldap = $this->createMock(ILDAPWrapper::class); + $this->ldap = $this->createMock(ILDAPWrapper::class); // we use a mock here to replace the cache mechanism, due to missing DI in LDAP backend. $this->connection = $this->getMockBuilder('OCA\User_LDAP\Connection') ->setMethods(['getFromCache', 'writeToCache']) @@ -66,7 +66,7 @@ class ConnectionTest extends \Test\TestCase { //background: upon login a bind is done with the user credentials //which is valid for the whole LDAP resource. It needs to be reset //to the agent's credentials - $lw = $this->createMock(ILDAPWrapper::class); + $lw = $this->createMock(ILDAPWrapper::class); $connection = new Connection($lw, '', null); $agent = [ diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php index e40f73a7596..b94016e352d 100644 --- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php +++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php @@ -65,8 +65,8 @@ abstract class AbstractIntegrationTest { $this->server = [ 'host' => $host, 'port' => $port, - 'dn' => $bind, - 'pwd' => $pwd + 'dn' => $bind, + 'pwd' => $pwd ]; } diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php index 8c0bf6cde86..70ba46dba0c 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserAvatar.php @@ -54,7 +54,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest { $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection()); $this->mapping->clear(); $this->access->setUserMapper($this->mapping); - $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class)); + $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class)); \OC_User::useBackend($userBackend); } diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php index c48f51368bc..cefebe9f94e 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php @@ -47,7 +47,7 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest { $this->mapping->clear(); $this->access->setUserMapper($this->mapping); - $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class)); + $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class)); \OC_User::useBackend($userBackend); } diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php index a5712b164d1..a6acdfb3ec6 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserDisplayName.php @@ -45,7 +45,7 @@ class IntegrationTestUserDisplayName extends AbstractIntegrationTest { $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection()); $this->mapping->clear(); $this->access->setUserMapper($this->mapping); - $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class)); + $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->query(UserPluginManager::class)); \OC_User::useBackend($userBackend); } diff --git a/apps/user_ldap/tests/Jobs/CleanUpTest.php b/apps/user_ldap/tests/Jobs/CleanUpTest.php index 73d246ac4e2..1e88694f7bf 100644 --- a/apps/user_ldap/tests/Jobs/CleanUpTest.php +++ b/apps/user_ldap/tests/Jobs/CleanUpTest.php @@ -41,9 +41,9 @@ class CleanUpTest extends \Test\TestCase { $this->getMockBuilder('\OCA\User_LDAP\User\DeletedUsersIndex') ->disableOriginalConstructor() ->getMock(); - $mocks['ocConfig'] = $this->createMock(IConfig::class); - $mocks['db'] = $this->createMock(IDBConnection::class); - $mocks['helper'] = $this->createMock(Helper::class); + $mocks['ocConfig'] = $this->createMock(IConfig::class); + $mocks['db'] = $this->createMock(IDBConnection::class); + $mocks['helper'] = $this->createMock(Helper::class); return $mocks; } diff --git a/apps/user_ldap/tests/Jobs/SyncTest.php b/apps/user_ldap/tests/Jobs/SyncTest.php index 71868dcc617..a6a70493739 100644 --- a/apps/user_ldap/tests/Jobs/SyncTest.php +++ b/apps/user_ldap/tests/Jobs/SyncTest.php @@ -258,7 +258,7 @@ class SyncTest extends TestCase { $this->config->expects($this->exactly(2)) ->method('getAppValue') - ->willReturnOnConsecutiveCalls(time() - 60*40, time() - 60*20); + ->willReturnOnConsecutiveCalls(time() - 60 * 40, time() - 60 * 20); $this->sync->setArgument($this->arguments); $this->assertTrue($this->sync->qualifiesToRun($cycleData)); @@ -317,7 +317,7 @@ class SyncTest extends TestCase { } // for qualifiesToRun() if ($key === $runData['scheduledCycle']['prefix'] . '_lastChange') { - return time() - 60*40; + return time() - 60 * 40; } // for getMinPagingSize if ($key === $runData['scheduledCycle']['prefix'] . 'ldap_paging_size') { diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index a8910c4a272..3e9d0515892 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -600,7 +600,7 @@ class LDAPProviderTest extends \Test\TestCase { ->willReturn(true); $userBackend->expects($this->at(3)) ->method('getConfiguration') - ->willReturn(['ldap_display_name'=>'displayName']); + ->willReturn(['ldap_display_name' => 'displayName']); $userBackend->expects($this->any()) ->method($this->anything()) ->willReturnSelf(); @@ -638,7 +638,7 @@ class LDAPProviderTest extends \Test\TestCase { ->willReturn(true); $userBackend->expects($this->at(3)) ->method('getConfiguration') - ->willReturn(['ldap_email_attr'=>'mail']); + ->willReturn(['ldap_email_attr' => 'mail']); $userBackend->expects($this->any()) ->method($this->anything()) ->willReturnSelf(); @@ -686,7 +686,7 @@ class LDAPProviderTest extends \Test\TestCase { ->willReturn(true); $groupBackend->expects($this->any()) ->method('getConfiguration') - ->willReturn(['ldap_group_member_assoc_attribute'=>'assoc_type']); + ->willReturn(['ldap_group_member_assoc_attribute' => 'assoc_type']); $groupBackend->expects($this->any()) ->method($this->anything()) ->willReturnSelf(); diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 25a896aee04..3186a74ea89 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -72,7 +72,7 @@ class UserTest extends \Test\TestCase { /** @var string */ protected $uid = 'alice'; /** @var string */ - protected $dn = 'uid=alice,dc=foo,dc=bar'; + protected $dn = 'uid=alice,dc=foo,dc=bar'; /** @var User */ protected $user; diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 1c10e9955b3..ca9ff841ec0 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -1039,8 +1039,8 @@ class User_LDAPTest extends TestCase { public function testLoginName2UserNameSuccess() { $loginName = 'Alice'; - $username = 'alice'; - $dn = 'uid=alice,dc=what,dc=ever'; + $username = 'alice'; + $dn = 'uid=alice,dc=what,dc=ever'; $this->access->expects($this->once()) ->method('fetchUsersByLoginName') @@ -1118,7 +1118,7 @@ class User_LDAPTest extends TestCase { public function testLoginName2UserNameOfflineUser() { $loginName = 'Alice'; - $dn = 'uid=alice,dc=what,dc=ever'; + $dn = 'uid=alice,dc=what,dc=ever'; $offlineUser = $this->getMockBuilder(OfflineUser::class) ->disableOriginalConstructor() @@ -1311,7 +1311,7 @@ class User_LDAPTest extends TestCase { /** @dataProvider avatarDataProvider */ public function testCanChangeAvatar($imageData, $expected) { - $isValidImage = strpos((string)$imageData, 'valid') === 0; + $isValidImage = strpos((string)$imageData, 'valid') === 0; $user = $this->createMock(User::class); $user->expects($this->once()) diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index da3239cb8f8..378d549bc27 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -65,10 +65,10 @@ class WizardTest extends TestCase { if (is_null($confMethods)) { $confMethods = get_class_methods('\OCA\User_LDAP\Configuration'); $connMethods = get_class_methods('\OCA\User_LDAP\Connection'); - $accMethods = get_class_methods('\OCA\User_LDAP\Access'); + $accMethods = get_class_methods('\OCA\User_LDAP\Access'); } /** @var ILDAPWrapper|\PHPUnit\Framework\MockObject\MockObject $lw */ - $lw = $this->createMock(ILDAPWrapper::class); + $lw = $this->createMock(ILDAPWrapper::class); /** @var Configuration|\PHPUnit\Framework\MockObject\MockObject $conf */ $conf = $this->getMockBuilder(Configuration::class) |