summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/ajax/clearMappings.php2
-rw-r--r--apps/user_ldap/lib/Access.php10
-rw-r--r--apps/user_ldap/lib/Command/TestConfig.php4
-rw-r--r--apps/user_ldap/lib/Configuration.php2
-rw-r--r--apps/user_ldap/lib/Connection.php2
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php2
-rw-r--r--apps/user_ldap/lib/Helper.php2
-rw-r--r--apps/user_ldap/lib/LDAP.php16
-rw-r--r--apps/user_ldap/lib/Notification/Notifier.php2
-rw-r--r--apps/user_ldap/lib/User/Manager.php2
-rw-r--r--apps/user_ldap/lib/User/User.php10
-rw-r--r--apps/user_ldap/lib/Wizard.php10
-rw-r--r--apps/user_ldap/tests/Group_LDAPTest.php8
-rw-r--r--apps/user_ldap/tests/User_LDAPTest.php4
-rw-r--r--apps/user_ldap/tests/WizardTest.php12
15 files changed, 44 insertions, 44 deletions
diff --git a/apps/user_ldap/ajax/clearMappings.php b/apps/user_ldap/ajax/clearMappings.php
index 63759662815..5102822ce4e 100644
--- a/apps/user_ldap/ajax/clearMappings.php
+++ b/apps/user_ldap/ajax/clearMappings.php
@@ -46,7 +46,7 @@ try {
\OC::$server->getUserManager()->emit('\OC\User', 'postUnassignedUserId', [$uid]);
}
);
- } else if($subject === 'group') {
+ } elseif($subject === 'group') {
$mapping = new GroupMapping(\OC::$server->getDatabaseConnection());
$result = $mapping->clear();
}
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 836e1fddb85..5677f3614cc 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -729,7 +729,7 @@ class Access extends LDAPUtility {
$sndName = isset($ldapObject[$sndAttribute][0])
? $ldapObject[$sndAttribute][0] : '';
$this->cacheUserDisplayName($ncName, $nameByLDAP, $sndName);
- } else if($nameByLDAP !== null) {
+ } elseif($nameByLDAP !== null) {
$this->cacheGroupDisplayName($ncName, $nameByLDAP);
}
}
@@ -1390,7 +1390,7 @@ class Access extends LDAPUtility {
if($key !== 'dn') {
if($this->resemblesDN($key)) {
$selection[$i][$key] = $this->helper->sanitizeDN($item[$key]);
- } else if($key === 'objectguid' || $key === 'guid') {
+ } elseif($key === 'objectguid' || $key === 'guid') {
$selection[$i][$key] = [$this->convertObjectGUID2Str($item[$key][0])];
} else {
$selection[$i][$key] = $item[$key];
@@ -1609,7 +1609,7 @@ class Access extends LDAPUtility {
$result = $term;
if ($term === '') {
$result = '*';
- } else if ($allowEnum !== 'no') {
+ } elseif ($allowEnum !== 'no') {
$result = $term . '*';
}
return $result;
@@ -1716,7 +1716,7 @@ class Access extends LDAPUtility {
if(!$force) {
if($this->connection->$uuidAttr !== 'auto') {
return true;
- } else if (is_string($uuidOverride) && trim($uuidOverride) !== '') {
+ } elseif (is_string($uuidOverride) && trim($uuidOverride) !== '') {
$this->connection->$uuidAttr = $uuidOverride;
return true;
}
@@ -2097,7 +2097,7 @@ class Access extends LDAPUtility {
* So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
* if we don't have a previous paged search.
*/
- } else if ($limit === 0 && !empty($this->lastCookie)) {
+ } elseif ($limit === 0 && !empty($this->lastCookie)) {
// a search without limit was requested. However, if we do use
// Paged Search once, we always must do it. This requires us to
// initialize it with the configured page size.
diff --git a/apps/user_ldap/lib/Command/TestConfig.php b/apps/user_ldap/lib/Command/TestConfig.php
index abab07d92f1..6ddd420e4f0 100644
--- a/apps/user_ldap/lib/Command/TestConfig.php
+++ b/apps/user_ldap/lib/Command/TestConfig.php
@@ -60,9 +60,9 @@ class TestConfig extends Command {
$result = $this->testConfig($configID);
if($result === 0) {
$output->writeln('The configuration is valid and the connection could be established!');
- } else if($result === 1) {
+ } elseif($result === 1) {
$output->writeln('The configuration is invalid. Please have a look at the logs for further details.');
- } else if($result === 2) {
+ } elseif($result === 2) {
$output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.');
} else {
$output->writeln('Your LDAP server was kidnapped by aliens.');
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 3c6693b151e..ccba7b43586 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -318,7 +318,7 @@ class Configuration {
protected function setMultiLine($varName, $value) {
if(empty($value)) {
$value = '';
- } else if (!is_array($value)) {
+ } elseif (!is_array($value)) {
$value = preg_split('/\r\n|\r|\n|;/', $value);
if($value === false) {
$value = '';
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 14a0e19989a..51c35c2a665 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -202,7 +202,7 @@ class Connection extends LDAPUtility {
public function getConnectionResource() {
if(!$this->ldapConnectionRes) {
$this->init();
- } else if(!$this->ldap->isResource($this->ldapConnectionRes)) {
+ } elseif(!$this->ldap->isResource($this->ldapConnectionRes)) {
$this->ldapConnectionRes = null;
$this->establishConnection();
}
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index c166ad5ebef..246b61b5202 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -736,7 +736,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|| (strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'member')
) {
$uid = $userDN;
- } else if(strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
+ } elseif(strtolower($this->access->connection->ldapGroupMemberAssocAttr) === 'memberuid') {
$result = $this->access->readAttribute($userDN, 'uid');
if ($result === false) {
\OCP\Util::writeLog('user_ldap', 'No uid attribute found for DN ' . $userDN . ' on '.
diff --git a/apps/user_ldap/lib/Helper.php b/apps/user_ldap/lib/Helper.php
index 595e3c92ec8..19797d8a98b 100644
--- a/apps/user_ldap/lib/Helper.php
+++ b/apps/user_ldap/lib/Helper.php
@@ -208,7 +208,7 @@ class Helper {
$domain = false;
if(isset($uinfo['host'])) {
$domain = $uinfo['host'];
- } else if(isset($uinfo['path'])) {
+ } elseif(isset($uinfo['path'])) {
$domain = $uinfo['path'];
}
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php
index f346272a18b..c4a30770566 100644
--- a/apps/user_ldap/lib/LDAP.php
+++ b/apps/user_ldap/lib/LDAP.php
@@ -343,19 +343,19 @@ class LDAP implements ILDAPWrapper {
if($this->curFunc === 'ldap_get_entries'
&& $errorCode === -4) {
- } else if ($errorCode === 32) {
+ } elseif ($errorCode === 32) {
//for now
- } else if ($errorCode === 10) {
+ } elseif ($errorCode === 10) {
//referrals, we switch them off, but then there is AD :)
- } else if ($errorCode === -1) {
+ } elseif ($errorCode === -1) {
throw new ServerNotAvailableException('Lost connection to LDAP server.');
- } else if ($errorCode === 52) {
+ } elseif ($errorCode === 52) {
throw new ServerNotAvailableException('LDAP server is shutting down.');
- } else if ($errorCode === 48) {
+ } elseif ($errorCode === 48) {
throw new \Exception('LDAP authentication method rejected', $errorCode);
- } else if ($errorCode === 1) {
+ } elseif ($errorCode === 1) {
throw new \Exception('LDAP Operations error', $errorCode);
- } else if ($errorCode === 19) {
+ } elseif ($errorCode === 19) {
ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error);
throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode);
} else {
@@ -375,7 +375,7 @@ class LDAP implements ILDAPWrapper {
private function postFunctionCall() {
if($this->isResource($this->curArgs[0])) {
$resource = $this->curArgs[0];
- } else if(
+ } elseif(
$this->curFunc === 'ldap_search'
&& is_array($this->curArgs[0])
&& $this->isResource($this->curArgs[0][0])
diff --git a/apps/user_ldap/lib/Notification/Notifier.php b/apps/user_ldap/lib/Notification/Notifier.php
index 773242a635b..167f282beb7 100644
--- a/apps/user_ldap/lib/Notification/Notifier.php
+++ b/apps/user_ldap/lib/Notification/Notifier.php
@@ -83,7 +83,7 @@ class Notifier implements INotifier {
$days = (int) $params[0];
if ($days === 2) {
$notification->setParsedSubject($l->t('Your password will expire tomorrow.'));
- } else if ($days === 1) {
+ } elseif ($days === 1) {
$notification->setParsedSubject($l->t('Your password will expire today.'));
} else {
$notification->setParsedSubject($l->n(
diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php
index c7660a40ba6..f3729f2458e 100644
--- a/apps/user_ldap/lib/User/Manager.php
+++ b/apps/user_ldap/lib/User/Manager.php
@@ -260,7 +260,7 @@ class Manager {
$this->checkAccess();
if(isset($this->usersByDN[$id])) {
return $this->usersByDN[$id];
- } else if(isset($this->usersByUid[$id])) {
+ } elseif(isset($this->usersByUid[$id])) {
return $this->usersByUid[$id];
}
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 2c038e43285..28eeddccef0 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -131,7 +131,7 @@ class User {
if ($username === null) {
$log->log("uid for '$dn' must not be null!", ILogger::ERROR);
throw new \InvalidArgumentException('uid must not be null!');
- } else if ($username === '') {
+ } elseif ($username === '') {
$log->log("uid for '$dn' must not be an empty string", ILogger::ERROR);
throw new \InvalidArgumentException('uid must not be an empty string!');
}
@@ -241,7 +241,7 @@ class User {
// LDAP Username, needed for s2s sharing
if(isset($ldapEntry['uid'])) {
$this->storeLDAPUserName($ldapEntry['uid'][0]);
- } else if(isset($ldapEntry['samaccountname'])) {
+ } elseif(isset($ldapEntry['samaccountname'])) {
$this->storeLDAPUserName($ldapEntry['samaccountname'][0]);
}
@@ -548,10 +548,10 @@ class User {
$aQuota = $this->access->readAttribute($this->dn, $quotaAttribute);
if($aQuota && (count($aQuota) > 0) && $this->verifyQuotaValue($aQuota[0])) {
$quota = $aQuota[0];
- } else if(is_array($aQuota) && isset($aQuota[0])) {
+ } elseif(is_array($aQuota) && isset($aQuota[0])) {
$this->log->log('no suitable LDAP quota found for user ' . $this->uid . ': [' . $aQuota[0] . ']', ILogger::DEBUG);
}
- } else if ($this->verifyQuotaValue($valueFromLDAP)) {
+ } elseif ($this->verifyQuotaValue($valueFromLDAP)) {
$quota = $valueFromLDAP;
} else {
$this->log->log('no suitable LDAP quota found for user ' . $this->uid . ': [' . $valueFromLDAP . ']', ILogger::DEBUG);
@@ -560,7 +560,7 @@ class User {
if ($quota === false && $this->verifyQuotaValue($defaultQuota)) {
// quota not found using the LDAP attribute (or not parseable). Try the default quota
$quota = $defaultQuota;
- } else if($quota === false) {
+ } elseif($quota === false) {
$this->log->log('no suitable default quota found for user ' . $this->uid . ': [' . $defaultQuota . ']', ILogger::DEBUG);
return;
}
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index 839578cd606..a0dcd0febbf 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -106,9 +106,9 @@ class Wizard extends LDAPUtility {
$limit = 1001;
if($type === 'groups') {
$result = $this->access->countGroups($filter, $attr, $limit);
- } else if($type === 'users') {
+ } elseif($type === 'users') {
$result = $this->access->countUsers($filter, $attr, $limit);
- } else if ($type === 'objects') {
+ } elseif ($type === 'objects') {
$result = $this->access->countObjects($limit);
} else {
throw new \Exception('Internal error: Invalid object type', 500);
@@ -981,9 +981,9 @@ class Wizard extends LDAPUtility {
$attr = '';
if(isset($userAttributes['uid'])) {
$attr = 'uid';
- } else if(isset($userAttributes['samaccountname'])) {
+ } elseif(isset($userAttributes['samaccountname'])) {
$attr = 'samaccountname';
- } else if(isset($userAttributes['cn'])) {
+ } elseif(isset($userAttributes['cn'])) {
//fallback
$attr = 'cn';
}
@@ -1239,7 +1239,7 @@ class Wizard extends LDAPUtility {
if(is_array($setFeatures) && !empty($setFeatures)) {
//something is already configured? pre-select it.
$this->result->addChange($dbkey, $setFeatures);
- } else if ($po && $maxEntryObjC !== '') {
+ } elseif ($po && $maxEntryObjC !== '') {
//pre-select objectclass with most result entries
$maxEntryObjC = str_replace($p, '', $maxEntryObjC);
$this->applyFind($dbkey, $maxEntryObjC);
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index cf6e2d7bb84..305df690358 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -523,7 +523,7 @@ class Group_LDAPTest extends TestCase {
->willReturnCallback(function ($dn, $attr) {
if($attr === 'primaryGroupToken') {
return [1337];
- } else if($attr === 'gidNumber') {
+ } elseif($attr === 'gidNumber') {
return [4211];
}
return [];
@@ -657,7 +657,7 @@ class Group_LDAPTest extends TestCase {
->willReturnCallback(function ($name) {
if($name === 'useMemberOfToDetectMembership') {
return 0;
- } else if($name === 'ldapDynamicGroupMemberURL') {
+ } elseif($name === 'ldapDynamicGroupMemberURL') {
return '';
}
return 1;
@@ -1082,9 +1082,9 @@ class Group_LDAPTest extends TestCase {
->willReturnCallback(function ($name) {
if($name === 'ldapGroupMemberAssocAttr') {
return 'member';
- } else if($name === 'ldapGroupFilter') {
+ } elseif($name === 'ldapGroupFilter') {
return 'objectclass=nextcloudGroup';
- } else if($name === 'ldapGroupDisplayName') {
+ } elseif($name === 'ldapGroupDisplayName') {
return 'cn';
}
return null;
diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php
index 8dc699f371b..2b0fcd681f9 100644
--- a/apps/user_ldap/tests/User_LDAPTest.php
+++ b/apps/user_ldap/tests/User_LDAPTest.php
@@ -871,7 +871,7 @@ class User_LDAPTest extends TestCase {
->willReturnCallback(function ($uid) use ($user1, $user2) {
if($uid === 'gunslinger') {
return $user1;
- } else if($uid === 'newyorker') {
+ } elseif($uid === 'newyorker') {
return $user2;
}
return null;
@@ -950,7 +950,7 @@ class User_LDAPTest extends TestCase {
->willReturnCallback(function ($uid) use ($user1, $user2) {
if($uid === 'gunslinger') {
return $user1;
- } else if($uid === 'newyorker') {
+ } elseif($uid === 'newyorker') {
return $user2;
}
return null;
diff --git a/apps/user_ldap/tests/WizardTest.php b/apps/user_ldap/tests/WizardTest.php
index 0a94eb2a1f4..67af7e9b177 100644
--- a/apps/user_ldap/tests/WizardTest.php
+++ b/apps/user_ldap/tests/WizardTest.php
@@ -282,9 +282,9 @@ class WizardTest extends TestCase {
->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
- } else if($filter === 'mail') {
+ } elseif($filter === 'mail') {
return 3;
- } else if($filter === 'mailPrimaryAddress') {
+ } elseif($filter === 'mailPrimaryAddress') {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
@@ -321,9 +321,9 @@ class WizardTest extends TestCase {
->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
- } else if($filter === 'mail') {
+ } elseif($filter === 'mail') {
return 3;
- } else if($filter === 'mailPrimaryAddress') {
+ } elseif($filter === 'mailPrimaryAddress') {
return 17;
}
throw new \Exception('Untested filter: ' . $filter);
@@ -360,9 +360,9 @@ class WizardTest extends TestCase {
->willReturnCallback(function ($filter) {
if($filter === 'myEmailAttribute') {
return 0;
- } else if($filter === 'mail') {
+ } elseif($filter === 'mail') {
return 0;
- } else if($filter === 'mailPrimaryAddress') {
+ } elseif($filter === 'mailPrimaryAddress') {
return 0;
}
throw new \Exception('Untested filter: ' . $filter);