feat: disable/block teamer users as admin

This commit is contained in:
Björn Fromme
2025-07-22 17:11:39 +02:00
parent 0fc7684fc7
commit ea574427fb
10 changed files with 300 additions and 6 deletions
+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
{
}
}