diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index c222ab9c..1945639c 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -51,6 +51,7 @@ use App\Entity\LogSystem\ElementCreatedLogEntry; use App\Entity\LogSystem\ElementDeletedLogEntry; use App\Entity\LogSystem\ElementEditedLogEntry; use App\Form\Filters\LogFilterType; +use App\Repository\DBElementRepository; use App\Services\LogSystem\EventUndoHelper; use App\Services\LogSystem\TimeTravel; use Doctrine\ORM\EntityManagerInterface; @@ -71,7 +72,7 @@ class LogController extends AbstractController { protected EntityManagerInterface $entityManager; protected TimeTravel $timeTravel; - protected EntityRepository $dbRepository; + protected DBElementRepository $dbRepository; public function __construct(EntityManagerInterface $entityManager, TimeTravel $timeTravel) { diff --git a/src/Services/PasswordResetManager.php b/src/Services/PasswordResetManager.php index 545013db..949afe6e 100644 --- a/src/Services/PasswordResetManager.php +++ b/src/Services/PasswordResetManager.php @@ -85,7 +85,7 @@ class PasswordResetManager } $unencrypted_token = md5(random_bytes(32)); - $user->setPwResetToken($this->passwordEncoder->hash($unencrypted_token, null)); + $user->setPwResetToken($this->passwordEncoder->hash($unencrypted_token)); //Determine the expiration datetime of $expiration_date = new DateTime(); @@ -140,7 +140,7 @@ class PasswordResetManager } //Check if token is valid - if (!$this->passwordEncoder->verify($user->getPwResetToken(), $token, null)) { + if (!$this->passwordEncoder->verify($user->getPwResetToken(), $token)) { return false; } diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php index ed6c0524..d9bd9859 100644 --- a/src/Services/Trees/NodesListBuilder.php +++ b/src/Services/Trees/NodesListBuilder.php @@ -84,7 +84,9 @@ class NodesListBuilder return $this->cache->get($key, function (ItemInterface $item) use ($class_name, $parent, $secure_class_name) { // Invalidate when groups, a element with the class or the user changes $item->tag(['groups', 'tree_list', $this->keyGenerator->generateKey(), $secure_class_name]); - return $this->em->getRepository($class_name)->toNodesList($parent); + /** @var StructuralDBElementRepository $repo */ + $repo = $this->em->getRepository($class_name); + return $repo->toNodesList($parent); }); } diff --git a/src/Services/UserCacheKeyGenerator.php b/src/Services/UserCacheKeyGenerator.php index e301da61..827479ab 100644 --- a/src/Services/UserCacheKeyGenerator.php +++ b/src/Services/UserCacheKeyGenerator.php @@ -73,6 +73,10 @@ class UserCacheKeyGenerator $user = $this->security->getUser(); } + if (!$user instanceof User){ + throw new \RuntimeException('UserCacheKeyGenerator::generateKey() was called without a user, but no user is logged in!'); + } + //If the user is null, then treat it as anonymous user. //When the anonymous user is passed as user then use this path too. if (null === $user || User::ID_ANONYMOUS === $user->getID()) {