@@ -153,14 +153,21 @@ public function getNextUIDGIDNumber($uid)
153153
154154 public function getNextPIGIDNumber ()
155155 {
156+ $ IDNumsInUse = array_merge (
157+ array_values ($ this ->getCustomIDMappings ()),
158+ $ this ->getAllGIDNumbersInUse (),
159+ );
156160 $ IDNumsInUse = $ this ->getAllGIDNumbersInUse ();
157161 $ start = $ this ->offset_PIGID ;
158162 return $ this ->getNextIDNumber ($ start , $ IDNumsInUse );
159163 }
160164
161165 public function getNextOrgGIDNumber ()
162166 {
163- $ IDNumsInUse = $ this ->getAllGIDNumbersInUse ();
167+ $ IDNumsInUse = array_merge (
168+ array_values ($ this ->getCustomIDMappings ()),
169+ $ this ->getAllGIDNumbersInUse (),
170+ );
164171 $ start = $ this ->offset_ORGGID ;
165172 return $ this ->getNextIDNumber ($ start , $ IDNumsInUse );
166173 }
@@ -212,27 +219,19 @@ private function getCustomIDMappings()
212219
213220 private function getAllUIDNumbersInUse ()
214221 {
215- return array_merge (
216- // use baseOU for awareness of externally managed entries
217- array_map (
218- fn ($ x ) => $ x ["uidnumber " ][0 ],
219- $ this ->baseOU ->getChildrenArray (["uidNumber " ], true , "(objectClass=posixAccount) " ),
220- ),
221- // custom mappings are considered UID and GID
222- array_values ($ this ->getCustomIDMappings ()),
222+ // use baseOU for awareness of externally managed entries
223+ return array_map (
224+ fn ($ x ) => $ x ["uidnumber " ][0 ],
225+ $ this ->baseOU ->getChildrenArray (["uidNumber " ], true , "(objectClass=posixAccount) " ),
223226 );
224227 }
225228
226229 private function getAllGIDNumbersInUse ()
227230 {
228- return array_merge (
229- // use baseOU for awareness of externally managed entries
230- array_map (
231- fn ($ x ) => $ x ["gidnumber " ][0 ],
232- $ this ->baseOU ->getChildrenArray (["gidNumber " ], true , "(objectClass=posixGroup) " ),
233- ),
234- // custom mappings are considered UID and GID
235- array_values ($ this ->getCustomIDMappings ()),
231+ // use baseOU for awareness of externally managed entries
232+ return array_map (
233+ fn ($ x ) => $ x ["gidnumber " ][0 ],
234+ $ this ->baseOU ->getChildrenArray (["gidNumber " ], true , "(objectClass=posixGroup) " ),
236235 );
237236 }
238237
0 commit comments