GeoNetAgent, LDAPWeb, server-audit, server-connection
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

186 lines
11 KiB

@extends('layouts.app')
@section('title', 'Edit User — ' . $user['username'])
@section('content')
<div class="max-w-4xl mx-auto px-4 py-8">
<div class="mt-6 mb-6">
<a href="{{ route('ldap-users.show', $user['username']) }}" class="text-sm text-cyan-400 hover:text-cyan-300">← Back to user</a>
<h1 class="text-2xl font-bold text-white mt-2">Edit User: {{ $user['username'] }}</h1>
</div>
@include('partials.flash')
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 items-start">
<form method="POST" action="{{ route('ldap-users.update', $user['username']) }}"
class="bg-slate-900 border border-slate-800 rounded-2xl p-6 space-y-5">
@csrf
@method('PUT')
<h2 class="text-lg font-semibold text-white">Profile</h2>
<div>
<label class="block text-sm text-slate-300 mb-1">Username</label>
<input type="text" value="{{ $user['username'] }}" disabled
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-slate-400">
</div>
<div>
<label for="display_name" class="block text-sm text-slate-300 mb-1">Display Name</label>
<input type="text" name="display_name" id="display_name" required maxlength="255"
value="{{ old('display_name', $user['display_name'] === '—' ? '' : $user['display_name']) }}"
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white">
@error('display_name')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label for="email" class="block text-sm text-slate-300 mb-1">Email (LDAP)</label>
<input type="email" name="email" id="email" maxlength="255"
value="{{ old('email', $user['email'] === '—' ? '' : $user['email']) }}"
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white">
@error('email')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror
</div>
<h2 class="text-lg font-semibold text-white pt-2 border-t border-slate-800">App Metadata</h2>
<p class="text-slate-400 text-sm -mt-2">Disimpan di database aplikasi, bukan Active Directory.</p>
<div>
<label for="other_email" class="block text-sm text-slate-300 mb-1">Other Email (konfirmasi)</label>
<input type="email" name="other_email" id="other_email" maxlength="255"
value="{{ old('other_email', $user['other_email'] ?? '') }}"
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white">
@error('other_email')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label for="phone" class="block text-sm text-slate-300 mb-1">Phone Number</label>
<input type="text" name="phone" id="phone" maxlength="32"
value="{{ old('phone', $user['phone'] ?? '') }}"
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white">
@error('phone')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror
</div>
<div>
<label for="admin_note" class="block text-sm text-slate-300 mb-1">Admin Note</label>
<textarea name="admin_note" id="admin_note" rows="4" maxlength="5000"
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white">{{ old('admin_note', $user['admin_note'] ?? '') }}</textarea>
@error('admin_note')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror
</div>
<div class="flex gap-3 pt-2">
<button type="submit" class="rounded-lg bg-cyan-600 hover:bg-cyan-500 px-5 py-2 text-sm font-medium text-white">
Save Changes
</button>
<a href="{{ route('ldap-users.index') }}" class="rounded-lg border border-slate-700 px-5 py-2 text-sm text-slate-300 hover:bg-slate-800">
Cancel
</a>
</div>
</form>
<div class="space-y-6 notes-panel">
<div class="bg-slate-900 border border-slate-800 rounded-2xl overflow-hidden flex flex-col list-panel" style="max-height: 20rem;">
<div class="list-panel__toolbar p-4 border-b border-slate-800">
<h2 class="text-lg font-semibold text-white">Group Membership</h2>
<p class="text-slate-400 text-sm mt-1">{{ count($currentGroups) }} group(s)</p>
</div>
<div class="list-panel__scroll">
<table class="min-w-full text-sm list-table">
<thead class="text-slate-300">
<tr>
<th class="px-4 py-3 text-left bg-slate-800 border-b border-slate-700">Group</th>
<th class="px-4 py-3 text-left bg-slate-800 border-b border-slate-700">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-slate-800">
@forelse ($currentGroups as $group)
<tr class="hover:bg-slate-800/40">
<td class="px-4 py-3">
<a href="{{ route('ldap-groups.show', $group['route_key']) }}"
class="text-white hover:text-cyan-300">
{{ $group['name'] }}
</a>
@if ($group['protected'])
<span class="ml-2 text-xs text-slate-500">Protected</span>
@endif
</td>
<td class="px-4 py-3">
@if ($group['protected'])
<span class="text-xs text-slate-500"></span>
@else
<form method="POST"
action="{{ route('ldap-users.groups.remove', [$user['username'], $group['route_key']]) }}"
onsubmit="return confirm('Remove [{{ $user['username'] }}] from group [{{ $group['name'] }}]?');">
@csrf
@method('DELETE')
<input type="hidden" name="confirm" value="1">
<button type="submit"
class="rounded bg-red-800 hover:bg-red-700 text-white text-xs px-2 py-1">
Remove
</button>
</form>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="2" class="px-4 py-8 text-center text-slate-400">Not a member of any group.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@unless ($user['protected'])
<div class="bg-slate-900 border border-slate-800 rounded-2xl p-6">
<h2 class="text-lg font-semibold text-white mb-4">Add to Group</h2>
@if (count($availableGroups) === 0)
<p class="text-slate-400 text-sm">No available groups to add. User may already be in all writable groups.</p>
@else
<form method="POST" action="{{ route('ldap-users.groups.add', $user['username']) }}" class="space-y-4">
@csrf
<div>
<label for="group" class="block text-sm text-slate-300 mb-1">Select Group</label>
<select name="group" id="group" required
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white">
<option value="" disabled selected>Choose a group...</option>
@foreach ($availableGroups as $group)
<option value="{{ $group['route_key'] }}">
{{ $group['name'] }}
@if ($group['description'] !== '—') — {{ $group['description'] }} @endif
</option>
@endforeach
</select>
@error('group')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror
</div>
<button type="submit"
class="w-full rounded-lg bg-cyan-700 hover:bg-cyan-600 px-4 py-2 text-sm font-medium text-white">
Add to Group
</button>
</form>
@endif
</div>
@endunless
<div class="bg-slate-900 border border-slate-800 rounded-2xl p-5">
<h2 class="text-lg font-semibold text-white mb-4">Catatan</h2>
<dl class="space-y-3 text-sm text-slate-400">
<div>
<dt class="font-medium text-cyan-400 mb-1">Edit profil</dt>
<dd>Perubahan display name dan email langsung ke Active Directory.</dd>
</div>
<div>
<dt class="font-medium text-emerald-400 mb-1">Group membership</dt>
<dd>Tambah atau hapus user dari grup. Grup protected tidak dapat diubah.</dd>
</div>
<div>
<dt class="font-medium text-violet-400 mb-1">Reset password</dt>
<dd>Gunakan action Reset Password di halaman list user untuk mengganti password.</dd>
</div>
</dl>
</div>
</div>
</div>
</div>
@endsection