2018-06-01 17:10:45 +01:00
|
|
|
<?php
|
|
|
|
|
2020-01-10 12:01:31 +00:00
|
|
|
set_include_path( ".:" . __DIR__ . "/../includes/");
|
|
|
|
|
|
|
|
include_once "web_functions.inc.php";
|
|
|
|
include_once "ldap_functions.inc.php";
|
|
|
|
include_once "module_functions.inc.php";
|
2018-06-01 17:10:45 +01:00
|
|
|
set_page_access("admin");
|
|
|
|
|
2021-04-15 15:43:53 +01:00
|
|
|
render_header("$ORGANISATION_NAME account manager");
|
2018-06-01 17:10:45 +01:00
|
|
|
render_submenu();
|
|
|
|
|
|
|
|
$ldap_connection = open_ldap_connection();
|
|
|
|
|
|
|
|
if (isset($_POST['delete_user'])) {
|
2020-01-10 12:01:31 +00:00
|
|
|
|
2018-06-01 17:10:45 +01:00
|
|
|
?>
|
|
|
|
<script>
|
|
|
|
window.setTimeout(function() {
|
|
|
|
$(".alert").fadeTo(500, 0).slideUp(500, function(){ $(this).remove(); });
|
|
|
|
}, 4000);
|
|
|
|
</script>
|
|
|
|
<?php
|
2020-01-10 12:01:31 +00:00
|
|
|
|
2018-06-01 17:10:45 +01:00
|
|
|
$this_user = $_POST['delete_user'];
|
2020-01-10 12:01:31 +00:00
|
|
|
$this_user = urldecode($this_user);
|
|
|
|
|
2021-03-13 14:11:38 +00:00
|
|
|
$del_user = ldap_delete_account($ldap_connection,$this_user);
|
2020-01-10 12:01:31 +00:00
|
|
|
|
2021-03-13 14:11:38 +00:00
|
|
|
if ($del_user) {
|
|
|
|
?>
|
|
|
|
<div class="alert alert-success" role="alert">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="TRUE">×</span></button>
|
|
|
|
<p class="text-center">User <strong><?php print $this_user; ?> was deleted.</p>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-06-01 17:10:45 +01:00
|
|
|
}
|
2021-03-13 14:11:38 +00:00
|
|
|
else {
|
|
|
|
?>
|
|
|
|
<div class="alert alert-danger" role="alert">
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="TRUE">×</span></button>
|
|
|
|
<p class="text-center">User <strong><?php print $this_user; ?></strong> wasn't deleted.</p>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
2018-06-01 17:10:45 +01:00
|
|
|
|
|
|
|
}
|
2020-12-24 18:24:41 +00:00
|
|
|
#'
|
2018-06-01 17:10:45 +01:00
|
|
|
$people = ldap_get_user_list($ldap_connection);
|
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="container">
|
2021-05-19 08:55:07 +01:00
|
|
|
<form action="<?php print $THIS_MODULE_PATH; ?>/new_user.php" method="post">
|
|
|
|
<span class="badge badge-secondary" style="font-size:1.9rem;"><?php print count($people);?> account<?php if (count($people) != 1) { print "s"; }?></span> <button id="add_group" class="btn btn-default" type="submit">New user</button>
|
2018-06-01 17:10:45 +01:00
|
|
|
</form>
|
|
|
|
<table class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2021-03-13 14:11:38 +00:00
|
|
|
<th>Account name</th>
|
2018-06-01 17:10:45 +01:00
|
|
|
<th>First name</th>
|
|
|
|
<th>Last name</th>
|
2019-02-08 11:28:11 +00:00
|
|
|
<th>Email</th>
|
2020-12-24 18:24:41 +00:00
|
|
|
<th>Member of</th>
|
2018-06-01 17:10:45 +01:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
2021-03-13 14:11:38 +00:00
|
|
|
foreach ($people as $account_identifier => $attribs){
|
2020-12-24 18:24:41 +00:00
|
|
|
|
2021-03-13 14:11:38 +00:00
|
|
|
$group_membership = ldap_user_group_membership($ldap_connection,$account_identifier);
|
2020-12-24 18:24:41 +00:00
|
|
|
|
2021-04-15 15:43:53 +01:00
|
|
|
print " <tr>\n <td><a href='${THIS_MODULE_PATH}/show_user.php?account_identifier=" . urlencode($account_identifier) . "'>$account_identifier</a></td>\n";
|
2021-03-13 14:11:38 +00:00
|
|
|
print " <td>" . $people[$account_identifier]['givenname'] . "</td>\n";
|
|
|
|
print " <td>" . $people[$account_identifier]['sn'] . "</td>\n";
|
|
|
|
print " <td>" . $people[$account_identifier]['mail'] . "</td>\n";
|
2020-12-24 18:24:41 +00:00
|
|
|
print " <td>" . implode(", ", $group_membership) . "</td>\n";
|
2018-06-01 17:10:45 +01:00
|
|
|
print " </tr>\n";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
|
2020-12-24 18:24:41 +00:00
|
|
|
ldap_close($ldap_connection);
|
2018-06-01 17:10:45 +01:00
|
|
|
render_footer();
|
|
|
|
?>
|