develop #28

Merged
blaerf merged 83 commits from develop into main 2025-12-17 14:28:04 +00:00
4 changed files with 11 additions and 3 deletions
Showing only changes of commit 2fd2bb3630 - Show all commits

View File

@ -66,7 +66,7 @@ $cmd = sprintf(
// Execute and capture output and exit code
$output = [];
$returnVar = null;
if (!file_exists($script)) {
if (!file_exists($script)) {
$_SESSION['flash_error'] = 'PowerShell-Skript nicht gefunden: ' . $script;
@unlink($tmpFile);
header('Location: ../index.php?route=createuser');
@ -82,6 +82,9 @@ if ($exePathCheck === null) {
exec($cmd . ' 2>&1', $output, $returnVar);
$json = implode("\n", $output);
// Optional: write raw output into logs for debugging
@file_put_contents(__DIR__ . '/../logs/create_user_output.log', date('Y-m-d H:i:s') . ' CMD: ' . $cmd . "\n" . $json . "\n\n", FILE_APPEND | LOCK_EX);
@unlink($tmpFile);
// Try to parse JSON output

View File

@ -80,6 +80,9 @@ $json = implode("\n", $output);
@unlink($tmpFile);
@unlink($metaFile);
// Optional: log the CSV script command and raw output to help debugging
@file_put_contents(__DIR__ . '/../logs/create_users_csv_output.log', date('Y-m-d H:i:s') . ' CMD: ' . $cmd . "\n" . $json . "\n\n", FILE_APPEND | LOCK_EX);
$result = null;
if ($json !== '') {
$decoded = json_decode($json, true);

View File

@ -14,7 +14,8 @@ try {
}
# Default result
$result = @{ success = $false; message = "Unspecified error" }
$actor = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$result = @{ success = $false; message = "Unspecified error"; actor = $actor }
# Validate
if (-not $payload.samaccountname -or -not $payload.password) {

View File

@ -44,6 +44,7 @@ try {
exit 1
}
$actor = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
$results = @()
$successCount = 0
$failCount = 0
@ -92,6 +93,6 @@ foreach ($row in $items) {
}
}
$output = @{ success = $failCount -eq 0; message = "Created $successCount users, $failCount failures"; details = $results }
$output = @{ success = $failCount -eq 0; message = "Created $successCount users, $failCount failures"; details = $results; actor = $actor }
Write-Output ($output | ConvertTo-Json -Compress)
exit 0