File tree Expand file tree Collapse file tree 2 files changed +20
-14
lines changed Expand file tree Collapse file tree 2 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,19 @@ public function getPIGroupGIDsWithMemberUID($uid)
321
321
);
322
322
}
323
323
324
+ public function getAllPIGroupOwnerEntries ()
325
+ {
326
+ $ gids = array_map (fn ($ x ) => $ x ["cn " ][0 ], $ this ->pi_groupOU ->getChildrenArray (["cn " ]));
327
+ $ owner_uids = array_map (fn ($ x ) => UnityGroup::getUIDFromPIUID ($ x ), $ gids );
328
+ $ owner_entries = $ this ->getAllUsersEntries ();
329
+ foreach ($ owner_entries as $ i => $ entry ) {
330
+ if (!in_array ($ entry ["uid " ][0 ], $ owner_uids )) {
331
+ unset($ owner_entries [$ i ]);
332
+ }
333
+ }
334
+ return $ owner_entries ;
335
+ }
336
+
324
337
/** Returns an assosiative array where keys are UIDs and values are lists of PI GIDs */
325
338
public function getAllUID2PIGIDs ()
326
339
{
Original file line number Diff line number Diff line change 109
109
<td>Actions</td>
110
110
</tr>
111
111
112
- <?php
113
- $ accounts = $ LDAP ->getAllPIGroups ($ SQL , $ MAILER , $ REDIS , $ WEBHOOK );
114
-
115
- usort ($ accounts , function ($ a , $ b ) {
116
- return strcmp ($ a ->getPIUID (), $ b ->getPIUID ());
117
- });
118
-
119
- foreach ($ accounts as $ pi_group ) {
120
- $ pi_user = $ pi_group ->getOwner ();
121
-
112
+ <?php
113
+ $ owner_entries = $ LDAP ->getAllPIGroupOwnerEntries ();
114
+ usort ($ owner_entries , fn ($ a , $ b ) => strcmp ($ a ["cn " ][0 ], $ b ["cn " ][0 ]));
115
+ foreach ($ owner_entries as $ entry ) {
122
116
echo "<tr class='expandable'> " ;
123
- echo "<td><button class='btnExpand'>▶</button> " . $ pi_user ->getFirstname () .
124
- " " . $ pi_user ->getLastname () . "</td> " ;
125
- echo "<td> " . $ pi_group ->getPIUID () . "</td> " ;
126
- echo "<td><a href='mailto: " . $ pi_user ->getMail () . "'> " . $ pi_user ->getMail () . "</a></td> " ;
117
+ echo "<td><button class='btnExpand'>▶</button> " . $ entry ["gecos " ][0 ] . "</td> " ;
118
+ echo "<td> " . UnityGroup::getPIUIDfromUID ($ entry ["uid " ][0 ]) . "</td> " ;
119
+ echo "<td><a href='mailto: " . $ entry ["mail " ][0 ] . "'> " . $ entry ["mail " ][0 ] . "</a></td> " ;
127
120
echo "</tr> " ;
128
121
}
129
122
?>
You can’t perform that action at this time.
0 commit comments