forked from fa/breadcrumb-the-shire
Cleans up two leftover redundancies after the Phase-1 cockpit
foundation landed in cc2cf3a:
* The audit-list panel embedded inside the settings page rendered
its own "User lifecycle logs" titlebar — a redundant heading
below the page-level titlebar that already says exactly that.
The embedded panel now renders the filter toolbar + grid
directly. Page-level title carries the context.
* The Run-Now action existed twice — inline in a <details>-card
inside the form and again in the aside Quick-Actions list. The
inline version is gone; aside is the single discoverable home
for policy-level danger actions, consistent with how Phase 1
introduced Purge logs there too.
* The orphan $lastRunSummary string in the action and view stays
removed accordingly. KPI tile "Last run" still carries the
relative-time + status hint, so no information is lost — just
surfaced once instead of twice.
Three architecture-test lists updated to match the panel's new
shape, each with an inline comment so future readers see why the
panel is intentionally absent:
* DetailActionPolicyContractFiles.migratedConfirmFiles drops the
user-lifecycle settings view (its danger action delegates to the
aside-actions partial, already in this list).
* ListUiSharedPartialsContractTest.purgeTitlebarTemplateFiles drops
the panel (no titlebar of its own anymore).
* ListTitlebarContractFiles.titlebarTemplateFiles drops the panel
for the same reason.
All six quality gates green; behaviour-identical to a user with the
required permission (purge + run-now both still available, just
sourced from the aside).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
105 lines
4.0 KiB
PHTML
105 lines
4.0 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var array $values
|
|
* @var array $settings
|
|
* @var bool $canUpdateSettings
|
|
* @var array<int, array<string, mixed>> $kpiTiles
|
|
* @var array<int, array<string, mixed>> $asideActions
|
|
*/
|
|
|
|
use MintyPHP\Session;
|
|
|
|
$values = $values ?? [];
|
|
$settings = $settings ?? [];
|
|
$userInactivityDeactivateDays = (int) ($values['user_inactivity_deactivate_days'] ?? 180);
|
|
$userInactivityDeleteDays = (int) ($values['user_inactivity_delete_days'] ?? 365);
|
|
$userInactivityDeactivateDaysDesc = $settings['user_inactivity_deactivate_days']['description'] ?? 'setting.user_inactivity_deactivate_days';
|
|
$userInactivityDeleteDaysDesc = $settings['user_inactivity_delete_days']['description'] ?? 'setting.user_inactivity_delete_days';
|
|
$canUpdateSettings = (bool) ($canUpdateSettings ?? false);
|
|
$isReadOnly = !$canUpdateSettings;
|
|
$readonlyAttr = $isReadOnly ? 'readonly' : '';
|
|
$kpiTiles = is_array($kpiTiles ?? null) ? $kpiTiles : [];
|
|
$asideActions = is_array($asideActions ?? null) ? $asideActions : [];
|
|
$layoutAuth = is_array($viewAuth['layout'] ?? null) ? $viewAuth['layout'] : [];
|
|
$layoutNav = is_array($layoutNav ?? null) ? $layoutNav : [];
|
|
$moduleSlots = is_array($layoutNav['moduleSlots'] ?? null) ? $layoutNav['moduleSlots'] : [];
|
|
$moduleLifecyclePanelSlots = is_array($moduleSlots['settings.user_lifecycle.panel'] ?? null)
|
|
? $moduleSlots['settings.user_lifecycle.panel']
|
|
: [];
|
|
?>
|
|
|
|
<div class="app-details-container">
|
|
<section>
|
|
<?php
|
|
$titlebar = [
|
|
'title' => t('User lifecycle settings'),
|
|
'backHref' => 'admin/settings',
|
|
'backTitle' => t('Cancel'),
|
|
'actions' => $canUpdateSettings ? [
|
|
[
|
|
'form' => 'settings-user-lifecycle-form',
|
|
'name' => 'action',
|
|
'value' => 'save',
|
|
'class' => 'secondary outline',
|
|
'label' => t('Save'),
|
|
],
|
|
[
|
|
'form' => 'settings-user-lifecycle-form',
|
|
'name' => 'action',
|
|
'value' => 'save_close',
|
|
'class' => 'primary',
|
|
'label' => t('Save & close'),
|
|
],
|
|
] : [],
|
|
];
|
|
require templatePath('partials/app-details-titlebar.phtml');
|
|
?>
|
|
|
|
<?php require templatePath('partials/app-kpi-row.phtml'); ?>
|
|
|
|
<form id="settings-user-lifecycle-form" method="post" data-details-storage="settings-user-lifecycle-details-v1" data-standard-detail-form="1">
|
|
<div class="grid">
|
|
<label class="app-field">
|
|
<span><?php e(t('Deactivate users after inactivity (days)')); ?></span>
|
|
<input type="number" name="user_inactivity_deactivate_days"
|
|
value="<?php e((string) $userInactivityDeactivateDays); ?>" min="0" max="3650" step="1"
|
|
<?php e($readonlyAttr); ?>>
|
|
<small><?php e(t($userInactivityDeactivateDaysDesc)); ?> — <?php e(t('0 disables this rule')); ?></small>
|
|
</label>
|
|
<label class="app-field">
|
|
<span><?php e(t('Delete inactive users after (days)')); ?></span>
|
|
<input type="number" name="user_inactivity_delete_days"
|
|
value="<?php e((string) $userInactivityDeleteDays); ?>" min="0" max="3650" step="1"
|
|
<?php e($readonlyAttr); ?>>
|
|
<small><?php e(t($userInactivityDeleteDaysDesc)); ?> — <?php e(t('0 disables this rule')); ?></small>
|
|
</label>
|
|
</div>
|
|
|
|
<?php Session::getCsrfInput(); ?>
|
|
</form>
|
|
|
|
<?php foreach ($moduleLifecyclePanelSlots as $slot): ?>
|
|
<?php
|
|
if (!is_array($slot)) {
|
|
continue;
|
|
}
|
|
$slotPermission = trim((string) ($slot['permission'] ?? ''));
|
|
if ($slotPermission !== '' && empty($layoutAuth[$slotPermission])) {
|
|
continue;
|
|
}
|
|
$slotTemplate = trim((string) ($slot['template'] ?? ''));
|
|
if ($slotTemplate === '' || !is_file($slotTemplate)) {
|
|
continue;
|
|
}
|
|
include $slotTemplate;
|
|
?>
|
|
<?php endforeach; ?>
|
|
</section>
|
|
<aside id="app-details-aside-section">
|
|
<div class="app-details-aside-section">
|
|
<?php require templatePath('partials/app-details-aside-actions.phtml'); ?>
|
|
</div>
|
|
</aside>
|
|
</div>
|