Skip to content

Commit 55d4f84

Browse files
committed
query only for attributes that we need
1 parent a163b97 commit 55d4f84

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

resources/lib/UnityLDAP.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook,
256256
}
257257
}
258258

259-
public function getAllUsersEntries()
259+
public function getAllUsersEntries($attributes = [])
260260
{
261261
$include_uids = $this->getAllUsersUIDs();
262262
$user_entries = $this->baseOU->getChildrenArray(
263-
[], // all attributes
263+
$attributes,
264264
true, // recursive
265265
"objectClass=posixAccount"
266266
);
@@ -321,7 +321,7 @@ public function getPIGroupGIDsWithMemberUID($uid)
321321
);
322322
}
323323

324-
public function getAllPIGroupOwnerEntries()
324+
public function getAllPIGroupOwnerEntries($attributes = [])
325325
{
326326
// get the PI groups, filter for just the GIDs, then map the GIDs to owner UIDs
327327
$owner_uids = array_map(
@@ -331,7 +331,7 @@ public function getAllPIGroupOwnerEntries()
331331
$this->pi_groupOU->getChildrenArray(["cn"]),
332332
),
333333
);
334-
$owner_entries = $this->getAllUsersEntries();
334+
$owner_entries = $this->getAllUsersEntries($attributes);
335335
foreach ($owner_entries as $i => $entry) {
336336
if (!in_array($entry["uid"][0], $owner_uids)) {
337337
unset($owner_entries[$i]);

webroot/admin/pi-mgmt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@
110110
</tr>
111111

112112
<?php
113-
$owner_entries = $LDAP->getAllPIGroupOwnerEntries();
114-
usort($owner_entries, fn($a, $b) => strcmp($a["cn"][0], $b["cn"][0]));
113+
$owner_entries = $LDAP->getAllPIGroupOwnerEntries(["uid", "gecos", "mail"]);
114+
usort($owner_entries, fn($a, $b) => strcmp($a["uid"][0], $b["uid"][0]));
115115
foreach ($owner_entries as $entry) {
116116
echo "<tr class='expandable'>";
117117
echo "<td><button class='btnExpand'>&#9654;</button>" . $entry["gecos"][0] . "</td>";

webroot/admin/user-mgmt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838

3939
<?php
4040
$UID2PIGIDs = $LDAP->getAllUID2PIGIDs();
41-
$user_entries = $LDAP->getAllUsersEntries();
41+
$user_entries = $LDAP->getAllUsersEntries(["uid", "gecos", "o", "mail"]);
4242
usort($user_entries, function ($a, $b) {
43-
return strcmp($a["uid"], $b["uid"]);
43+
return strcmp($a["uid"][0], $b["uid"][0]);
4444
});
4545
foreach ($user_entries as $entry) {
4646
$uid = $entry["uid"][0];

0 commit comments

Comments
 (0)