Merge pull request #29848 from nextcloud/backport/29836/stable23

[stable23] Make sure mapping cache is cleared when deleting a user
This commit is contained in:
MichaIng 2021-11-26 15:46:16 +01:00 committed by GitHub
commit 1441f46bbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -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]);
}

View file

@ -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');