mirror of
https://github.com/pterodactyl/panel.git
synced 2026-06-13 08:10:52 -05:00
This expands upon previous work done to better disconnect users from SFTP when different events occur within Pterodactyl. This new logic also accounts for password changes and their account being deleted entirely from the system. These events now trigger background jobs that will reach out to every node they are associated with to ensure they're disconnected if currently connected.
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Pterodactyl\Providers;
|
|
|
|
use Pterodactyl\Models\User;
|
|
use Pterodactyl\Models\Server;
|
|
use Pterodactyl\Models\Subuser;
|
|
use Pterodactyl\Models\EggVariable;
|
|
use Pterodactyl\Observers\UserObserver;
|
|
use Pterodactyl\Observers\ServerObserver;
|
|
use Pterodactyl\Observers\SubuserObserver;
|
|
use Pterodactyl\Listeners\TwoFactorListener;
|
|
use Pterodactyl\Listeners\RevocationListener;
|
|
use Pterodactyl\Observers\EggVariableObserver;
|
|
use Pterodactyl\Listeners\AuthenticationListener;
|
|
use Pterodactyl\Events\Server\Installed as ServerInstalledEvent;
|
|
use Pterodactyl\Notifications\ServerInstalled as ServerInstalledNotification;
|
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
|
|
|
class EventServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* The event to listener mappings for the application.
|
|
*/
|
|
protected $listen = [
|
|
ServerInstalledEvent::class => [ServerInstalledNotification::class],
|
|
];
|
|
|
|
protected $subscribe = [
|
|
AuthenticationListener::class,
|
|
RevocationListener::class,
|
|
TwoFactorListener::class,
|
|
];
|
|
|
|
protected static $shouldDiscoverEvents = false;
|
|
|
|
/**
|
|
* Register any events for your application.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
parent::boot();
|
|
|
|
User::observe(UserObserver::class);
|
|
Server::observe(ServerObserver::class);
|
|
Subuser::observe(SubuserObserver::class);
|
|
EggVariable::observe(EggVariableObserver::class);
|
|
}
|
|
}
|