Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions webroot/admin/user-mgmt.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

require getTemplatePath("header.php");
$CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput();
$flags_to_display = array_filter(UserFlag::cases(), fn($x) => $x !== UserFlag::DISABLED);
?>

<h1>User Management</h1>
Expand All @@ -38,6 +39,9 @@ class="stripe compact hover"
<th>Mail</th>
<th>Groups</th>
<th>Actions</th>
<?php foreach ($flags_to_display as $flag) : ?>
<th><?php echo $flag->value; ?></th>
<?php endforeach ?>
</tr>
</thead>
<tbody>
Expand All @@ -51,9 +55,16 @@ class="stripe compact hover"
"mail" => ["(not found)"]
]
);
$users_with_flags = [];
foreach (UserFlag::cases() as $flag) {
$users_with_flags[$flag->value] = $LDAP->userFlagGroups[$flag->value]->getMemberUIDs();
}
usort($user_attributes, fn ($a, $b) => strcmp($a["uid"][0], $b["uid"][0]));
foreach ($user_attributes as $attributes) {
$uid = $attributes["uid"][0];
if (in_array($uid, $users_with_flags[UserFlag::DISABLED->value])) {
continue;
}
if ($SQL->accDeletionRequestExists($uid)) {
echo "<tr style='color:#555555; font-style: italic'>";
} else {
Expand Down Expand Up @@ -81,6 +92,12 @@ class="stripe compact hover"
<input type='submit' name='action' value='Access'>
</form>";
echo "</td>";
foreach ($flags_to_display as $flag) {
echo sprintf(
"<td>%s</td>",
in_array($uid, $users_with_flags[$flag->value]) ? $flag->value : ""
);
}
echo "</tr>";
}
?>
Expand All @@ -99,6 +116,9 @@ class="stripe compact hover"
{responsivePriority: 2, render: dataTablesRenderMailtoLink}, // mail
{responsivePriority: 3, searchable: false}, // groups
{responsivePriority: 1, searchable: false}, // actions
<?php foreach ($flags_to_display as $flag) : ?>
{visible: false}, // <?php echo $flag->value . "\n"?>
<?php endforeach ?>
],
layout: {topStart: {buttons: ['colvis']}}
});
Expand Down