diff options
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/ajax/setConfiguration.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/CheckUser.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/DeleteConfig.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/Search.php | 8 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/SetConfig.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/ShowConfig.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/Command/TestConfig.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Connection.php | 6 | ||||
-rw-r--r-- | apps/user_ldap/lib/Group_LDAP.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/LDAPProvider.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/lib/User/User.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/lib/Wizard.php | 108 | ||||
-rw-r--r-- | apps/user_ldap/tests/ConfigurationTest.php | 2 | ||||
-rw-r--r-- | apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/LDAPProviderTest.php | 56 | ||||
-rw-r--r-- | apps/user_ldap/tests/WizardTest.php | 2 |
16 files changed, 108 insertions, 108 deletions
diff --git a/apps/user_ldap/ajax/setConfiguration.php b/apps/user_ldap/ajax/setConfiguration.php index f696c107a49..2f6c318fa25 100644 --- a/apps/user_ldap/ajax/setConfiguration.php +++ b/apps/user_ldap/ajax/setConfiguration.php @@ -36,7 +36,7 @@ $prefix = (string)$_POST['ldap_serverconfig_chooser']; // only legacy checkboxes (Advanced and Expert tab) need to be handled here, // the Wizard-like tabs handle it on their own $chkboxes = ['ldap_configuration_active', 'ldap_override_main_server', - 'ldap_turn_off_cert_check']; + 'ldap_turn_off_cert_check']; foreach($chkboxes as $boxid) { if(!isset($_POST[$boxid])) { $_POST[$boxid] = 0; diff --git a/apps/user_ldap/lib/Command/CheckUser.php b/apps/user_ldap/lib/Command/CheckUser.php index 5ec7c15e76a..5b837e47b8e 100644 --- a/apps/user_ldap/lib/Command/CheckUser.php +++ b/apps/user_ldap/lib/Command/CheckUser.php @@ -70,13 +70,13 @@ class CheckUser extends Command { 'ocName', InputArgument::REQUIRED, 'the user name as used in Nextcloud' - ) + ) ->addOption( '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 d53435ce7c5..7739580740f 100644 --- a/apps/user_ldap/lib/Command/DeleteConfig.php +++ b/apps/user_ldap/lib/Command/DeleteConfig.php @@ -52,7 +52,7 @@ class DeleteConfig extends Command { '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 c061948fedd..edd4fa71ba0 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -59,27 +59,27 @@ class Search extends Command { 'search', InputArgument::REQUIRED, 'the search string (can be empty)' - ) + ) ->addOption( '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 - ) + ) ->addOption( '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 e74e9e33c18..a1ddf3a591a 100644 --- a/apps/user_ldap/lib/Command/SetConfig.php +++ b/apps/user_ldap/lib/Command/SetConfig.php @@ -45,17 +45,17 @@ class SetConfig extends Command { 'configID', InputArgument::REQUIRED, 'the configuration ID' - ) + ) ->addArgument( 'configKey', InputArgument::REQUIRED, 'the configuration key' - ) + ) ->addArgument( '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 005798c7a05..f4af798d433 100644 --- a/apps/user_ldap/lib/Command/ShowConfig.php +++ b/apps/user_ldap/lib/Command/ShowConfig.php @@ -56,13 +56,13 @@ class ShowConfig extends Command { 'configID', InputArgument::OPTIONAL, 'will show the configuration of the specified id' - ) + ) ->addOption( 'show-password', null, InputOption::VALUE_NONE, 'show ldap bind password' - ) + ) ; } diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php index 98dd25a1087..abab07d92f1 100644 --- a/apps/user_ldap/lib/Command/TestConfig.php +++ b/apps/user_ldap/lib/Command/TestConfig.php @@ -44,7 +44,7 @@ class TestConfig extends Command { 'configID', InputArgument::REQUIRED, 'the configuration ID' - ) + ) ; } diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 58afcf96726..14a0e19989a 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -365,7 +365,7 @@ class Connection extends LDAPUtility { } foreach(['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute', - 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] + 'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute'] as $expertSetting => $effectiveSetting) { $uuidOverride = $this->configuration->$expertSetting; if(!empty($uuidOverride)) { @@ -394,7 +394,7 @@ class Connection extends LDAPUtility { //make sure empty search attributes are saved as simple, empty array $saKeys = ['ldapAttributesForUserSearch', - 'ldapAttributesForGroupSearch']; + 'ldapAttributesForGroupSearch']; foreach($saKeys as $key) { $val = $this->configuration->$key; if(is_array($val) && count($val) === 1 && empty($val[0])) { @@ -423,7 +423,7 @@ class Connection extends LDAPUtility { //options that shall not be empty $options = ['ldapHost', 'ldapPort', 'ldapUserDisplayName', - 'ldapGroupDisplayName', 'ldapLoginFilter']; + 'ldapGroupDisplayName', 'ldapLoginFilter']; foreach($options as $key) { $val = $this->configuration->$key; if(empty($val)) { diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php index 11fd0b462d9..a55a285dde3 100644 --- a/apps/user_ldap/lib/Group_LDAP.php +++ b/apps/user_ldap/lib/Group_LDAP.php @@ -707,8 +707,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD // memberof doesn't support memberuid, so skip it here. if((int)$this->access->connection->hasMemberOfFilterSupport === 1 && (int)$this->access->connection->useMemberOfToDetectMembership === 1 - && strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid' - ) { + && strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid' + ) { $groupDNs = $this->_getGroupDNsFromMemberOf($userDN); if (is_array($groupDNs)) { foreach ($groupDNs as $dn) { diff --git a/apps/user_ldap/lib/LDAPProvider.php b/apps/user_ldap/lib/LDAPProvider.php index 0547ffcffb6..31bf2531a96 100644 --- a/apps/user_ldap/lib/LDAPProvider.php +++ b/apps/user_ldap/lib/LDAPProvider.php @@ -65,7 +65,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { $userBackendFound = true; break; } - } + } foreach ($serverContainer->getGroupManager()->getBackends() as $backend){ $this->logger->debug('instance '.get_class($backend).' group backend.', ['app' => 'user_ldap']); if ($backend instanceof IGroupLDAP) { @@ -75,7 +75,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport { } } - if (!$userBackendFound or !$groupBackendFound) { + if (!$userBackendFound or !$groupBackendFound) { throw new \Exception('To use the LDAPProvider, user_ldap app must be enabled'); } } diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index f092f44e041..ccd40621704 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -329,7 +329,7 @@ class User { //check for / at the beginning or pattern c:\ resp. c:/ if( '/' !== $path[0] && !(3 < strlen($path) && ctype_alpha($path[0]) - && $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2])) + && $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2])) ) { $path = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data' ) . '/' . $path; diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php index 181a58c11bf..71000cf88c5 100644 --- a/apps/user_ldap/lib/Wizard.php +++ b/apps/user_ldap/lib/Wizard.php @@ -201,10 +201,10 @@ class Wizard extends LDAPUtility { */ public function countUsersWithAttribute($attr, $existsCheck = false) { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - 'ldapUserFilter', - ])) { + 'ldapPort', + 'ldapBase', + 'ldapUserFilter', + ])) { return false; } @@ -226,10 +226,10 @@ class Wizard extends LDAPUtility { */ public function detectUserDisplayNameAttribute() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - 'ldapUserFilter', - ])) { + 'ldapPort', + 'ldapBase', + 'ldapUserFilter', + ])) { return false; } @@ -268,10 +268,10 @@ class Wizard extends LDAPUtility { */ public function detectEmailAttribute() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - 'ldapUserFilter', - ])) { + 'ldapPort', + 'ldapBase', + 'ldapUserFilter', + ])) { return false; } @@ -315,10 +315,10 @@ class Wizard extends LDAPUtility { */ public function determineAttributes() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - 'ldapUserFilter', - ])) { + 'ldapPort', + 'ldapBase', + 'ldapUserFilter', + ])) { return false; } @@ -344,10 +344,10 @@ class Wizard extends LDAPUtility { */ private function getUserAttributes() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - 'ldapUserFilter', - ])) { + 'ldapPort', + 'ldapBase', + 'ldapUserFilter', + ])) { return false; } $cr = $this->getConnection(); @@ -400,9 +400,9 @@ class Wizard extends LDAPUtility { */ private function determineGroups($dbKey, $confKey, $testMemberOf = true) { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - ])) { + 'ldapPort', + 'ldapBase', + ])) { return false; } $cr = $this->getConnection(); @@ -480,9 +480,9 @@ class Wizard extends LDAPUtility { public function determineGroupMemberAssoc() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapGroupFilter', - ])) { + 'ldapPort', + 'ldapGroupFilter', + ])) { return false; } $attribute = $this->detectGroupMemberAssoc(); @@ -502,9 +502,9 @@ class Wizard extends LDAPUtility { */ public function determineGroupObjectClasses() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - ])) { + 'ldapPort', + 'ldapBase', + ])) { return false; } $cr = $this->getConnection(); @@ -529,9 +529,9 @@ class Wizard extends LDAPUtility { */ public function determineUserObjectClasses() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - ])) { + 'ldapPort', + 'ldapBase', + ])) { return false; } $cr = $this->getConnection(); @@ -540,7 +540,7 @@ class Wizard extends LDAPUtility { } $obclasses = ['inetOrgPerson', 'person', 'organizationalPerson', - 'user', 'posixAccount', '*']; + 'user', 'posixAccount', '*']; $filter = $this->configuration->ldapUserFilter; //if filter is empty, it is probably the first time the wizard is called //then, apply suggestions. @@ -559,9 +559,9 @@ class Wizard extends LDAPUtility { */ public function getGroupFilter() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - ])) { + 'ldapPort', + 'ldapBase', + ])) { return false; } //make sure the use display name is set @@ -583,9 +583,9 @@ class Wizard extends LDAPUtility { */ public function getUserListFilter() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - ])) { + 'ldapPort', + 'ldapBase', + ])) { return false; } //make sure the use display name is set @@ -609,10 +609,10 @@ class Wizard extends LDAPUtility { */ public function getUserLoginFilter() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - 'ldapBase', - 'ldapUserFilter', - ])) { + 'ldapPort', + 'ldapBase', + 'ldapUserFilter', + ])) { return false; } @@ -666,7 +666,7 @@ class Wizard extends LDAPUtility { */ public function guessPortAndTLS() { if(!$this->checkRequirements(['ldapHost', - ])) { + ])) { return false; } $this->checkHost(); @@ -719,8 +719,8 @@ class Wizard extends LDAPUtility { */ public function guessBaseDN() { if(!$this->checkRequirements(['ldapHost', - 'ldapPort', - ])) { + 'ldapPort', + ])) { return false; } @@ -1318,13 +1318,13 @@ class Wizard extends LDAPUtility { */ private function getDefaultLdapPortSettings() { static $settings = [ - ['port' => 7636, 'tls' => false], - ['port' => 636, 'tls' => false], - ['port' => 7389, 'tls' => true], - ['port' => 389, 'tls' => true], - ['port' => 7389, 'tls' => false], - ['port' => 389, 'tls' => false], - ]; + ['port' => 7636, 'tls' => false], + ['port' => 636, 'tls' => false], + ['port' => 7389, 'tls' => true], + ['port' => 389, 'tls' => true], + ['port' => 7389, 'tls' => false], + ['port' => 389, 'tls' => false], + ]; return $settings; } @@ -1352,7 +1352,7 @@ class Wizard extends LDAPUtility { //default ports $portSettings = array_merge($portSettings, - $this->getDefaultLdapPortSettings()); + $this->getDefaultLdapPortSettings()); return $portSettings; } diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php index 45c01e4b0f0..fee92a523c9 100644 --- a/apps/user_ldap/tests/ConfigurationTest.php +++ b/apps/user_ldap/tests/ConfigurationTest.php @@ -53,7 +53,7 @@ class ConfigurationTest extends \Test\TestCase { ' ', '', ' whats my name', - ' ' + ' ' ]; $expectedNames = ['uid', 'cn', 'whats my name']; diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php index 7c62a20165e..385d2c29610 100644 --- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php +++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php @@ -175,8 +175,8 @@ class ExceptionOnLostConnection { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Content-Type: application/json', - 'Content-Length: ' . strlen($postData)] + 'Content-Type: application/json', + 'Content-Length: ' . strlen($postData)] ); $recvd = curl_exec($ch); $this->checkCurlResult($ch, $recvd); diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index 71e08654893..4433ed08baa 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -58,8 +58,8 @@ class LDAPProviderTest extends \Test\TestCase { ->setConstructorArgs(['', new \OC\Config(\OC::$configDir)]) ->getMock(); $server->expects($this->at(1)) - ->method('getBackends') - ->willReturn([$userBackend]); + ->method('getBackends') + ->willReturn([$userBackend]); $server->expects($this->any()) ->method('getUserManager') ->willReturn($this->getUserManagerMock($userBackend)); @@ -67,8 +67,8 @@ class LDAPProviderTest extends \Test\TestCase { ->method('getGroupManager') ->willReturn($this->getGroupManagerMock($groupBackend)); $server->expects($this->any()) - ->method($this->anything()) - ->willReturnSelf(); + ->method($this->anything()) + ->willReturnSelf(); return $server; } @@ -135,14 +135,14 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->at(0)) - ->method('userExists') - ->willReturn(true); + ->method('userExists') + ->willReturn(true); $userBackend->expects($this->at(2)) - ->method('username2dn') - ->willReturn('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org'); + ->method('username2dn') + ->willReturn('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org'); $userBackend->expects($this->any()) - ->method($this->anything()) - ->willReturnSelf(); + ->method($this->anything()) + ->willReturnSelf(); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -207,8 +207,8 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->any()) - ->method('dn2UserName') - ->willReturn('existing_user'); + ->method('dn2UserName') + ->willReturn('existing_user'); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -272,11 +272,11 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->any()) - ->method('userExists') - ->willReturn(true); + ->method('userExists') + ->willReturn(true); $userBackend->expects($this->any()) - ->method('getNewLDAPConnection') - ->willReturn(true); + ->method('getNewLDAPConnection') + ->willReturn(true); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -381,8 +381,8 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->atLeastOnce()) - ->method('userExists') - ->willReturn(true); + ->method('userExists') + ->willReturn(true); $userBackend->expects($this->any()) ->method('getLDAPAccess') ->willReturn($access); @@ -437,8 +437,8 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->any()) - ->method('userExists') - ->willReturn(true); + ->method('userExists') + ->willReturn(true); $userBackend->expects($this->any()) ->method('getLDAPAccess') ->willReturn($access); @@ -472,14 +472,14 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->at(0)) - ->method('userExists') - ->willReturn(true); + ->method('userExists') + ->willReturn(true); $userBackend->expects($this->at(3)) - ->method('clearCache') - ->willReturn(true); + ->method('clearCache') + ->willReturn(true); $userBackend->expects($this->any()) - ->method($this->anything()) - ->willReturnSelf(); + ->method($this->anything()) + ->willReturnSelf(); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); @@ -539,8 +539,8 @@ class LDAPProviderTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userBackend->expects($this->any()) - ->method('dn2UserName') - ->willReturn('existing_user'); + ->method('dn2UserName') + ->willReturn('existing_user'); $server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock()); diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php index 4a7fbb6bbaf..d3a988a06b7 100644 --- a/apps/user_ldap/tests/WizardTest.php +++ b/apps/user_ldap/tests/WizardTest.php @@ -49,7 +49,7 @@ class WizardTest extends TestCase { //we need to make sure the consts are defined, otherwise tests will fail //on systems without php5_ldap $ldapConsts = ['LDAP_OPT_PROTOCOL_VERSION', - 'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT']; + 'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT']; foreach($ldapConsts as $const) { if(!defined($const)) { define($const, 42); |