Refactor authentication system (#2602)
Make auth configuration available via UI, remove FOSUserBundle and SAML-Bundle dependency
This commit is contained in:
34
src/Event/AbstractUserEvent.php
Normal file
34
src/Event/AbstractUserEvent.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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\Event;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Base event class to used with user manipulations.
|
||||
*/
|
||||
abstract class AbstractUserEvent extends Event
|
||||
{
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
private $user;
|
||||
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
28
src/Event/EmailEvent.php
Normal file
28
src/Event/EmailEvent.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\Event;
|
||||
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
class EmailEvent extends Event
|
||||
{
|
||||
private $email;
|
||||
|
||||
public function __construct(Email $email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
public function getEmail(): Email
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
}
|
||||
14
src/Event/EmailPasswordResetEvent.php
Normal file
14
src/Event/EmailPasswordResetEvent.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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\Event;
|
||||
|
||||
final class EmailPasswordResetEvent extends UserEmailEvent
|
||||
{
|
||||
}
|
||||
14
src/Event/EmailSelfRegistrationEvent.php
Normal file
14
src/Event/EmailSelfRegistrationEvent.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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\Event;
|
||||
|
||||
final class EmailSelfRegistrationEvent extends UserEmailEvent
|
||||
{
|
||||
}
|
||||
17
src/Event/UserCreateEvent.php
Normal file
17
src/Event/UserCreateEvent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Event;
|
||||
|
||||
/**
|
||||
* Triggered for new user instances, which might or might not be saved.
|
||||
*/
|
||||
final class UserCreateEvent extends AbstractUserEvent
|
||||
{
|
||||
}
|
||||
17
src/Event/UserCreatePostEvent.php
Normal file
17
src/Event/UserCreatePostEvent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Event;
|
||||
|
||||
/**
|
||||
* Triggered for new user instances, which were just saved.
|
||||
*/
|
||||
final class UserCreatePostEvent extends AbstractUserEvent
|
||||
{
|
||||
}
|
||||
17
src/Event/UserCreatePreEvent.php
Normal file
17
src/Event/UserCreatePreEvent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Event;
|
||||
|
||||
/**
|
||||
* Triggered for new user instances, which are just about to being saved.
|
||||
*/
|
||||
final class UserCreatePreEvent extends AbstractUserEvent
|
||||
{
|
||||
}
|
||||
29
src/Event/UserEmailEvent.php
Normal file
29
src/Event/UserEmailEvent.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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\Event;
|
||||
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\Mime\Email;
|
||||
|
||||
class UserEmailEvent extends EmailEvent
|
||||
{
|
||||
private $user;
|
||||
|
||||
public function __construct(User $user, Email $email)
|
||||
{
|
||||
parent::__construct($email);
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
}
|
||||
17
src/Event/UserInteractiveLoginEvent.php
Normal file
17
src/Event/UserInteractiveLoginEvent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Event;
|
||||
|
||||
/**
|
||||
* Triggered for programmatic logins (like password reset or registration).
|
||||
*/
|
||||
final class UserInteractiveLoginEvent extends AbstractUserEvent
|
||||
{
|
||||
}
|
||||
17
src/Event/UserUpdatePostEvent.php
Normal file
17
src/Event/UserUpdatePostEvent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Event;
|
||||
|
||||
/**
|
||||
* Triggered for user instances, which were just updated.
|
||||
*/
|
||||
final class UserUpdatePostEvent extends AbstractUserEvent
|
||||
{
|
||||
}
|
||||
17
src/Event/UserUpdatePreEvent.php
Normal file
17
src/Event/UserUpdatePreEvent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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\Event;
|
||||
|
||||
/**
|
||||
* Triggered for user instances, which are about to be updated.
|
||||
*/
|
||||
final class UserUpdatePreEvent extends AbstractUserEvent
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user