mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
fix: Remove static var is Access class
It’s actually more correct to cache this per-instance. What’s less clear is whether this can always fit in memory. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
b1f07e887e
commit
18dddbc3b5
1 changed files with 4 additions and 4 deletions
|
|
@ -49,6 +49,7 @@ class Access extends LDAPUtility {
|
|||
protected $groupMapper;
|
||||
|
||||
private string $lastCookie = '';
|
||||
private array $intermediates = [];
|
||||
|
||||
public function __construct(
|
||||
ILDAPWrapper $ldap,
|
||||
|
|
@ -484,8 +485,7 @@ class Access extends LDAPUtility {
|
|||
* @throws \Exception
|
||||
*/
|
||||
public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, ?array $record = null, bool $autoMapping = true) {
|
||||
static $intermediates = [];
|
||||
if (isset($intermediates[($isUser ? 'user-' : 'group-') . $fdn])) {
|
||||
if (isset($this->intermediates[($isUser ? 'user-' : 'group-') . $fdn])) {
|
||||
return false; // is a known intermediate
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ class Access extends LDAPUtility {
|
|||
$record = $this->readAttributes($fdn, $attributesToRead, $filter);
|
||||
if ($record === false) {
|
||||
$this->logger->debug('Cannot read attributes for ' . $fdn . '. Skipping.', ['filter' => $filter]);
|
||||
$intermediates[($isUser ? 'user-' : 'group-') . $fdn] = true;
|
||||
$this->intermediates[($isUser ? 'user-' : 'group-') . $fdn] = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -579,7 +579,7 @@ class Access extends LDAPUtility {
|
|||
$ldapName = $record[$nameAttribute];
|
||||
if (!isset($ldapName[0]) || empty($ldapName[0])) {
|
||||
$this->logger->debug('No or empty name for ' . $fdn . ' with filter ' . $filter . '.', ['app' => 'user_ldap']);
|
||||
$intermediates['group-' . $fdn] = true;
|
||||
$this->intermediates['group-' . $fdn] = true;
|
||||
return false;
|
||||
}
|
||||
$ldapName = $ldapName[0];
|
||||
|
|
|
|||
Loading…
Reference in a new issue