Allow to disable a user in admin settings.

When a user is disabled, he can not login.
This commit is contained in:
Jan Böhmer 2019-10-26 23:22:27 +02:00
parent dd1dc54d97
commit 2187f5eac2
7 changed files with 216 additions and 2 deletions

View file

@ -56,6 +56,12 @@ abstract class ExtendedVoter extends Voter
final protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
$user = $token->getUser();
//An allowed user is not allowed to do anything...
if($user instanceof User && $user->isDisabled()) {
return false;
}
// if the user is anonymous, we use the anonymous user.
if (!$user instanceof User) {
$user = $this->entityManager->find(User::class, User::ID_ANONYMOUS);