mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-23 04:14:36 +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
|
@ -37,17 +37,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
*/
|
||||
final class LoginSuccessSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
private RequestStack $requestStack;
|
||||
private EventLogger $eventLogger;
|
||||
private bool $gpdr_compliance;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, RequestStack $requestStack, EventLogger $eventLogger, bool $gpdr_compliance)
|
||||
public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliance)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->requestStack = $requestStack;
|
||||
$this->eventLogger = $eventLogger;
|
||||
$this->gpdr_compliance = $gpdr_compliance;
|
||||
}
|
||||
|
||||
public function onLogin(InteractiveLoginEvent $event): void
|
||||
|
|
|
@ -36,14 +36,8 @@ use Symfony\Component\Security\Core\Security;
|
|||
*/
|
||||
final class LogoutDisabledUserSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private \Symfony\Bundle\SecurityBundle\Security $security;
|
||||
private UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator)
|
||||
public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
$this->security = $security;
|
||||
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
public function onRequest(RequestEvent $event): void
|
||||
|
|
|
@ -55,13 +55,9 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
|||
* @var string The route the user will redirected to, if he needs to change this password
|
||||
*/
|
||||
public const REDIRECT_TARGET = 'user_settings';
|
||||
private \Symfony\Bundle\SecurityBundle\Security $security;
|
||||
private HttpUtils $httpUtils;
|
||||
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, HttpUtils $httpUtils)
|
||||
public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly HttpUtils $httpUtils)
|
||||
{
|
||||
$this->security = $security;
|
||||
$this->httpUtils = $httpUtils;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +125,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
|||
{
|
||||
$tfa_enabled = $user->isWebAuthnAuthenticatorEnabled() || $user->isGoogleAuthenticatorEnabled();
|
||||
|
||||
return null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
|
||||
return $user->getGroup() instanceof \App\Entity\UserSystem\Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
|
|
|
@ -33,13 +33,8 @@ use Symfony\Component\Security\Core\Security;
|
|||
*/
|
||||
final class SetUserTimezoneSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private string $default_timezone;
|
||||
private \Symfony\Bundle\SecurityBundle\Security $security;
|
||||
|
||||
public function __construct(string $timezone, \Symfony\Bundle\SecurityBundle\Security $security)
|
||||
public function __construct(private readonly string $default_timezone, private readonly \Symfony\Bundle\SecurityBundle\Security $security)
|
||||
{
|
||||
$this->default_timezone = $timezone;
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function setTimeZone(ControllerEvent $event): void
|
||||
|
|
|
@ -35,17 +35,8 @@ use Symfony\Component\Security\Core\Security;
|
|||
*/
|
||||
class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
private \Symfony\Bundle\SecurityBundle\Security $security;
|
||||
private PermissionSchemaUpdater $permissionSchemaUpdater;
|
||||
private EntityManagerInterface $entityManager;
|
||||
private EventCommentHelper $eventCommentHelper;
|
||||
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper)
|
||||
public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper)
|
||||
{
|
||||
$this->security = $security;
|
||||
$this->permissionSchemaUpdater = $permissionSchemaUpdater;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->eventCommentHelper = $eventCommentHelper;
|
||||
}
|
||||
|
||||
public function onRequest(RequestEvent $event): void
|
||||
|
@ -55,7 +46,7 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
|
|||
}
|
||||
|
||||
$user = $this->security->getUser();
|
||||
if (null === $user) {
|
||||
if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
|
||||
//Retrieve anonymous user
|
||||
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue