updates for active directory now with docs
tests / ci (push) Canceled after 0s

This commit is contained in:
Mark Gregory
2026-11-11 17:15:37 +00:00
parent 4ebcd12565
commit 90f8655595
7 changed files with 433 additions and 0 deletions
@@ -0,0 +1,96 @@
<x-layouts::app title="Directory sync">
<div class="mx-auto flex w-full max-w-5xl flex-col gap-8">
<header class="space-y-2">
<flux:heading size="xl">Directory sync</flux:heading>
<flux:text>
@if (! $scheduled)
Schedule disabled
@elseif ($stale)
Stale · No successful sync in the last 30 minutes
@else
Scheduled every 10 minutes
@endif
</flux:text>
</header>
@if (session('sync_error'))
<p role="alert" class="rounded-lg border p-3">{{ session('sync_error') }}</p>
@endif
@if (session('sync_status'))
<p role="status" class="rounded-lg border p-3">{{ session('sync_status') }}</p>
@endif
<section class="space-y-3 rounded-xl border border-zinc-200 p-5 dark:border-zinc-700">
<flux:heading size="lg">Latest successful sync</flux:heading>
<flux:text>{{ $success?->finished_at ?? 'No successful sync recorded yet' }}</flux:text>
@if ($success)
<dl class="grid grid-cols-2 gap-4 sm:grid-cols-5">
@foreach (['created' => 'Created', 'updated' => 'Updated', 'unchanged' => 'Unchanged', 'deactivated' => 'Disabled', 'reactivated' => 'Re-enabled'] as $key => $label)
<div>
<dt class="text-sm text-zinc-500 dark:text-zinc-400">{{ $label }}</dt>
<dd class="text-2xl font-semibold">{{ $counts[$key] }}</dd>
</div>
@endforeach
</dl>
@endif
@if ($failure)
<div class="border-t border-zinc-200 pt-3 dark:border-zinc-700">
<flux:heading>Latest failure</flux:heading>
<flux:text>{{ $failure->finished_at }} · {{ $failure->failure }}</flux:text>
</div>
@endif
</section>
<section class="space-y-3 rounded-xl border border-zinc-200 p-5 dark:border-zinc-700">
<flux:heading size="lg">Review missing users</flux:heading>
<flux:text>Check which active Laravel accounts are missing from the directory. The preview expires after 10 minutes.</flux:text>
<form method="POST" action="{{ route('admin.directory-sync.preview') }}">
@csrf
<flux:button type="submit">Preview missing users</flux:button>
</form>
@if ($review)
@if ($review['users'])
<ul class="space-y-1">
@foreach ($review['users'] as $user)
<li>{{ $user['name'] }} · {{ $user['email'] }}</li>
@endforeach
</ul>
<form method="POST" action="{{ route('admin.directory-sync.apply') }}">
@csrf
<input type="hidden" name="review_token" value="{{ $review['token'] }}">
<flux:button type="submit" variant="danger">Deactivate reviewed users</flux:button>
</form>
@else
<flux:text>No missing users found.</flux:text>
@endif
@endif
</section>
<section class="space-y-3 rounded-xl border border-zinc-200 p-5 dark:border-zinc-700">
<flux:heading size="lg">Disabled directory users</flux:heading>
<div class="overflow-x-auto">
<table class="w-full text-left text-sm">
<thead>
<tr><th scope="col" class="py-2 pe-4">User</th><th scope="col" class="py-2 pe-4">Reason</th><th scope="col" class="py-2">Disabled at</th></tr>
</thead>
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-700">
@forelse ($disabledUsers as $user)
<tr>
<td class="py-2 pe-4">{{ $user->name }}<br><span class="text-zinc-500 dark:text-zinc-400">{{ $user->email }}</span></td>
<td class="py-2 pe-4">{{ match ($user->ad_disabled_reason) {
'directory_disabled' => 'Disabled in Active Directory',
'missing_from_snapshot' => 'Missing from the directory',
default => 'Reason unavailable',
} }}</td>
<td class="py-2">{{ $user->ad_disabled_at }}</td>
</tr>
@empty
<tr><td colspan="3" class="py-2">No disabled directory users.</td></tr>
@endforelse
</tbody>
</table>
</div>
{{ $disabledUsers->links() }}
</section>
</div>
</x-layouts::app>