Add usernames and sudo_usernames fields to VM request form

- DB: add usernames/sudo_usernames columns to vm_requests table
- create.php: add form inputs for usernames and sudo_usernames
- send.php: capture, validate, and store both fields in DB
- netbox_integration/netbox_api.php: pass custom_fields to NetBox VM API
- requests.php: show usernames/sudo_usernames in request list
This commit is contained in:
alex
2026-05-09 23:57:36 +02:00
parent d629689473
commit 8c069ee82a
5 changed files with 59 additions and 3 deletions

View File

@@ -119,6 +119,18 @@ class NetBoxClient {
'description' => $params['description'] ?? '',
];
// Custom fields: usernames and sudo_usernames
$cf = [];
if (!empty($params['usernames'])) {
$cf['usernames'] = $params['usernames'];
}
if (!empty($params['sudo_usernames'])) {
$cf['sudo_usernames'] = $params['sudo_usernames'];
}
if (!empty($cf)) {
$payload['custom_fields'] = $cf;
}
// Tag lookup for domain — tags must be numeric IDs in the NetBox API
if (!empty($params['domain'])) {
$tag = $this->findTag($params['domain']);