Add event action storage. Closes #2344

This commit is contained in:
James Brooks
2017-02-03 22:34:13 +00:00
parent c2790e29cc
commit 3dc154dff1
92 changed files with 1512 additions and 128 deletions

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Cachet\Models\User;
@@ -19,7 +20,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserAcceptedInviteEvent implements UserEventInterface
final class UserAcceptedInviteEvent implements ActionInterface, UserEventInterface
{
/**
* The user that accepted the invite.
@@ -58,4 +59,17 @@ final class UserAcceptedInviteEvent implements UserEventInterface
{
return 'User accepted invite.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserDisabledTwoAuthEvent implements UserEventInterface
final class UserDisabledTwoAuthEvent implements ActionInterface, UserEventInterface
{
/**
* The user that disabled two auth.
@@ -48,4 +49,17 @@ final class UserDisabledTwoAuthEvent implements UserEventInterface
{
return 'User disabled two-factor authentication.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserEnabledTwoAuthEvent implements UserEventInterface
final class UserEnabledTwoAuthEvent implements ActionInterface, UserEventInterface
{
/**
* The user that enabled two auth.
@@ -48,4 +49,17 @@ final class UserEnabledTwoAuthEvent implements UserEventInterface
{
return 'User enabled two-factor authentication.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -13,6 +13,12 @@ namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\EventInterface;
/**
* This is the user event interface.
*
* @author Graham Campbell <graham@alt-three.com>
* @author James Brooks <james@alt-three.com>
*/
interface UserEventInterface extends EventInterface
{
//

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserFailedTwoAuthEvent implements UserEventInterface
final class UserFailedTwoAuthEvent implements ActionInterface, UserEventInterface
{
/**
* The user that failed two auth.
@@ -48,4 +49,17 @@ final class UserFailedTwoAuthEvent implements UserEventInterface
{
return 'User failed two-factor authentication.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserLoggedInEvent implements UserEventInterface
final class UserLoggedInEvent implements ActionInterface, UserEventInterface
{
/**
* The user that logged in.
@@ -48,4 +49,17 @@ final class UserLoggedInEvent implements UserEventInterface
{
return 'User logged in.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserLoggedOutEvent implements UserEventInterface
final class UserLoggedOutEvent implements ActionInterface, UserEventInterface
{
/**
* The user that logged out.
@@ -48,4 +49,17 @@ final class UserLoggedOutEvent implements UserEventInterface
{
return 'User logged out.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserPassedTwoAuthEvent implements UserEventInterface
final class UserPassedTwoAuthEvent implements ActionInterface, UserEventInterface
{
/**
* The user that passed two auth.
@@ -48,4 +49,17 @@ final class UserPassedTwoAuthEvent implements UserEventInterface
{
return 'User passed two-factor authentication.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserRegeneratedApiTokenEvent implements UserEventInterface
final class UserRegeneratedApiTokenEvent implements ActionInterface, UserEventInterface
{
/**
* The user that regenerated their api token.
@@ -48,4 +49,17 @@ final class UserRegeneratedApiTokenEvent implements UserEventInterface
{
return 'User regenerated api token.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,9 +11,10 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
final class UserWasAddedEvent implements UserEventInterface
final class UserWasAddedEvent implements ActionInterface, UserEventInterface
{
/**
* The user that has been added.
@@ -43,4 +44,17 @@ final class UserWasAddedEvent implements UserEventInterface
{
return 'User was added.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,9 +11,10 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\Invite;
final class UserWasInvitedEvent implements UserEventInterface
final class UserWasInvitedEvent implements ActionInterface, UserEventInterface
{
/**
* The invite that has been added.
@@ -43,4 +44,17 @@ final class UserWasInvitedEvent implements UserEventInterface
{
return 'User was invited.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,9 +11,10 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
final class UserWasRemovedEvent implements UserEventInterface
final class UserWasRemovedEvent implements ActionInterface, UserEventInterface
{
/**
* The user that has been removed.
@@ -43,4 +44,17 @@ final class UserWasRemovedEvent implements UserEventInterface
{
return 'User was removed.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}

View File

@@ -11,6 +11,7 @@
namespace CachetHQ\Cachet\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\ActionInterface;
use CachetHQ\Cachet\Models\User;
/**
@@ -18,7 +19,7 @@ use CachetHQ\Cachet\Models\User;
*
* @author James Brooks <james@alt-three.com>
*/
final class UserWasWelcomedEvent implements UserEventInterface
final class UserWasWelcomedEvent implements ActionInterface, UserEventInterface
{
/**
* The user.
@@ -48,4 +49,17 @@ final class UserWasWelcomedEvent implements UserEventInterface
{
return 'User was welcomed.';
}
/**
* Get the event action.
*
* @return array
*/
public function getAction()
{
return [
'user' => $this->user,
'description' => (string) $this,
];
}
}