UserSshKeyEvent events
4 FeatherPanel plugin events on UserSshKeyEvent (3 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions. 1 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import UserSshKeyEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\UserSshKeyEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(UserSshKeyEvent::onUserSshKeyCreated(), function (...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:created');
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}UserSshKeyEvent::onUserSshKeyCreated()
Docblock: array ssh_key data. (the emitter passes 2 values, see the table)
Same event name as UserEvent::onUserSshKeyCreated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | ssh_key | $sshKeynot at every site | not declared |
| 2 | created_by | $createdBynot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
ssh_key, created_by | PterodactylImporterController::importSshKey |
user_uuid, ssh_key | UserSshKeyController::createUserSshKey |
When it fires (2 sites)
$event->on(UserSshKeyEvent::onUserSshKeyCreated(), function (...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:created');
});UserSshKeyEvent::onUserSshKeyDeleted()
Docblock: int ssh_key id, array ssh_key data.
Same event name as UserEvent::onUserSshKeyDeleted(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | intfrom docblock |
| 2 | ssh_key | $sshKey | arrayfrom docblock |
| Arguments passed | Emitted from |
|---|---|
user_uuid, ssh_key | UserSshKeyController::deleteUserSshKey |
user_uuid, ssh_key, action | UserSshKeyController::hardDeleteUserSshKey |
When it fires (2 sites)
$event->on(UserSshKeyEvent::onUserSshKeyDeleted(), function ($userUuid, $sshKey, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:deleted ' . json_encode(['user_uuid' => $userUuid, 'ssh_key' => $sshKey]));
});UserSshKeyEvent::onUserSshKeyError()
Docblock: string error message, array context.
$event->on(UserSshKeyEvent::onUserSshKeyError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
UserSshKeyEvent::onUserSshKeyUpdated()
Docblock: int ssh_key id, array updated data. (the emitter passes 3 values, see the table)
Same event name as UserEvent::onUserSshKeyUpdated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | ssh_key | $sshKey | not declared |
| 3 | updated_data | $updatedDatanot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
user_uuid, ssh_key, updated_data | UserSshKeyController::updateUserSshKey |
user_uuid, ssh_key, action | UserSshKeyController::restoreUserSshKey |
When it fires (2 sites)
$event->on(UserSshKeyEvent::onUserSshKeyUpdated(), function ($userUuid, $sshKey, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:ssh_key:updated');
});