Add ActiveDirectory navigation and group management pages

- Added new ActiveDirectory section in the navigation bar (`navbar.html`) with expandable options.
- Implemented `GroupReview.php` for reviewing AD group details and tiering.
- Implemented `GroupSearch.php` for searching and displaying AD group memberships with autocomplete functionality.
- Fixed incorrect link in `index.php` pointing to `AD-Detail.php`.
This commit is contained in:
e025532
2025-07-17 10:21:59 +02:00
parent 4b90b1ee5c
commit 1f794e2273
4 changed files with 189 additions and 1 deletions

73
AD/GroupReview.php Normal file
View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title -->
<title>Web Infra Reports IT</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<link rel="stylesheet" href="/css/preloader.css">
<script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head>
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML -->
<div class="container-fluid" id="content">
<div class="row flex-nowrap">
<!-- Left NAVBAR -->
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Group Review</span></h1>
<!-- Main content -->
<div class="container-fluid">
<?php // DATA
$teams = Invoke_Infra("SELECT distinct equipe FROM Group_Review_SOX");
foreach ($teams as $team) {
echo "<h2 class='text-center'>".$team['equipe']."</h2>";
$groups = Invoke_Infra("SELECT * FROM Group_Review_SOX WHERE equipe = '".$team['equipe']."' order by groupe");
foreach($groups as $group) {
echo "<h3>".$group['Groupe']."</h3>";
echo "<h4>".$group['Tiering']."</h4>";
echo " - ".str_replace("),",")<br> - ",$group['Members']);
echo "<br><br>";
}
echo "<hr>";
}
?>
<div>
<br>
</div>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body>
<script src="/js/switch.js"></script>
</HTML>

105
AD/GroupSearch.php Normal file
View File

@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Page Title -->
<title>Web Infra Reports IT</title>
<link rel="shortcut icon" type="image/png" href="/include/favicon-32x32.png">
<!-- JQuery -->
<script src="/js/jquery-3.6.1.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/bootstrap-icons/bootstrap-icons.css">
<link rel="stylesheet" href="/css/preloader.css">
<script src="/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap-tables -->
<link rel="stylesheet" href="/css/bootstrap-table.min.css">
<script src="/js/bootstrap-table.min.js"></script>
<script src="/js/bootstrap-table-fr-FR.min.js"></script>
<script src="/js/tableExport.min.js"></script>
<script src="/js/bootstrap-table-export.min.js"></script>
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
</head>
<body class="bg-light text-dark">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
<!-- HTML -->
<div class="container-fluid" id="content">
<div class="row flex-nowrap">
<!-- Left NAVBAR -->
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
</div>
<!-- Display -->
<div class="col py-3">
<!-- Page Title -->
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Group Membership</span></h1>
<!-- Main content -->
<div class="container-fluid">
<?php // DATA
// Fetch all unique group names for the autocomplete
$group_query = Invoke_Infra("SELECT DISTINCT grp FROM AD_GroupMembership ORDER BY grp");
$groups = [];
foreach ($group_query as $row) {
$groups[] = $row['grp'];
}
?>
<div>
<br>
</div>
<form id="search-form" class="mb-4" method="POST" action="">
<div class="row">
<div class="col-md-6">
<label for="group-search" class="form-label">Search AD Group</label>
<input type="text" class="form-control" id="group-search" name="group-search" placeholder="Start typing group name ...">
</div>
<div class="col-md-2 d-flex align-items-end">
<button type="submit" class="btn btn-primary w-100">Show Members</button>
</div>
</div>
</form>
<?php
if(isset($_POST['group-search'])) {
echo "<h2 class='text-center'>".$_POST['group-search']."</h2>";
$members = Invoke_Infra("SELECT * FROM AD_GroupMembership WHERE grp = '".$_POST['group-search']."'");
echo "<h3 class='text-center'>".$members[0]['descr']."</h3>";
echo " - ".str_replace(" | ","<br> - ",$members[0]['members']);
}
?>
</div>
<!-- End of main content -->
</div>
</div>
</div>
</body>
<script>
$(function() {
const availableGroups = <?php echo json_encode($groups); ?>;
const groupSearchInput = $('#group-search');
groupSearchInput.autocomplete({
source: availableGroups
});
});
$('#group-search').on('keypress', function(e) {
if (e.which == 13) {
e.preventDefault();
$('#search-form').submit();
}
});
</script>
<script src="/js/switch.js"></script>
</HTML>

View File

@@ -79,7 +79,7 @@
$result = $conn->query("SELECT count(*) as nbADinactive FROM adcomputers WHERE enabled = 'False'"); $result = $conn->query("SELECT count(*) as nbADinactive FROM adcomputers WHERE enabled = 'False'");
$nbADinactive = mysqli_fetch_array($result)['nbADinactive']; $nbADinactive = mysqli_fetch_array($result)['nbADinactive'];
?> ?>
<p class="card-text text-center"><b><a href="\dashboard\ad-detail.php"><?php echo $nbADactive; ?></b> Devices <small>(<?php echo $nbADinactive; ?> inactifs)</small></a></p> <p class="card-text text-center"><b><a href="\dashboard\AD-Detail.php"><?php echo $nbADactive; ?></b> Devices <small>(<?php echo $nbADinactive; ?> inactifs)</small></a></p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -102,6 +102,16 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>
<a href="#AD" data-bs-toggle="collapse" class="nav-link px-0 align-middle">
<i class="fs-6 bi bi-people text-white"></i> <span class="ms-1 d-none d-sm-inline text-white h7">ActiveDirectory</span><i class="bi bi-caret-down"></i> </a>
<ul class="collapse nav flex-column ms-1" id="AD" data-bs-parent="#menu">
<li class="w-100">
<a href="/AD/GroupReview.php" class="nav-link px-0" target="_blank"> <span class="d-none d-sm-inline text-white h7">- Group Review</span></a>
<a href="/AD/GroupSearch.php" class="nav-link px-0" target="_blank"> <span class="d-none d-sm-inline text-white h7">- Group Membership</span></a>
</li>
</ul>
</li>
<br> <br>
<br> <br>
<li> <li>