mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Applied rector with PHP8.1 migration rules
This commit is contained in:
parent
dc6a67c2f0
commit
7ee01d9a05
303 changed files with 1228 additions and 3465 deletions
|
@ -33,17 +33,11 @@ use Symfony\Component\Validator\ConstraintValidator;
|
|||
|
||||
class NoLockoutValidator extends ConstraintValidator
|
||||
{
|
||||
protected PermissionManager $resolver;
|
||||
protected array $perm_structure;
|
||||
protected \Symfony\Bundle\SecurityBundle\Security $security;
|
||||
protected EntityManagerInterface $entityManager;
|
||||
|
||||
public function __construct(PermissionManager $resolver, \Symfony\Bundle\SecurityBundle\Security $security, EntityManagerInterface $entityManager)
|
||||
public function __construct(protected PermissionManager $resolver, protected \Symfony\Bundle\SecurityBundle\Security $security, protected EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
$this->security = $security;
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,12 +58,12 @@ class NoLockoutValidator extends ConstraintValidator
|
|||
if ($perm_holder instanceof User || $perm_holder instanceof Group) {
|
||||
$user = $this->security->getUser();
|
||||
|
||||
if (null === $user) {
|
||||
if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
|
||||
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
|
||||
}
|
||||
|
||||
//Check if the change_permission permission has changed from allow to disallow
|
||||
if (($user instanceof User) && false === ($this->resolver->inherit(
|
||||
if (($user instanceof User) && !($this->resolver->inherit(
|
||||
$user,
|
||||
'users',
|
||||
'edit_permissions'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue