FlorianEisenmenger 1 тиждень тому
джерело
коміт
0f04c96575
4 змінених файлів з 23 додано та 13 видалено
  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 Переглянути файл

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

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

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

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

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

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


+ 8
- 6
httpdocs/src/EventSubscriber/TenantRequestSubscriber.php Переглянути файл

@@ -13,11 +13,13 @@ use Symfony\Component\Routing\RouterInterface;
class TenantRequestSubscriber implements EventSubscriberInterface
{
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
{
@@ -34,7 +36,7 @@ class TenantRequestSubscriber implements EventSubscriberInterface
return;
}

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

if ($account === null) {


+ 3
- 1
httpdocs/src/Security/AccessDeniedHandler.php Переглянути файл

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

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


+ 7
- 3
httpdocs/src/Security/ArchivedUserChecker.php Переглянути файл

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

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

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

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

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


Завантаження…
Відмінити
Зберегти