aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/Access.php32
-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/DataCollector/LdapDataCollector.php2
-rw-r--r--apps/user_ldap/lib/Jobs/Sync.php2
-rw-r--r--apps/user_ldap/lib/Mapping/AbstractMapping.php2
-rw-r--r--apps/user_ldap/lib/User/User.php12
7 files changed, 27 insertions, 27 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 3a1690c3b76..a51dfc3b349 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -492,7 +492,7 @@ class Access extends LDAPUtility {
* @return false|string with with the name to use in Nextcloud
* @throws \Exception
*/
- public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, array $record = null) {
+ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, ?array $record = null) {
static $intermediates = [];
if (isset($intermediates[($isUser ? 'user-' : 'group-') . $fdn])) {
return false; // is a known intermediate
@@ -865,7 +865,7 @@ class Access extends LDAPUtility {
/**
* @throws \Exception
*/
- public function fetchListOfUsers(string $filter, array $attr, int $limit = null, int $offset = null, bool $forceApplyAttributes = false): array {
+ public function fetchListOfUsers(string $filter, array $attr, ?int $limit = null, ?int $offset = null, bool $forceApplyAttributes = false): array {
$ldapRecords = $this->searchUsers($filter, $attr, $limit, $offset);
$recordsToUpdate = $ldapRecords;
if (!$forceApplyAttributes) {
@@ -926,7 +926,7 @@ class Access extends LDAPUtility {
/**
* @return array[]
*/
- public function fetchListOfGroups(string $filter, array $attr, int $limit = null, int $offset = null): array {
+ public function fetchListOfGroups(string $filter, array $attr, ?int $limit = null, ?int $offset = null): array {
$cacheKey = 'fetchListOfGroups_' . $filter . '_' . implode('-', $attr) . '_' . (string)$limit . '_' . (string)$offset;
$listOfGroups = $this->connection->getFromCache($cacheKey);
if (!is_null($listOfGroups)) {
@@ -971,7 +971,7 @@ class Access extends LDAPUtility {
/**
* @throws ServerNotAvailableException
*/
- public function searchUsers(string $filter, array $attr = null, int $limit = null, int $offset = null): array {
+ public function searchUsers(string $filter, ?array $attr = null, ?int $limit = null, ?int $offset = null): array {
$result = [];
foreach ($this->connection->ldapBaseUsers as $base) {
$result = array_merge($result, $this->search($filter, $base, $attr, $limit, $offset));
@@ -984,7 +984,7 @@ class Access extends LDAPUtility {
* @return false|int
* @throws ServerNotAvailableException
*/
- public function countUsers(string $filter, array $attr = ['dn'], int $limit = null, int $offset = null) {
+ public function countUsers(string $filter, array $attr = ['dn'], ?int $limit = null, ?int $offset = null) {
$result = false;
foreach ($this->connection->ldapBaseUsers as $base) {
$count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0);
@@ -1001,7 +1001,7 @@ class Access extends LDAPUtility {
* Executes an LDAP search
* @throws ServerNotAvailableException
*/
- public function searchGroups(string $filter, array $attr = null, int $limit = null, int $offset = null): array {
+ public function searchGroups(string $filter, ?array $attr = null, ?int $limit = null, ?int $offset = null): array {
$result = [];
foreach ($this->connection->ldapBaseGroups as $base) {
$result = array_merge($result, $this->search($filter, $base, $attr, $limit, $offset));
@@ -1015,7 +1015,7 @@ class Access extends LDAPUtility {
* @return int|bool
* @throws ServerNotAvailableException
*/
- public function countGroups(string $filter, array $attr = ['dn'], int $limit = null, int $offset = null) {
+ public function countGroups(string $filter, array $attr = ['dn'], ?int $limit = null, ?int $offset = null) {
$result = false;
foreach ($this->connection->ldapBaseGroups as $base) {
$count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0);
@@ -1030,7 +1030,7 @@ class Access extends LDAPUtility {
* @return int|bool
* @throws ServerNotAvailableException
*/
- public function countObjects(int $limit = null, int $offset = null) {
+ public function countObjects(?int $limit = null, ?int $offset = null) {
$result = false;
foreach ($this->connection->ldapBase as $base) {
$count = $this->count('objectclass=*', [$base], ['dn'], $limit ?? 0, $offset ?? 0);
@@ -1202,7 +1202,7 @@ class Access extends LDAPUtility {
private function count(
string $filter,
array $bases,
- array $attr = null,
+ ?array $attr = null,
int $limit = 0,
int $offset = 0,
bool $skipHandling = false
@@ -1730,7 +1730,7 @@ class Access extends LDAPUtility {
* @return false|string
* @throws ServerNotAvailableException
*/
- public function getUUID(string $dn, bool $isUser = true, array $ldapRecord = null) {
+ public function getUUID(string $dn, bool $isUser = true, ?array $ldapRecord = null) {
if ($isUser) {
$uuidAttr = 'ldapUuidUserAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
@@ -2014,12 +2014,12 @@ class Access extends LDAPUtility {
}
$this->logger->debug('Ready for a paged search', ['app' => 'user_ldap']);
return [true, $pageSize, $this->lastCookie];
- /* ++ Fixing RHDS searches with pages with zero results ++
- * We couldn't get paged searches working with our RHDS for login ($limit = 0),
- * due to pages with zero results.
- * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
- * if we don't have a previous paged search.
- */
+ /* ++ Fixing RHDS searches with pages with zero results ++
+ * We couldn't get paged searches working with our RHDS for login ($limit = 0),
+ * due to pages with zero results.
+ * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
+ * if we don't have a previous paged search.
+ */
} elseif ($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
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 2791324be5b..b0bb600cb3b 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -177,7 +177,7 @@ class Configuration {
* array
* @param array &$applied optional; array where the set fields will be given to
*/
- public function setConfiguration(array $config, array &$applied = null): void {
+ public function setConfiguration(array $config, ?array &$applied = null): void {
$cta = $this->getConfigTranslationArray();
foreach ($config as $inputKey => $val) {
if (str_contains($inputKey, '_') && array_key_exists($inputKey, $cta)) {
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 37f7dcaea5c..788344b4e7d 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -307,7 +307,7 @@ class Connection extends LDAPUtility {
* @param string $key
* @param mixed $value
*/
- public function writeToCache($key, $value, int $ttlOverride = null): void {
+ public function writeToCache($key, $value, ?int $ttlOverride = null): void {
if (!$this->configured) {
$this->readConfiguration();
}
diff --git a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php
index 8644626d00b..015248f914d 100644
--- a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php
+++ b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php
@@ -48,6 +48,6 @@ class LdapDataCollector extends AbstractDataCollector {
return 'ldap';
}
- public function collect(Request $request, Response $response, \Throwable $exception = null): void {
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void {
}
}
diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php
index f715a5e9fb9..b92aa2fcfaa 100644
--- a/apps/user_ldap/lib/Jobs/Sync.php
+++ b/apps/user_ldap/lib/Jobs/Sync.php
@@ -224,7 +224,7 @@ class Sync extends TimedJob {
* @param array|null $cycleData the old cycle
* @return array|null
*/
- public function determineNextCycle(array $cycleData = null) {
+ public function determineNextCycle(?array $cycleData = null) {
$prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true);
if (count($prefixes) === 0) {
return null;
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index 40bc8624c3c..6c2938661e2 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -322,7 +322,7 @@ abstract class AbstractMapping {
return $this->getXbyY('directory_uuid', 'ldap_dn_hash', $this->getDNHash($dn));
}
- public function getList(int $offset = 0, int $limit = null, bool $invalidatedOnly = false): array {
+ public function getList(int $offset = 0, ?int $limit = null, bool $invalidatedOnly = false): array {
$select = $this->dbc->getQueryBuilder();
$select->selectAlias('ldap_dn', 'dn')
->selectAlias('owncloud_name', 'name')
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 3b0015380ec..c3e9895e043 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -244,7 +244,7 @@ class User {
($profileCached === null) && // no cache or TTL not expired
!$this->wasRefreshed('profile')) {
// check current data
- $profileValues = array();
+ $profileValues = [];
//User Profile Field - Phone number
$attr = strtolower($this->connection->ldapAttributePhone);
if (!empty($attr)) { // attribute configured
@@ -316,7 +316,7 @@ class User {
if (str_contains($ldapEntry[$attr][0], '\r')) {
// convert line endings
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
- = str_replace(array("\r\n","\r"), "\n", $ldapEntry[$attr][0]);
+ = str_replace(["\r\n","\r"], "\n", $ldapEntry[$attr][0]);
} else {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
= $ldapEntry[$attr][0];
@@ -397,9 +397,9 @@ class User {
if ($path !== '') {
//if attribute's value is an absolute path take this, otherwise append it to data dir
//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]))
+ if ($path[0] !== '/'
+ && !(strlen($path) > 3 && ctype_alpha($path[0])
+ && $path[1] === ':' && ($path[2] === '\\' || $path[2] === '/'))
) {
$path = $this->config->getSystemValue('datadirectory',
\OC::$SERVERROOT.'/data') . '/' . $path;
@@ -785,7 +785,7 @@ class User {
* @throws \OCP\PreConditionNotMetException
* @throws \OC\ServerNotAvailableException
*/
- public function updateExtStorageHome(string $valueFromLDAP = null):string {
+ public function updateExtStorageHome(?string $valueFromLDAP = null):string {
if ($valueFromLDAP === null) {
$extHomeValues = $this->access->readAttribute($this->getDN(), $this->connection->ldapExtStorageHomeAttribute);
} else {