From fc8ab937527dff3c17d07b44716eec28c7d78512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 8 Jan 2020 20:50:37 +0100 Subject: [PATCH] Fixed missing invalidation of user tree views. --- src/Entity/UserSystem/User.php | 1 + src/EntityListeners/TreeCacheInvalidationListener.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index fe490d80..4ecce298 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -82,6 +82,7 @@ use Symfony\Component\Validator\Constraints as Assert; * * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\Table("`users`") + * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) * @UniqueEntity("name", message="validator.user.username_already_used") */ class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface diff --git a/src/EntityListeners/TreeCacheInvalidationListener.php b/src/EntityListeners/TreeCacheInvalidationListener.php index 813029ef..16ce3c8a 100644 --- a/src/EntityListeners/TreeCacheInvalidationListener.php +++ b/src/EntityListeners/TreeCacheInvalidationListener.php @@ -60,8 +60,9 @@ class TreeCacheInvalidationListener //If a user change, then invalidate all cached trees for him if ($element instanceof User) { + $secure_class_name = str_replace('\\', '_', get_class($element)); $tag = $this->keyGenerator->generateKey($element); - $this->cache->invalidateTags([$tag]); + $this->cache->invalidateTags([$tag, $secure_class_name]); } /* If any group change, then invalidate all cached trees. Users Permissions can be inherited from groups,