@@ -166,7 +166,7 @@ private function getIDNumsInUse()
166
166
range (100 , 999 ), // reserved for debian packages
167
167
range (6000 , 64999 ), // reserved for debian packages
168
168
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 )),
170
170
);
171
171
}
172
172
@@ -203,7 +203,7 @@ public function getUnassignedID($uid, $UnitySQL)
203
203
//
204
204
// Functions that return user/group objects
205
205
//
206
- public function getAllUsers ($ UnitySQL , $ UnityMailer , $ UnityRedis , $ UnityWebhook , $ ignorecache = false )
206
+ public function getUnityUsers ($ UnitySQL , $ UnityMailer , $ UnityRedis , $ UnityWebhook , $ ignorecache = false )
207
207
{
208
208
$ out = array ();
209
209
@@ -218,7 +218,7 @@ public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook,
218
218
}
219
219
}
220
220
221
- $ users = array_map (fn ($ x ) => $ x ["cn " ][0 ], $ this ->getAllUsersAttributes (["cn " ]));
221
+ $ users = array_map (fn ($ x ) => $ x ["cn " ][0 ], $ this ->getUnityUsersAttributes (["cn " ]));
222
222
sort ($ users );
223
223
foreach ($ users as $ user ) {
224
224
$ params = array ($ user , $ this , $ UnitySQL , $ UnityMailer , $ UnityRedis , $ UnityWebhook );
@@ -228,13 +228,18 @@ public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook,
228
228
return $ out ;
229
229
}
230
230
231
- public function getAllUsersAttributes ($ attributes )
231
+ private function getAllUsersAttributes ($ attributes )
232
232
{
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
+ array_push ($ attributes , "cn " );
234
+ return $ this ->baseOU ->getChildrenArray ($ attributes , true , "objectClass=posixAccount " );
235
+ }
236
+
237
+ private function getUnityUsersAttributes ($ attributes )
238
+ {
239
+ return array_filter (
240
+ getAllUsersAttributes ($ attributes ),
241
+ fn ($ x ) => in_array ($ x ["cn " ], $ unityuser_CNs )
242
+ );
238
243
}
239
244
240
245
public function getAllPIGroups ($ UnitySQL , $ UnityMailer , $ UnityRedis , $ UnityWebhook , $ ignorecache = false )
0 commit comments