Co-authored-by: blaerf <blaerf@gmx.de> Reviewed-on: https://git.eckertplayground.de/taarly/PHP_AdminTool_Projekt/pulls/12
113 lines
4.2 KiB
PHP
113 lines
4.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* View-Template für die Anzeige von Benutzern und Gruppen.
|
|
*
|
|
* Aufgaben:
|
|
* - Stellt zwei Tabellen dar: eine Benutzerliste und eine Gruppenliste.
|
|
* - Nutzt Daten aus dem LdapDirectoryService (über den UserManagementController).
|
|
* - Behandelt optionale Fehlermeldungen durch Ausgabe eines Alert-Elements.
|
|
*
|
|
* Erwartete View-Daten:
|
|
* - array<int, array<string, string>> $users Liste von Benutzerobjekten (z. B. sAMAccountName, displayName, mail).
|
|
* - array<int, array<string, string>> $groups Liste von Gruppenobjekten (z. B. sAMAccountName, cn, description).
|
|
* - string|null $error Fehlermeldung bei Problemen mit dem LDAP-Zugriff.
|
|
*/
|
|
|
|
/**
|
|
* @var array<int, array<string, string>> $users
|
|
* @var array<int, array<string, string>> $groups
|
|
* @var string|null $error
|
|
*/
|
|
?>
|
|
|
|
<div class="d-sm-flex align-items-center justify-content-between mb-4">
|
|
<h1 class="h3 mb-0 text-gray-800">Benutzer & Gruppen</h1>
|
|
</div>
|
|
|
|
<?php if ($error !== null): ?>
|
|
<div class="alert alert-danger" role="alert">
|
|
<?php echo htmlspecialchars($error, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<p class="mb-4">
|
|
Die folgenden Tabellen zeigen Benutzern und Gruppen, die über LDAP/LDAPS aus dem Active Directory gelesen wurden.
|
|
</p>
|
|
|
|
<!-- Benutzer-Tabelle -->
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Benutzer</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered" id="usersTable" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th><input type="checkbox" name="selectAllUsers"></th>
|
|
<th>Anmeldename (sAMAccountName)</th>
|
|
<th>Anzeigename</th>
|
|
<th>E-Mail</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($users as $user): ?>
|
|
<tr>
|
|
<td>
|
|
<input type="checkbox" name="selectUser<?php echo htmlspecialchars($user['samaccountname'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>">
|
|
</td>
|
|
<td>
|
|
<?php echo htmlspecialchars($user['samaccountname'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</td>
|
|
<td>
|
|
<?php echo htmlspecialchars($user['displayname'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</td>
|
|
<td>
|
|
<?php echo htmlspecialchars($user['mail'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Gruppen-Tabelle -->
|
|
<div class="card shadow mb-4">
|
|
<div class="card-header py-3">
|
|
<h6 class="m-0 font-weight-bold text-primary">Gruppen</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered" id="groupsTable" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th>Gruppenname (sAMAccountName)</th>
|
|
<th>CN</th>
|
|
<th>Beschreibung</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($groups as $group): ?>
|
|
<tr>
|
|
<td>
|
|
<?php echo htmlspecialchars($group['samaccountname'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</td>
|
|
<td>
|
|
<?php echo htmlspecialchars($group['cn'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</td>
|
|
<td>
|
|
<?php echo htmlspecialchars($group['description'] ?? '', ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); ?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|