diff options
author | MichaIng <micha@dietpi.com> | 2021-11-26 15:46:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-26 15:46:16 +0100 |
commit | 1441f46bbefc549b28fd941687ceee95c7adfce3 (patch) | |
tree | ceec13671dc92d0689bbe5fce417ad3b2e0b5103 | |
parent | 9275a9f28a7f9341201999737dc53a40cfea5f5d (diff) | |
parent | 2b58973533769f884c58ae94dd3c36d201086e94 (diff) | |
download | nextcloud-server-1441f46bbefc549b28fd941687ceee95c7adfce3.tar.gz nextcloud-server-1441f46bbefc549b28fd941687ceee95c7adfce3.zip |
Merge pull request #29848 from nextcloud/backport/29836/stable23
[stable23] Make sure mapping cache is cleared when deleting a user
-rw-r--r-- | apps/user_ldap/lib/Mapping/AbstractMapping.php | 5 | ||||
-rw-r--r-- | apps/user_ldap/tests/Mapping/AbstractMappingTest.php | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index ae881f9dc17..85fc91590fb 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -379,6 +379,11 @@ abstract class AbstractMapping { DELETE FROM `' . $this->getTableName() . '` WHERE `owncloud_name` = ?'); + $dn = array_search($name, $this->cache); + if ($dn !== false) { + unset($this->cache[$dn]); + } + return $this->modify($statement, [$name]); } diff --git a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php index cc2b36fb7df..9c25b1d9af6 100644 --- a/apps/user_ldap/tests/Mapping/AbstractMappingTest.php +++ b/apps/user_ldap/tests/Mapping/AbstractMappingTest.php @@ -127,8 +127,12 @@ abstract class AbstractMappingTest extends \Test\TestCase { [$mapper, $data] = $this->initTest(); foreach ($data as $entry) { + $fdnBefore = $mapper->getDNByName($entry['name']); $result = $mapper->unmap($entry['name']); + $fdnAfter = $mapper->getDNByName($entry['name']); $this->assertTrue($result); + $this->assertSame($fdnBefore, $entry['dn']); + $this->assertFalse($fdnAfter); } $result = $mapper->unmap('notAnEntry'); |