feat: disable/block teamer users as admin

This commit is contained in:
Björn Fromme committed 2025-07-22 17:11:39 +02:00
1 parent 0fc7684fc7
commit ea574427fb
10 files changed
+300 -6

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Security;
use App\Entity\User;
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
class UserChecker implements UserCheckerInterface
{
public function checkPreAuth(UserInterface $user): void
{
if (!$user instanceof User) {
return;
}
if (true === $user->isDisabled()) {
throw new CustomUserMessageAccountStatusException('Dein Account wurde gesperrt: '.$user->getDisabledReason());
}
}
public function checkPostAuth(UserInterface $user): void
{
}
}