@@ -38,6 +38,7 @@ class UnityLDAP extends ldapConn
3838 private $ pi_groupOU ;
3939 private $ org_groupOU ;
4040 private $ adminGroup ;
41+ private $ userGroup ;
4142
4243 private $ custom_mappings_path ;
4344
@@ -53,6 +54,7 @@ public function __construct(
5354 $ pigroup_ou ,
5455 $ orggroup_ou ,
5556 $ admin_group ,
57+ $ user_group_dn ,
5658 $ def_user_shell
5759 ) {
5860 parent ::__construct ($ host , $ dn , $ pass );
@@ -69,6 +71,7 @@ public function __construct(
6971 $ this ->pi_groupOU = $ this ->getEntry ($ pigroup_ou );
7072 $ this ->org_groupOU = $ this ->getEntry ($ orggroup_ou );
7173 $ this ->adminGroup = $ this ->getEntry ($ admin_group );
74+ $ this ->userGroup = $ this ->getEntry ($ user_group_dn );
7275
7376 $ this ->custom_mappings_path = $ custom_user_mappings ;
7477
@@ -103,6 +106,11 @@ public function getAdminGroup()
103106 return $ this ->adminGroup ;
104107 }
105108
109+ public function getUserGroup ()
110+ {
111+ return $ this ->userGroup ;
112+ }
113+
106114 public function getDefUserShell ()
107115 {
108116 return $ this ->def_user_shell ;
@@ -236,10 +244,10 @@ public function getAllUsers($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebhook,
236244 }
237245 }
238246
239- $ users = $ this ->userOU -> getChildren ( true );
240-
247+ $ users = $ this ->userGroup -> getAttribute ( " memberuid " );
248+ sort ( $ users );
241249 foreach ($ users as $ user ) {
242- $ params = array ($ user-> getAttribute ( " cn " )[ 0 ] , $ this , $ UnitySQL , $ UnityMailer , $ UnityRedis , $ UnityWebhook );
250+ $ params = array ($ user , $ this , $ UnitySQL , $ UnityMailer , $ UnityRedis , $ UnityWebhook );
243251 array_push ($ out , new UnityUser (...$ params ));
244252 }
245253
@@ -312,28 +320,24 @@ public function getAllOrgGroups($UnitySQL, $UnityMailer, $UnityRedis, $UnityWebh
312320 public function getUserEntry ($ uid )
313321 {
314322 $ uid = ldap_escape ($ uid , LDAP_ESCAPE_DN );
315- $ ldap_entry = new LDAPEntry ($ this ->getConn (), unityLDAP::RDN . "= $ uid, " . $ this ->STR_USEROU );
316- return $ ldap_entry ;
323+ return $ this ->getEntry (unityLDAP::RDN . "= $ uid, " . $ this ->STR_USEROU );
317324 }
318325
319326 public function getGroupEntry ($ gid )
320327 {
321- $ uid = ldap_escape ($ gid , LDAP_ESCAPE_DN );
322- $ ldap_entry = new LDAPEntry ($ this ->getConn (), unityLDAP::RDN . "= $ gid, " . $ this ->STR_GROUPOU );
323- return $ ldap_entry ;
328+ $ gid = ldap_escape ($ gid , LDAP_ESCAPE_DN );
329+ return $ this ->getEntry (unityLDAP::RDN . "= $ gid, " . $ this ->STR_GROUPOU );
324330 }
325331
326332 public function getPIGroupEntry ($ gid )
327333 {
328- $ uid = ldap_escape ($ gid , LDAP_ESCAPE_DN );
329- $ ldap_entry = new LDAPEntry ($ this ->getConn (), unityLDAP::RDN . "= $ gid, " . $ this ->STR_PIGROUPOU );
330- return $ ldap_entry ;
334+ $ gid = ldap_escape ($ gid , LDAP_ESCAPE_DN );
335+ return $ this ->getEntry (unityLDAP::RDN . "= $ gid, " . $ this ->STR_PIGROUPOU );
331336 }
332337
333338 public function getOrgGroupEntry ($ gid )
334339 {
335- $ uid = ldap_escape ($ gid , LDAP_ESCAPE_DN );
336- $ ldap_entry = new LDAPEntry ($ this ->getConn (), unityLDAP::RDN . "= $ gid, " . $ this ->STR_ORGGROUPOU );
337- return $ ldap_entry ;
340+ $ gid = ldap_escape ($ gid , LDAP_ESCAPE_DN );
341+ return $ this ->getEntry (unityLDAP::RDN . "= $ gid, " . $ this ->STR_ORGGROUPOU );
338342 }
339343}
0 commit comments