* updated to Symfony 4.1 #149 * updated to phpunit 7 #149 * downgrade ocramius/proxy-manager for PHP 7.1 compatibility #149 * fixed symfony deprecations #149 * replaced AdvancedUserInterface with custom user checker * code sniffer fixes
This commit is contained in:
37
src/Security/UserChecker.php
Normal file
37
src/Security/UserChecker.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Security;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Security\Core\Exception\LockedException;
|
||||
use Symfony\Component\Security\Core\User\UserCheckerInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
* Advanced checks during aithentication to make sure the user is allowed to use Kimai.
|
||||
*/
|
||||
class UserChecker implements UserCheckerInterface
|
||||
{
|
||||
public function checkPreAuth(UserInterface $user)
|
||||
{
|
||||
}
|
||||
|
||||
public function checkPostAuth(UserInterface $user)
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
return;
|
||||
}
|
||||
|
||||
// user account is not enabled, the user may be notified
|
||||
if (!$user->isEnabled()) {
|
||||
throw new LockedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user