Skip to content

Commit 0f5df88

Browse files
committed
more stuff
1 parent dec63d9 commit 0f5df88

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

resources/lib/UnityLDAP.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function getIDNumsInUse()
166166
range(100, 999), // reserved for debian packages
167167
range(6000, 64999), // reserved for debian packages
168168
array_map(fn($x) => $x["uidnumber"][0], $this->getAllUsersAttributes(["uidnumber"])),
169-
array_map(fn($x) => $x["gidnumber"][0], $this->pi_groupOU->getChildrenArray(true)),
169+
array_map(fn($x) => $x["gidnumber"][0], $this->pi_groupOU->getChildrenArray(["gidnumber"], true)),
170170
);
171171
}
172172

@@ -203,7 +203,7 @@ public function getUnassignedID($uid, $UnitySQL)
203203
//
204204
// Functions that return user/group objects
205205
//
206-
public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false)
206+
public function getUnityUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false)
207207
{
208208
$out = array();
209209

@@ -218,7 +218,7 @@ public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook,
218218
}
219219
}
220220

221-
$users = array_map(fn($x) => $x["cn"][0], $this->getAllUsersAttributes(["cn"]));
221+
$users = array_map(fn($x) => $x["cn"][0], $this->getUnityUsersAttributes(["cn"]));
222222
sort($users);
223223
foreach ($users as $user) {
224224
$params = array($user, $this, $UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook);
@@ -230,11 +230,15 @@ public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook,
230230

231231
public function getAllUsersAttributes($attributes)
232232
{
233-
// some LDAP users might be unity users but not be in the users OU
234-
$users = $this->baseOU->getChildrenArray(true, "objectClass=posixAccount");
235-
// some LDAP users might not be unity users at all
236-
$unityuser_CNs = $this->getUserGroup()->getAttribute("memberuid");
237-
return array_filter($users, fn($x) => in_array($x["cn"], $unityuser_CNs));
233+
return $this->baseOU->getChildrenArray($attributes, true, "objectClass=posixAccount");
234+
}
235+
236+
public function getUnityUsersAttributes($attributes)
237+
{
238+
return array_filter(
239+
getAllUsersAttributes($attributes),
240+
fn($x) => in_array($x["cn"], $unityuser_CNs)
241+
);
238242
}
239243

240244
public function getAllPIGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook, $ignorecache = false)

webroot/admin/user-mgmt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
</tr>
3838

3939
<?php
40-
$users = $LDAP->getAllUsers($SQL, $MAILER, $REDIS, $WEBHOOK);
40+
$users = $LDAP->getUnityUsers($SQL, $MAILER, $REDIS, $WEBHOOK);
4141

42-
usort($users, function ($a, $b) {
42+
sort($users, function ($a, $b) {
4343
return strcmp($a->getUID(), $b->getUID());
4444
});
4545

0 commit comments

Comments
 (0)