2121
2222require getTemplatePath ("header.php " );
2323$ CSRFTokenHiddenFormInput = UnityHTTPD::getCSRFTokenHiddenFormInput ();
24+ $ flags_to_display = array_filter (UserFlag::cases (), fn ($ x ) => $ x !== UserFlag::DISABLED );
2425?>
2526
2627<h1>User Management</h1>
@@ -38,6 +39,9 @@ class="stripe compact hover"
3839 <th>Mail</th>
3940 <th>Groups</th>
4041 <th>Actions</th>
42+ <?php foreach ($ flags_to_display as $ flag ) : ?>
43+ <th><?php echo $ flag ->value ; ?> </th>
44+ <?php endforeach ?>
4145 </tr>
4246 </thead>
4347 <tbody>
@@ -51,9 +55,16 @@ class="stripe compact hover"
5155 "mail " => ["(not found) " ]
5256 ]
5357 );
58+ $ users_with_flags = [];
59+ foreach (UserFlag::cases () as $ flag ) {
60+ $ users_with_flags [$ flag ->value ] = $ LDAP ->userFlagGroups [$ flag ->value ]->getMemberUIDs ();
61+ }
5462 usort ($ user_attributes , fn ($ a , $ b ) => strcmp ($ a ["uid " ][0 ], $ b ["uid " ][0 ]));
5563 foreach ($ user_attributes as $ attributes ) {
5664 $ uid = $ attributes ["uid " ][0 ];
65+ if (in_array ($ uid , $ users_with_flags [UserFlag::DISABLED ->value ])) {
66+ continue ;
67+ }
5768 if ($ SQL ->accDeletionRequestExists ($ uid )) {
5869 echo "<tr style='color:#555555; font-style: italic'> " ;
5970 } else {
@@ -81,6 +92,12 @@ class="stripe compact hover"
8192 <input type='submit' name='action' value='Access'>
8293 </form> " ;
8394 echo "</td> " ;
95+ foreach ($ flags_to_display as $ flag ) {
96+ echo sprintf (
97+ "<td>%s</td> " ,
98+ in_array ($ uid , $ users_with_flags [$ flag ->value ]) ? $ flag ->value : ""
99+ );
100+ }
84101 echo "</tr> " ;
85102 }
86103 ?>
@@ -99,6 +116,9 @@ class="stripe compact hover"
99116 {responsivePriority: 2, render: dataTablesRenderMailtoLink}, // mail
100117 {responsivePriority: 3, searchable: false}, // groups
101118 {responsivePriority: 1, searchable: false}, // actions
119+ <?php foreach ($ flags_to_display as $ flag ) : ?>
120+ {visible: false}, // <?php echo $ flag ->value . "\n" ?>
121+ <?php endforeach ?>
102122 ],
103123 layout: {topStart: {buttons: ['colvis']}}
104124 });
0 commit comments