mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-17 00:01:32 +02:00
Allow to disable a user in admin settings.
When a user is disabled, he can not login.
This commit is contained in:
parent
dd1dc54d97
commit
2187f5eac2
7 changed files with 216 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue