show apikey details in modal-overlay; todo: edit allowed_from and valid_until

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-04-09 13:32:08 +02:00
parent 9272c15706
commit 7f0eb97f9b
11 changed files with 143 additions and 44 deletions

View File

@@ -4,6 +4,7 @@ namespace Froxlor\UI\Callbacks;
use Froxlor\PhpHelper;
use Froxlor\UI\Panel\UI;
use Froxlor\Froxlor;
use Froxlor\User;
/**
@@ -65,4 +66,22 @@ class Text
{
return wordwrap($attributes['data'], 100, '<br>', true);
}
public static function apikeyDetailModal(array $attributes): array
{
$linker = UI::getLinker();
$result = $attributes['fields'];
$apikey_data = include Froxlor::getInstallDir() . '/lib/formfields/formfield.api_key.php';
$body = UI::twig()->render(UI::getTheme().'/user/inline-form.html.twig', [
'formaction' => $linker->getLink(array('section' => 'index', 'page' => 'apikeys')),
'formdata' => $apikey_data['apikey'],
'editid' => $attributes['fields']['id']
]);
return [
'id' => 'akModal' . $attributes['fields']['id'],
'title' => 'API-key ' . ($attributes['fields']['loginname'] ?? $attributes['fields']['adminname']),
'body' => $body
];
}
}