- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks - Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists - Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services - Add Microsoft OIDC SSO, API token management, and user lifecycle features - Add swagger-ui vendor integration and OpenAPI spec - Add production Docker setup and bin/ scripts - Update composer dependencies, config, templates, and frontend assets throughout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
218 lines
7.8 KiB
PHTML
218 lines
7.8 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var array $auditLog
|
|
* @var ?array $snapshot
|
|
*/
|
|
|
|
use MintyPHP\Session;
|
|
|
|
$auditLog = $auditLog ?? [];
|
|
$snapshot = is_array($snapshot ?? null) ? $snapshot : null;
|
|
$status = strtolower(trim((string) ($auditLog['status'] ?? '')));
|
|
$statusVariant = 'neutral';
|
|
if ($status === 'success') {
|
|
$statusVariant = 'success';
|
|
} elseif ($status === 'failed') {
|
|
$statusVariant = 'danger';
|
|
} elseif ($status === 'skipped') {
|
|
$statusVariant = 'warning';
|
|
}
|
|
|
|
$action = strtolower(trim((string) ($auditLog['action'] ?? '')));
|
|
$triggerType = strtolower(trim((string) ($auditLog['trigger_type'] ?? '')));
|
|
$canRestore = can('users.lifecycle_restore');
|
|
$isRestorable = $canRestore
|
|
&& $action === 'delete'
|
|
&& $status === 'success'
|
|
&& empty($auditLog['restored_at'])
|
|
&& !empty($auditLog['snapshot_enc']);
|
|
?>
|
|
|
|
<div class="app-details-container">
|
|
<section>
|
|
<?php
|
|
$breadcrumbs = [
|
|
['label' => t('Home'), 'path' => 'admin'],
|
|
['label' => t('User lifecycle logs'), 'path' => 'admin/user-lifecycle-audit'],
|
|
['label' => t('View')],
|
|
];
|
|
require templatePath('partials/app-breadcrumb.phtml');
|
|
|
|
$titlebar = [
|
|
'title' => t('View user lifecycle audit entry'),
|
|
'backHref' => 'admin/user-lifecycle-audit',
|
|
'backTitle' => t('Back'),
|
|
];
|
|
require templatePath('partials/app-details-titlebar.phtml');
|
|
?>
|
|
|
|
<div class="app-details-content">
|
|
<details open>
|
|
<summary><?php e(t('Lifecycle event')); ?></summary>
|
|
<hr>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Created')); ?></small>
|
|
<p><?php e(dt((string) ($auditLog['created_at'] ?? '')) ?: '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Status')); ?></small>
|
|
<p><span class="badge" data-variant="<?php e($statusVariant); ?>"><?php e(t(ucfirst($status ?: 'unknown'))); ?></span></p>
|
|
</div>
|
|
</div>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Action')); ?></small>
|
|
<p><?php e($action !== '' ? t(ucfirst($action)) : '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Trigger')); ?></small>
|
|
<p><?php e($triggerType !== '' ? t(ucfirst($triggerType)) : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Reason code')); ?></small>
|
|
<p><?php e((string) ($auditLog['reason_code'] ?? '') !== '' ? (string) $auditLog['reason_code'] : '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Run UUID')); ?></small>
|
|
<p><?php e((string) ($auditLog['run_uuid'] ?? '') !== '' ? (string) $auditLog['run_uuid'] : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<hr>
|
|
<details open>
|
|
<summary><?php e(t('Target')); ?></summary>
|
|
<hr>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Target UUID')); ?></small>
|
|
<p><?php e((string) ($auditLog['target_user_uuid'] ?? '') !== '' ? (string) $auditLog['target_user_uuid'] : '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Target email')); ?></small>
|
|
<p><?php e((string) ($auditLog['target_user_email'] ?? '') !== '' ? (string) $auditLog['target_user_email'] : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<hr>
|
|
<details>
|
|
<summary><?php e(t('Policy')); ?></summary>
|
|
<hr>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Deactivate users after inactivity (days)')); ?></small>
|
|
<p><?php e((string) ((int) ($auditLog['policy_deactivate_days'] ?? 0))); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Delete inactive users after (days)')); ?></small>
|
|
<p><?php e((string) ((int) ($auditLog['policy_delete_days'] ?? 0))); ?></p>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
|
|
<?php if ($snapshot !== null): ?>
|
|
<hr>
|
|
<details>
|
|
<summary><?php e(t('Snapshot summary')); ?></summary>
|
|
<hr>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('First name')); ?></small>
|
|
<p><?php e((string) ($snapshot['first_name'] ?? '') !== '' ? (string) $snapshot['first_name'] : '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Last name')); ?></small>
|
|
<p><?php e((string) ($snapshot['last_name'] ?? '') !== '' ? (string) $snapshot['last_name'] : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Email')); ?></small>
|
|
<p><?php e((string) ($snapshot['email'] ?? '') !== '' ? (string) $snapshot['email'] : '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Locale')); ?></small>
|
|
<p><?php e((string) ($snapshot['locale'] ?? '') !== '' ? (string) $snapshot['locale'] : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Theme')); ?></small>
|
|
<p><?php e((string) ($snapshot['theme'] ?? '') !== '' ? (string) $snapshot['theme'] : '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Snapshot version')); ?></small>
|
|
<p><?php e((string) ((int) ($auditLog['snapshot_version'] ?? 1))); ?></p>
|
|
</div>
|
|
</div>
|
|
</details>
|
|
<?php endif; ?>
|
|
|
|
<hr>
|
|
<details open>
|
|
<summary><?php e(t('Restore status')); ?></summary>
|
|
<hr>
|
|
<div class="grid">
|
|
<div>
|
|
<small><?php e(t('Restored at')); ?></small>
|
|
<p><?php e(dt((string) ($auditLog['restored_at'] ?? '')) ?: '-'); ?></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Restored by')); ?></small>
|
|
<p><?php e((string) ($auditLog['restored_by_user_display_name'] ?? '') !== '' ? (string) $auditLog['restored_by_user_display_name'] : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Restored user')); ?></small>
|
|
<p>
|
|
<?php if (!empty($auditLog['restored_user_uuid'])): ?>
|
|
<a href="admin/users/edit/<?php e((string) $auditLog['restored_user_uuid']); ?>">
|
|
<?php e((string) ($auditLog['restored_user_display_name'] ?? $auditLog['restored_user_uuid'])); ?>
|
|
</a>
|
|
<?php else: ?>
|
|
-
|
|
<?php endif; ?>
|
|
</p>
|
|
</div>
|
|
<?php if ($isRestorable): ?>
|
|
<hr>
|
|
<form method="post" action="admin/user-lifecycle-audit/restore/<?php e((string) ($auditLog['id'] ?? 0)); ?>">
|
|
<?php Session::getCsrfInput(); ?>
|
|
<button type="submit" class="warning" onclick="return confirm('<?php e(t('Restore this user from lifecycle snapshot?')); ?>');">
|
|
<?php e(t('Restore user')); ?>
|
|
</button>
|
|
</form>
|
|
<?php endif; ?>
|
|
</details>
|
|
</div>
|
|
</section>
|
|
|
|
<aside id="app-details-aside-section">
|
|
<div class="app-details-aside-section">
|
|
<hgroup>
|
|
<strong><?php e(t('User lifecycle logs')); ?></strong>
|
|
<p><small><?php e((string) ($auditLog['run_uuid'] ?? '') !== '' ? (string) $auditLog['run_uuid'] : '-'); ?></small></p>
|
|
</hgroup>
|
|
<hr>
|
|
<div>
|
|
<small><?php e(t('ID')); ?></small>
|
|
<p><span class="badge" data-variant="neutral"><?php e((string) ($auditLog['id'] ?? '-')); ?></span></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Status')); ?></small>
|
|
<p><span class="badge" data-variant="<?php e($statusVariant); ?>"><?php e(t(ucfirst($status ?: 'unknown'))); ?></span></p>
|
|
</div>
|
|
<div>
|
|
<small><?php e(t('Action')); ?></small>
|
|
<p><?php e($action !== '' ? t(ucfirst($action)) : '-'); ?></p>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
</div>
|
|
|