Explorar el Código

cleanup

master
FlorianEisenmenger hace 1 semana
padre
commit
0f04c96575
Se han modificado 4 ficheros con 23 adiciones y 13 borrados
  1. +5
    -3
      httpdocs/src/EventSubscriber/ArchivedUserSubscriber.php
  2. +8
    -6
      httpdocs/src/EventSubscriber/TenantRequestSubscriber.php
  3. +3
    -1
      httpdocs/src/Security/AccessDeniedHandler.php
  4. +7
    -3
      httpdocs/src/Security/ArchivedUserChecker.php

+ 5
- 3
httpdocs/src/EventSubscriber/ArchivedUserSubscriber.php Ver fichero

@@ -19,7 +19,9 @@ class ArchivedUserSubscriber implements EventSubscriberInterface
private readonly AccountUserRepository $accountUserRepo, private readonly AccountUserRepository $accountUserRepo,
private readonly TenantContext $tenantContext, private readonly TenantContext $tenantContext,
private readonly RouterInterface $router, private readonly RouterInterface $router,
) {}
)
{
}


public function onKernelRequest(RequestEvent $event): void public function onKernelRequest(RequestEvent $event): void
{ {
@@ -28,7 +30,7 @@ class ArchivedUserSubscriber implements EventSubscriberInterface
} }


$token = $this->tokenStorage->getToken(); $token = $this->tokenStorage->getToken();
$user = $token?->getUser();
$user = $token?->getUser();


if ($user === null) { if ($user === null) {
return; return;
@@ -41,7 +43,7 @@ class ArchivedUserSubscriber implements EventSubscriberInterface


$accountUser = $this->accountUserRepo->findOneBy([ $accountUser = $this->accountUserRepo->findOneBy([
'account' => $account, 'account' => $account,
'user' => $user,
'user' => $user,
]); ]);


if ($accountUser === null || !$accountUser->isArchived()) { if ($accountUser === null || !$accountUser->isArchived()) {


+ 8
- 6
httpdocs/src/EventSubscriber/TenantRequestSubscriber.php Ver fichero

@@ -13,11 +13,13 @@ use Symfony\Component\Routing\RouterInterface;
class TenantRequestSubscriber implements EventSubscriberInterface class TenantRequestSubscriber implements EventSubscriberInterface
{ {
public function __construct( public function __construct(
private readonly TenantContext $tenantContext,
private readonly AccountRepository $accountRepo,
private readonly RouterInterface $router,
private readonly string $appDomain,
) {}
private readonly TenantContext $tenantContext,
private readonly AccountRepository $accountRepo,
private readonly RouterInterface $router,
private readonly string $appDomain,
)
{
}


public function onKernelRequest(RequestEvent $event): void public function onKernelRequest(RequestEvent $event): void
{ {
@@ -34,7 +36,7 @@ class TenantRequestSubscriber implements EventSubscriberInterface
return; return;
} }


$slug = str_replace('.' . $appDomainHost, '', $host);
$slug = str_replace('.' . $appDomainHost, '', $host);
$account = $this->accountRepo->findBySlug($slug); $account = $this->accountRepo->findBySlug($slug);


if ($account === null) { if ($account === null) {


+ 3
- 1
httpdocs/src/Security/AccessDeniedHandler.php Ver fichero

@@ -13,7 +13,9 @@ class AccessDeniedHandler implements AccessDeniedHandlerInterface
{ {
public function __construct( public function __construct(
private readonly UrlGeneratorInterface $urlGenerator, private readonly UrlGeneratorInterface $urlGenerator,
) {}
)
{
}


public function handle(Request $request, AccessDeniedException $exception): Response public function handle(Request $request, AccessDeniedException $exception): Response
{ {


+ 7
- 3
httpdocs/src/Security/ArchivedUserChecker.php Ver fichero

@@ -13,9 +13,13 @@ class ArchivedUserChecker implements UserCheckerInterface
public function __construct( public function __construct(
private readonly AccountUserRepository $accountUserRepo, private readonly AccountUserRepository $accountUserRepo,
private readonly TenantContext $tenantContext, private readonly TenantContext $tenantContext,
) {}
)
{
}


public function checkPreAuth(UserInterface $user): void {}
public function checkPreAuth(UserInterface $user): void
{
}


public function checkPostAuth(UserInterface $user): void public function checkPostAuth(UserInterface $user): void
{ {
@@ -26,7 +30,7 @@ class ArchivedUserChecker implements UserCheckerInterface


$accountUser = $this->accountUserRepo->findOneBy([ $accountUser = $this->accountUserRepo->findOneBy([
'account' => $account, 'account' => $account,
'user' => $user,
'user' => $user,
]); ]);


if ($accountUser !== null && $accountUser->isArchived()) { if ($accountUser !== null && $accountUser->isArchived()) {


Cargando…
Cancelar
Guardar