52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Admin;
|
|
|
|
use App\Models\SecurityBlock;
|
|
use LivewireUI\Modal\ModalComponent;
|
|
|
|
/**
|
|
* Bestaetigung vorm Aufheben einer Sperre in der Konsole (R23).
|
|
*
|
|
* Eine Sperre, zwei Orte — die Host-Detailseite (hosts.manage) und die
|
|
* Instanz eines Kunden auf dessen Kundenseite (instances.manage) — ein
|
|
* gemeinsames Modal, das die Berechtigung nach dem Subjekt der Sperre
|
|
* entscheidet, statt zwei fast identische Modals zu pflegen.
|
|
*
|
|
* Mutiert trotzdem nichts: HostDetail::onSecurityBlockReleaseConfirmed() bzw.
|
|
* CustomerDetail::onSecurityBlockReleaseConfirmed() pruefen beim
|
|
* tatsaechlichen Aufheben ihrerseits noch einmal, dass die Sperre zu IHREM
|
|
* Host bzw. IHRER Instanz gehoert — ein Modal ist ohne die Route-Middleware
|
|
* der Seite erreichbar (R20), die Pruefung hier ist eine Anzeige-Schranke
|
|
* (welche Adresse dieses Fenster nennen darf), keine Ersatz-Autorisierung.
|
|
*/
|
|
class ConfirmReleaseBlock extends ModalComponent
|
|
{
|
|
public string $uuid;
|
|
|
|
public string $ip = '';
|
|
|
|
public function mount(string $uuid): void
|
|
{
|
|
$block = SecurityBlock::query()->where('uuid', $uuid)->first();
|
|
|
|
abort_if($block === null, 404);
|
|
|
|
$this->authorize($block->instance_id !== null ? 'instances.manage' : 'hosts.manage');
|
|
|
|
$this->uuid = $uuid;
|
|
$this->ip = $block->ip;
|
|
}
|
|
|
|
public function confirm(): void
|
|
{
|
|
$this->dispatch('security-block-release-confirmed', uuid: $this->uuid);
|
|
$this->closeModal();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.admin.confirm-release-block');
|
|
}
|
|
}
|