mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Fixed static analysis issues.
This commit is contained in:
parent
51e05a8669
commit
58ada496e4
4 changed files with 11 additions and 4 deletions
|
@ -51,6 +51,7 @@ use App\Entity\LogSystem\ElementCreatedLogEntry;
|
||||||
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
use App\Entity\LogSystem\ElementDeletedLogEntry;
|
||||||
use App\Entity\LogSystem\ElementEditedLogEntry;
|
use App\Entity\LogSystem\ElementEditedLogEntry;
|
||||||
use App\Form\Filters\LogFilterType;
|
use App\Form\Filters\LogFilterType;
|
||||||
|
use App\Repository\DBElementRepository;
|
||||||
use App\Services\LogSystem\EventUndoHelper;
|
use App\Services\LogSystem\EventUndoHelper;
|
||||||
use App\Services\LogSystem\TimeTravel;
|
use App\Services\LogSystem\TimeTravel;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
@ -71,7 +72,7 @@ class LogController extends AbstractController
|
||||||
{
|
{
|
||||||
protected EntityManagerInterface $entityManager;
|
protected EntityManagerInterface $entityManager;
|
||||||
protected TimeTravel $timeTravel;
|
protected TimeTravel $timeTravel;
|
||||||
protected EntityRepository $dbRepository;
|
protected DBElementRepository $dbRepository;
|
||||||
|
|
||||||
public function __construct(EntityManagerInterface $entityManager, TimeTravel $timeTravel)
|
public function __construct(EntityManagerInterface $entityManager, TimeTravel $timeTravel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ class PasswordResetManager
|
||||||
}
|
}
|
||||||
|
|
||||||
$unencrypted_token = md5(random_bytes(32));
|
$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
|
//Determine the expiration datetime of
|
||||||
$expiration_date = new DateTime();
|
$expiration_date = new DateTime();
|
||||||
|
@ -140,7 +140,7 @@ class PasswordResetManager
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if token is valid
|
//Check if token is valid
|
||||||
if (!$this->passwordEncoder->verify($user->getPwResetToken(), $token, null)) {
|
if (!$this->passwordEncoder->verify($user->getPwResetToken(), $token)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,9 @@ class NodesListBuilder
|
||||||
return $this->cache->get($key, function (ItemInterface $item) use ($class_name, $parent, $secure_class_name) {
|
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
|
// Invalidate when groups, a element with the class or the user changes
|
||||||
$item->tag(['groups', 'tree_list', $this->keyGenerator->generateKey(), $secure_class_name]);
|
$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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,10 @@ class UserCacheKeyGenerator
|
||||||
$user = $this->security->getUser();
|
$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.
|
//If the user is null, then treat it as anonymous user.
|
||||||
//When the anonymous user is passed as user then use this path too.
|
//When the anonymous user is passed as user then use this path too.
|
||||||
if (null === $user || User::ID_ANONYMOUS === $user->getID()) {
|
if (null === $user || User::ID_ANONYMOUS === $user->getID()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue