feat: add CSS styling
This commit is contained in:
269
assets/css/style.css
Normal file
269
assets/css/style.css
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
/* Reset et styles de base */
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Menu Lists specific padding */
|
||||||
|
.menu-content ul {
|
||||||
|
padding-left: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-content ul ul {
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Content containers */
|
||||||
|
.menu-content,
|
||||||
|
.profile-content {
|
||||||
|
margin: 20px;
|
||||||
|
padding: 15px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-form {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-button {
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-button:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-buttons {
|
||||||
|
text-align: center;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin: 0 15px;
|
||||||
|
border-radius: 4px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: white;
|
||||||
|
min-width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit {
|
||||||
|
background-color: #3498db;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-edit:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-delete {
|
||||||
|
background-color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-delete:hover {
|
||||||
|
background-color: #c0392b;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* En-têtes */
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3 {
|
||||||
|
color: #2c3e50;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 2em;
|
||||||
|
margin: 20px
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tableaux */
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 15px 0;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
padding: 12px;
|
||||||
|
text-align: left;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Formulaires */
|
||||||
|
form {
|
||||||
|
background: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
max-width: 500px;
|
||||||
|
margin: 20px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
margin: 10px 0 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="text"],
|
||||||
|
input[type="password"],
|
||||||
|
input[type="email"],
|
||||||
|
select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"],
|
||||||
|
button {
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"]:hover,
|
||||||
|
button:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Liens */
|
||||||
|
a {
|
||||||
|
color: #3498db;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Menu Lists */
|
||||||
|
.menu ul {
|
||||||
|
list-style: none;
|
||||||
|
padding-left: 20px;
|
||||||
|
margin: 15px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu li {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding: 10px;
|
||||||
|
background: rgba(255, 255, 255, 0.8);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu ul ul {
|
||||||
|
margin-left: 20px;
|
||||||
|
border-left: 3px solid #3498db;
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu ul ul li {
|
||||||
|
margin: 8px 0;
|
||||||
|
padding: 5px 10px;
|
||||||
|
background: rgba(255, 255, 255, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ou-list {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ou-section {
|
||||||
|
padding: 15px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ou-section h4 {
|
||||||
|
color: #2c3e50;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ou-section a {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 5px 10px;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Messages */
|
||||||
|
.error {
|
||||||
|
color: #e74c3c;
|
||||||
|
padding: 10px;
|
||||||
|
background: #fde;
|
||||||
|
border-left: 4px solid #e74c3c;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success {
|
||||||
|
color: #27ae60;
|
||||||
|
padding: 10px;
|
||||||
|
background: #dfd;
|
||||||
|
border-left: 4px solid #27ae60;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bouton de déconnexion */
|
||||||
|
.logout-form {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-button {
|
||||||
|
background-color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logout-button:hover {
|
||||||
|
background-color: #c0392b;
|
||||||
|
}
|
||||||
@@ -366,7 +366,7 @@ class LDAPAuth
|
|||||||
$this->bindServiceAccount();
|
$this->bindServiceAccount();
|
||||||
|
|
||||||
$filter = "(objectClass=user)";
|
$filter = "(objectClass=user)";
|
||||||
$attributes = ["givenName", "sn", "mail", "sAMAccountName"];
|
$attributes = ["Name", "sn", "givenName","mail", "sAMAccountName"];
|
||||||
$result = ldap_read($this->ad, $dn, $filter, $attributes);
|
$result = ldap_read($this->ad, $dn, $filter, $attributes);
|
||||||
$entries = ldap_get_entries($this->ad, $result);
|
$entries = ldap_get_entries($this->ad, $result);
|
||||||
|
|
||||||
|
|||||||
31
test.php
31
test.php
@@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
$ldap_server = 'ldap://intranet.epul3a.local';
|
|
||||||
$service_dn = "CN=Service LDAP Reader,CN=Users,DC=epul3a,DC=local";
|
|
||||||
|
|
||||||
|
|
||||||
$service_pwd = "Test@123";
|
|
||||||
|
|
||||||
$ldapconn = ldap_connect($ldap_server);
|
|
||||||
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
|
|
||||||
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
|
|
||||||
|
|
||||||
if (@ldap_bind($ldapconn, $service_dn, $service_pwd)) {
|
|
||||||
echo "✅ Connexion réussie avec svc_ldap_read !";
|
|
||||||
} else {
|
|
||||||
echo "❌ Erreur de connexion : " . ldap_error($ldapconn);
|
|
||||||
}
|
|
||||||
|
|
||||||
ldap_close($ldapconn);
|
|
||||||
|
|
||||||
// === TEST ===
|
|
||||||
require_once __DIR__ . '/models/LDAPAuth.php';
|
|
||||||
$ldap = new LDAPAuth();
|
|
||||||
$result = $ldap->authenticate("a.gathor", "Test@123");
|
|
||||||
|
|
||||||
if ($result['success']) {
|
|
||||||
echo "✅ Authentification réussie pour " . $result['dn'];
|
|
||||||
} else {
|
|
||||||
echo "❌ " . $result['message'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$ldap->close();
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Authentification</title>
|
<title>Authentification</title>
|
||||||
|
<link rel="stylesheet" href="assets/css/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) {
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Créer un utilisateur</title>
|
<title>Créer un utilisateur</title>
|
||||||
|
<link rel="stylesheet" href="../assets/css/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ $user_dn = urldecode($_GET['dn']);
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Supprimer un utilisateur</title>
|
<title>Supprimer un utilisateur</title>
|
||||||
|
<link rel="stylesheet" href="../assets/css/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ $user_details = $ldapAuth->getUserDetailsByDn($user_dn);
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Modifier un utilisateur</title>
|
<title>Modifier un utilisateur</title>
|
||||||
|
<link rel="stylesheet" href="../assets/css/style.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -26,10 +27,13 @@ $user_details = $ldapAuth->getUserDetailsByDn($user_dn);
|
|||||||
<form action="../controllers/edit_user.php" method="post">
|
<form action="../controllers/edit_user.php" method="post">
|
||||||
<input type="hidden" name="dn" value="<?= htmlspecialchars($user_dn) ?>">
|
<input type="hidden" name="dn" value="<?= htmlspecialchars($user_dn) ?>">
|
||||||
|
|
||||||
<input type="text" id="firstname" name="firstname" value="<?= htmlspecialchars($user_details['givenName'] ?? '') ?>">
|
<label for="lastname">Nom :</label>
|
||||||
|
|
||||||
<input type="text" id="lastname" name="lastname" value="<?= htmlspecialchars($user_details['sn'] ?? '') ?>">
|
<input type="text" id="lastname" name="lastname" value="<?= htmlspecialchars($user_details['sn'] ?? '') ?>">
|
||||||
|
|
||||||
|
<label for="firstname">Prénom :</label>
|
||||||
|
<input type="text" id="firstname" name="firstname" value="<?= htmlspecialchars($user_details['givenname'] ?? '') ?>">
|
||||||
|
|
||||||
|
<label for="email">E-mail :</label>
|
||||||
<input type="email" id="email" name="email" value="<?= htmlspecialchars($user_details['mail'] ?? '') ?>">
|
<input type="email" id="email" name="email" value="<?= htmlspecialchars($user_details['mail'] ?? '') ?>">
|
||||||
|
|
||||||
<label for="new_password">Nouveau mot de passe :</label>
|
<label for="new_password">Nouveau mot de passe :</label>
|
||||||
|
|||||||
@@ -1,25 +1,35 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
session_start();
|
<html lang="fr">
|
||||||
require_once __DIR__ . '/../controllers/controllerAdmin.php';
|
|
||||||
|
|
||||||
if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) {
|
<head>
|
||||||
header('Location: ../auth.php');
|
<meta charset="UTF-8">
|
||||||
exit;
|
<title>Liste des utilisateurs</title>
|
||||||
}
|
<link rel="stylesheet" href="../assets/css/style.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
// Récupérer les utilisateurs selon l'OU
|
<body>
|
||||||
$users = listUsers();
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/../controllers/controllerAdmin.php';
|
||||||
|
|
||||||
// Afficher le tableau des utilisateurs
|
if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) {
|
||||||
echo "<h1>Gestion des utilisateurs</h1>";
|
header('Location: ../auth.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['ou'])) {
|
// Récupérer les utilisateurs selon l'OU
|
||||||
echo "<h2>OU : " . htmlspecialchars(urldecode($_GET['ou'])) . "</h2>";
|
$users = listUsers();
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($users)) {
|
// Afficher le tableau des utilisateurs
|
||||||
echo "<table border='1'>";
|
echo "<h1>Gestion des utilisateurs</h1>";
|
||||||
echo "<tr>
|
|
||||||
|
if (isset($_GET['ou'])) {
|
||||||
|
echo "<h2>OU : " . htmlspecialchars(urldecode($_GET['ou'])) . "</h2>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($users)) {
|
||||||
|
echo "<table border='1'>";
|
||||||
|
echo "<tr>
|
||||||
<th>Nom</th>
|
<th>Nom</th>
|
||||||
<th>Prénom</th>
|
<th>Prénom</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
@@ -27,23 +37,23 @@ if (!empty($users)) {
|
|||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
foreach ($users as $entry) {
|
foreach ($users as $entry) {
|
||||||
if (!is_array($entry)) continue;
|
if (!is_array($entry)) continue;
|
||||||
|
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>" . ($entry['sn'][0] ?? '') . "</td>
|
<td>" . ($entry['sn'][0] ?? '') . "</td>
|
||||||
<td>" . ($entry['givenname'][0] ?? '') . "</td>
|
<td>" . ($entry['givenname'][0] ?? '') . "</td>
|
||||||
<td>" . ($entry['mail'][0] ?? '') . "</td>
|
<td>" . ($entry['mail'][0] ?? '') . "</td>
|
||||||
<td>" . ($entry['distinguishedname'][0] ?? '') . "</td>
|
<td>" . ($entry['distinguishedname'][0] ?? '') . "</td>
|
||||||
<td>
|
<td class='action-buttons'>
|
||||||
<a href='../views/edit_user.php?dn=" . urlencode($entry['distinguishedname'][0]) . "'>Modifier</a>
|
<a href='../views/edit_user.php?dn=" . urlencode($entry['distinguishedname'][0]) . "' class='btn btn-edit'>Modifier</a>
|
||||||
<a href='../controllers/delete_user.php?dn=" . urlencode($entry['distinguishedname'][0]) . "' onclick='return confirm(\"Confirmer la suppression ?\")'>Supprimer</a>
|
<a href='../controllers/delete_user.php?dn=" . urlencode($entry['distinguishedname'][0]) . "' class='btn btn-delete' onclick='return confirm(\"Confirmer la suppression ?\")'>Supprimer</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
} else {
|
||||||
|
echo "<p>Aucun utilisateur trouvé dans cette OU.</p>";
|
||||||
}
|
}
|
||||||
echo "</table>";
|
|
||||||
} else {
|
|
||||||
echo "<p>Aucun utilisateur trouvé dans cette OU.</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<p><a href='../views/menu.php'>Retour au menu</a></p>";
|
echo "<p><a href='../views/menu.php'>Retour au menu</a></p>";
|
||||||
|
|||||||
140
views/menu.php
140
views/menu.php
@@ -1,82 +1,98 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
if (session_status() == PHP_SESSION_NONE) {
|
<html lang="fr">
|
||||||
session_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($_SESSION["login"]) || $_SESSION["login"] !== true) {
|
<head>
|
||||||
header('Location: ../auth.php');
|
<meta charset="UTF-8">
|
||||||
exit;
|
<title>Menu</title>
|
||||||
}
|
<link rel="stylesheet" href="../assets/css/style.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
require_once __DIR__ . '/../controllers/controllerAdmin.php';
|
<body>
|
||||||
|
|
||||||
echo "Bienvenue " . $_SESSION["sAMAccountName"] . "!";
|
<?php
|
||||||
|
if (session_status() == PHP_SESSION_NONE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
// Affichage du menu
|
if (!isset($_SESSION["login"]) || $_SESSION["login"] !== true) {
|
||||||
echo "<h2>Menu</h2>";
|
header('Location: ../auth.php');
|
||||||
echo "<ul>";
|
exit;
|
||||||
if ($_SESSION["is_admin"]) {
|
}
|
||||||
echo "Vous êtes un administrateur.<br>";
|
|
||||||
echo "Vous avez des droits sur les OUs suivantes :";
|
require_once __DIR__ . '/../controllers/controllerAdmin.php';
|
||||||
echo "<ul>";
|
|
||||||
foreach ($_SESSION['admin_ous'] as $ou) {
|
echo "Bienvenue " . $_SESSION["sAMAccountName"] . " !";
|
||||||
echo "<li>$ou</li>";
|
|
||||||
|
|
||||||
|
if ($_SESSION["is_admin"]) {
|
||||||
|
// Affichage du menu
|
||||||
|
echo "<h2>Menu</h2>";
|
||||||
|
echo "<div class='menu-content'>";
|
||||||
|
echo "<ul>";
|
||||||
|
echo "Vous êtes un administrateur.<br>";
|
||||||
|
echo "Vous avez des droits sur les OUs suivantes :";
|
||||||
|
echo "<ul>";
|
||||||
|
foreach ($_SESSION['admin_ous'] as $ou) {
|
||||||
|
echo "<li>$ou</li>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
|
||||||
|
// Modifier la section d'affichage des OUs
|
||||||
|
foreach ($_SESSION['admin_ous'] as $ou) {
|
||||||
|
preg_match('/[^=]*=([^,]*)/', $ou, $matches);
|
||||||
|
$shortName = $matches[1] ?? $ou;
|
||||||
|
|
||||||
|
echo "<h3>Gestion de $ou</h3>";
|
||||||
|
echo "<a href='../views/list_users.php?ou=" . urlencode($ou) . "'>Voir les utilisateurs dans l'OU " . $shortName . "</a><br>";
|
||||||
|
echo "<a href='../views/create_user.php?ou=" . urlencode($ou) . "'>Ajouter un utilisateur dans l'OU " . $shortName . "</a><br><br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<a href='../views/list_users.php'>Liste complète des utilisateurs des OUs administrées</a><br>";
|
||||||
}
|
}
|
||||||
echo "</ul>";
|
echo "</ul>";
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
// Modifier la section d'affichage des OUs
|
echo "<h2>Profil</h2>";
|
||||||
foreach ($_SESSION['admin_ous'] as $ou) {
|
echo "<div class='profile-content'>";
|
||||||
preg_match('/[^=]*=([^,]*)/', $ou, $matches);
|
|
||||||
$shortName = $matches[1] ?? $ou;
|
|
||||||
|
|
||||||
echo "<h3>Gestion de $ou</h3>";
|
$ldapAuth = new LDAPAuth();
|
||||||
echo "<a href='../views/list_users.php?ou=" . urlencode($ou) . "'>Voir les utilisateurs dans l'OU " . $shortName . "</a><br>";
|
$user_dn = $ldapAuth->getUserDN($_SESSION['sAMAccountName']);
|
||||||
echo "<a href='../views/create_user.php?ou=" . urlencode($ou) . "'>Ajouter un utilisateur dans l'OU " . $shortName . "</a><br><br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<a href='../views/list_users.php'>Liste complète des utilisateurs des OUs administrées</a><br>";
|
echo "<h3>Groupes de l'utilisateur</h3>";
|
||||||
}
|
$userGroups = $ldapAuth->getUserGroups($user_dn);
|
||||||
echo "</ul>";
|
|
||||||
|
|
||||||
echo "<h2>Profil</h2>";
|
if (!empty($userGroups) && isset($userGroups['count']) && $userGroups['count'] > 0) {
|
||||||
|
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>
|
||||||
$ldapAuth = new LDAPAuth();
|
|
||||||
$user_dn = $ldapAuth->getUserDN($_SESSION['sAMAccountName']);
|
|
||||||
|
|
||||||
echo "<h3>Groupes de l'utilisateur</h3>";
|
|
||||||
$userGroups = $ldapAuth->getUserGroups($user_dn);
|
|
||||||
|
|
||||||
if (!empty($userGroups) && isset($userGroups['count']) && $userGroups['count'] > 0) {
|
|
||||||
echo "<table border='1' style='border-collapse: collapse; margin: 10px 0;'>
|
|
||||||
<tr >
|
<tr >
|
||||||
<th>Groupe</th>
|
<th>Groupe</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
// Skip the 'count' element and iterate through numeric indices
|
// Skip the 'count' element and iterate through numeric indices
|
||||||
for ($i = 0; $i < $userGroups['count']; $i++) {
|
for ($i = 0; $i < $userGroups['count']; $i++) {
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>" . htmlspecialchars($userGroups[$i]) . "</td>
|
<td>" . htmlspecialchars($userGroups[$i]) . "</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
} else {
|
||||||
|
echo "<p>Aucun groupe trouvé pour cet utilisateur.</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajouter cette section après l'affichage des groupes
|
||||||
|
$user_details = $ldapAuth->getUserDetails($_SESSION['sAMAccountName']);
|
||||||
|
echo "<h3>Vos informations de compte :</h3>";
|
||||||
|
echo "<table border='1'>";
|
||||||
|
echo "<tr><th>Attribut</th><th>Valeur</th></tr>";
|
||||||
|
foreach ($user_details as $key => $value) {
|
||||||
|
if (!is_array($value) && $key !== 'count') {
|
||||||
|
echo "<tr><td>$key</td><td>$value</td></tr>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
} else {
|
echo "</div>";
|
||||||
echo "<p>Aucun groupe trouvé pour cet utilisateur.</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajouter cette section après l'affichage des groupes
|
// Bouton de déconnexion
|
||||||
$user_details = $ldapAuth->getUserDetails($_SESSION['sAMAccountName']);
|
echo "<form method='post' action='../controllers/logout.php' class='logout-form'>";
|
||||||
echo "<h3>Vos informations de compte :</h3>";
|
echo "<input type='submit' value='Déconnexion' class='logout-button'>";
|
||||||
echo "<table border='1'>";
|
echo "</form>";
|
||||||
echo "<tr><th>Attribut</th><th>Valeur</th></tr>";
|
|
||||||
foreach ($user_details as $key => $value) {
|
|
||||||
if (!is_array($value) && $key !== 'count') {
|
|
||||||
echo "<tr><td>$key</td><td>$value</td></tr>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo "</table>";
|
|
||||||
|
|
||||||
// Bouton de déconnexion
|
|
||||||
echo "<form method='post' action='../controllers/logout.php'>";
|
|
||||||
echo "<input type='submit' value='Déconnexion'>";
|
|
||||||
echo "</form>";
|
|
||||||
// Reste du code (admin/user)
|
// Reste du code (admin/user)
|
||||||
Reference in New Issue
Block a user