View .md

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()

Name: featherpanel:user:ssh_key:createdemitted at 2 sites2 payload shapesCancel or modify: nodefinition

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 keyListener parameterType
1ssh_key$sshKeynot at every sitenot declared
2created_by$createdBynot at every sitenot declared
Arguments passedEmitted 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()

Name: featherpanel:user:ssh_key:deletedemitted at 2 sites2 payload shapesCancel or modify: nodefinition

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 keyListener parameterType
1user_uuid$userUuidintfrom docblock
2ssh_key$sshKeyarrayfrom docblock
Arguments passedEmitted 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()

Name: featherpanel:user:ssh_key:errornot emittedCancel or modify: nodefinition

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()

Name: featherpanel:user:ssh_key:updatedemitted at 2 sites2 payload shapesCancel or modify: nodefinition

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 keyListener parameterType
1user_uuid$userUuidnot declared
2ssh_key$sshKeynot declared
3updated_data$updatedDatanot at every sitenot declared
Arguments passedEmitted 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');
});