mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 19:57:44 +02:00
Trigger twofaccounts withdrawal after group deletion, not during
This commit is contained in:
parent
ceb9d69478
commit
b82a7eb604
@ -6,6 +6,7 @@ use App\Models\Group;
|
|||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class GroupDeleted
|
class GroupDeleted
|
||||||
{
|
{
|
||||||
@ -24,5 +25,7 @@ class GroupDeleted
|
|||||||
public function __construct(Group $group)
|
public function __construct(Group $group)
|
||||||
{
|
{
|
||||||
$this->group = $group;
|
$this->group = $group;
|
||||||
|
|
||||||
|
Log::info(sprintf('Group %s (id #%d) deleted ', var_export($group->name, true), $group->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Events\GroupDeleting;
|
use App\Events\GroupDeleted;
|
||||||
use App\Models\TwoFAccount;
|
use App\Models\TwoFAccount;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class DissociateTwofaccountFromGroup
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle(GroupDeleting $event)
|
public function handle(GroupDeleted $event)
|
||||||
{
|
{
|
||||||
TwoFAccount::where('group_id', $event->group->id)
|
TwoFAccount::where('group_id', $event->group->id)
|
||||||
->update(
|
->update(
|
||||||
|
@ -98,9 +98,6 @@ class Group extends Model
|
|||||||
static::updated(function (object $model) {
|
static::updated(function (object $model) {
|
||||||
Log::info(sprintf('Group %s (id #%d) updated by user ID #%s', var_export($model->name, true), $model->id, $model->user_id));
|
Log::info(sprintf('Group %s (id #%d) updated by user ID #%s', var_export($model->name, true), $model->id, $model->user_id));
|
||||||
});
|
});
|
||||||
static::deleted(function (object $model) {
|
|
||||||
Log::info(sprintf('Group %s (id #%d) deleted ', var_export($model->name, true), $model->id));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Events\GroupDeleted;
|
use App\Events\GroupDeleted;
|
||||||
use App\Events\GroupDeleting;
|
|
||||||
use App\Events\ScanForNewReleaseCalled;
|
use App\Events\ScanForNewReleaseCalled;
|
||||||
use App\Events\StoreIconsInDatabaseSettingChanged;
|
use App\Events\StoreIconsInDatabaseSettingChanged;
|
||||||
use App\Events\TwoFAccountDeleted;
|
use App\Events\TwoFAccountDeleted;
|
||||||
@ -44,10 +43,8 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
TwoFAccountDeleted::class => [
|
TwoFAccountDeleted::class => [
|
||||||
CleanIconStorage::class,
|
CleanIconStorage::class,
|
||||||
],
|
],
|
||||||
GroupDeleting::class => [
|
|
||||||
DissociateTwofaccountFromGroup::class,
|
|
||||||
],
|
|
||||||
GroupDeleted::class => [
|
GroupDeleted::class => [
|
||||||
|
DissociateTwofaccountFromGroup::class,
|
||||||
ResetUsersPreference::class,
|
ResetUsersPreference::class,
|
||||||
],
|
],
|
||||||
ScanForNewReleaseCalled::class => [
|
ScanForNewReleaseCalled::class => [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user