UsersLdapHelper.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <?php
  2. class UsersLdapHelper {
  3. public static function getUser($userName, $allAttrs = false) {
  4. $ldapUsers = array();
  5. //$attrMap = array('uid', 'apple-generateduid', 'givenName', 'uidNumber', 'cn', 'mail', 'apple-user-mailattribute');// (givenName, sn) = cn
  6. $attrMap = array();
  7. $attrMap['uid'] = 'uid';
  8. $attrMap['apple-generateduid'] = 'apple-generateduid';
  9. $attrMap['givenName'] = 'givenName';
  10. $attrMap['uidNumber'] = 'uidNumber';
  11. $attrMap['cn'] = 'cn';
  12. $attrMap['mail'] = 'mail';
  13. $attrMap['carLicense'] = 'carLicense';
  14. Lib::loadClass('LDAP');
  15. $ldap = LDAP::getInstance();
  16. $filter = (false !== strpos($userName, '@'))? "(mail={$userName})" : "(uid={$userName})";
  17. $filter = "(&(objectClass=apple-user){$filter})";// apple-user posixAccount inetOrgPerson
  18. //$filter = "(&(objectClass=inetOrgPerson){$filter})";
  19. $attributes = array();
  20. $res = $ldap->search($filter, 'cn=users', $attributes);
  21. $entry = $ldap->first_entry($res);
  22. while ($entry) {
  23. $attrs = $ldap->get_attributes($entry);
  24. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">attrs(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($attrs);echo'</pre>';}
  25. $userObj = new stdClass();
  26. if ($allAttrs) {
  27. for ($i = 0; $i < $attrs['count']; $i++) {
  28. $vAttrName = $attrs[$i];
  29. $vAttrVal = $attrs[$vAttrName];
  30. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  31. $userObj->{$vAttrName} = $vAttrVal[0];
  32. }
  33. }
  34. } else {
  35. foreach ($attrMap as $kAttrName => $vFldName) {
  36. $vAttrVal = V::get($kAttrName, '', $attrs);
  37. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  38. if ($vAttrVal['count'] > 1) {
  39. $userObj->{$vFldName} = array();
  40. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  41. $userObj->{$vFldName}[] = $vAttrVal[$j];
  42. }
  43. } else {
  44. $userObj->{$vFldName} = $vAttrVal[0];
  45. }
  46. }
  47. }
  48. }
  49. $ldapUsers[] = $userObj;
  50. $entry = $ldap->next_entry($entry);
  51. }
  52. $ldap->free_result($res);
  53. return $ldapUsers;
  54. }
  55. public static function getUsersAll() {
  56. $allLdapUsers = array();
  57. $attrMap = array('uid', 'apple-generateduid', 'givenName', 'uidNumber', 'cn', 'mail', 'carLicense');// (givenName, sn) = cn
  58. Lib::loadClass('LDAP');
  59. $ldap = LDAP::getInstance();
  60. $filter = "(objectClass=apple-user)";// apple-user posixAccount inetOrgPerson
  61. $attributes = array();
  62. $res = $ldap->search($filter, 'cn=users', $attributes);
  63. $entry = $ldap->first_entry($res);
  64. while ($entry) {
  65. $attrs = $ldap->get_attributes($entry);
  66. $userObj = new stdClass();
  67. foreach ($attrMap as $vAttrName) {
  68. $vAttrVal = V::get($vAttrName, '', $attrs);
  69. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  70. $userObj->{$vAttrName} = $vAttrVal[0];
  71. }
  72. }
  73. $allLdapUsers[] = $userObj;
  74. $entry = $ldap->next_entry($entry);
  75. }
  76. $ldap->free_result($res);
  77. return $allLdapUsers;
  78. }
  79. public static function getUserGroups($userName, $authLDAPSubGroupDepth = 3) {
  80. $userLdapGroups = array();
  81. $attrMap = array('apple-generateduid'=>'appleUID', 'gidNumber'=>'gidNumber', 'cn'=>'cn');// (givenName, sn) = cn
  82. Lib::loadClass('LDAP');
  83. $ldap = LDAP::getInstance();
  84. $lastLoopFound = array();
  85. for ($i = 0; $i <= $authLDAPSubGroupDepth; $i++) {
  86. $userLdapGroupsAdd = array();
  87. if ($i == 0) {
  88. $filter = "(&(objectClass=apple-group)(memberUid={$userName}))";
  89. } else {
  90. $queryOrArr = array();
  91. foreach ($lastLoopFound as $vAppleUid) {
  92. $queryOrArr[] = "apple-group-nestedgroup={$vAppleUid}";
  93. }
  94. if (!empty($queryOrArr)) {
  95. $queryOr = '(|(' . implode(')(', $queryOrArr) . '))';
  96. $filter = "(&(objectClass=apple-group){$queryOr})";
  97. } else {
  98. break;
  99. }
  100. }
  101. //if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">ldap_search (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r(array('ldaprdn'=>'cn=groups,' . $ldap->getBaseDN(), 'filter'=>$filter, 'attributes'=>$attributes));echo'</pre>';}
  102. $attributes = array();
  103. $res = $ldap->search($filter, 'cn=groups', $attributes);
  104. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">search(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($filter);echo'</pre>';}
  105. $entry = $ldap->first_entry($res);
  106. while ($entry) {
  107. $attrs = $ldap->get_attributes($entry);
  108. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">user('.$userName.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($attrs);echo'</pre>';}
  109. $groupObj = new stdClass();
  110. foreach ($attrMap as $kAttrName => $vField) {
  111. $vAttrVal = V::get($kAttrName, '', $attrs);
  112. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  113. $groupObj->{$vField} = $vAttrVal[0];
  114. }
  115. }
  116. if ($groupObj->cn && $groupObj->gidNumber) {
  117. $userLdapGroupsAdd[$groupObj->gidNumber] = $groupObj;
  118. } else {
  119. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Error: brak cn lub apple-generateduid (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($attrs);echo'</pre>';
  120. }
  121. $entry = $ldap->next_entry($entry);
  122. }
  123. $ldap->free_result($res);
  124. if (empty($userLdapGroupsAdd)) {
  125. break;
  126. } else {
  127. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">userLdapGroupsAdd('.count($userLdapGroupsAdd).') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($userLdapGroupsAdd);echo'</pre>';}
  128. $lastLoopFound = array();
  129. foreach ($userLdapGroupsAdd as $kAppleID => $vGroup) {
  130. $userLdapGroups[$kAppleID] = $vGroup;
  131. $lastLoopFound[] = $vGroup->appleUID;
  132. }
  133. //$lastLoopFound = array_keys($userLdapGroupsAdd);
  134. }
  135. }
  136. return $userLdapGroups;
  137. }
  138. public static function getUserGroupsByAppleUid($userUid, $authLDAPSubGroupDepth = 3) {
  139. $userLdapGroups = array();
  140. $attrMap = array('apple-generateduid'=>'appleUID', 'gidNumber'=>'gidNumber', 'cn'=>'cn');// (givenName, sn) = cn
  141. Lib::loadClass('LDAP');
  142. $ldap = LDAP::getInstance();
  143. $lastLoopFound = array();
  144. for ($i = 0; $i <= $authLDAPSubGroupDepth; $i++) {
  145. $userLdapGroupsAdd = array();
  146. if ($i == 0) {
  147. $filter = "(&(objectClass=apple-group)(apple-group-memberguid={$userUid}))";
  148. } else {
  149. $queryOrArr = array();
  150. foreach ($lastLoopFound as $vAppleUid) {
  151. $queryOrArr[] = "apple-group-nestedgroup={$vAppleUid}";
  152. }
  153. if (!empty($queryOrArr)) {
  154. $queryOr = '(|(' . implode(')(', $queryOrArr) . '))';
  155. $filter = "(&(objectClass=apple-group){$queryOr})";
  156. } else {
  157. break;
  158. }
  159. }
  160. //if($DBG){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">ldap_search (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r(array('ldaprdn'=>'cn=groups,' . $ldap->getBaseDN(), 'filter'=>$filter, 'attributes'=>$attributes));echo'</pre>';}
  161. $attributes = array();
  162. $res = $ldap->search($filter, 'cn=groups', $attributes);
  163. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">search(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($filter);echo'</pre>';}
  164. $entry = $ldap->first_entry($res);
  165. while ($entry) {
  166. $attrs = $ldap->get_attributes($entry);
  167. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">user('.$userUid.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($attrs);echo'</pre>';}
  168. $groupObj = new stdClass();
  169. foreach ($attrMap as $kAttrName => $vField) {
  170. $vAttrVal = V::get($kAttrName, '', $attrs);
  171. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  172. $groupObj->{$vField} = $vAttrVal[0];
  173. }
  174. }
  175. if ($groupObj->cn && $groupObj->gidNumber) {
  176. $userLdapGroupsAdd[$groupObj->gidNumber] = $groupObj;
  177. } else {
  178. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Error: brak cn lub apple-generateduid (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($attrs);echo'</pre>';
  179. }
  180. $entry = $ldap->next_entry($entry);
  181. }
  182. $ldap->free_result($res);
  183. if (empty($userLdapGroupsAdd)) {
  184. break;
  185. } else {
  186. if(V::get('DBG_L', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">userLdapGroupsAdd('.count($userLdapGroupsAdd).') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($userLdapGroupsAdd);echo'</pre>';}
  187. $lastLoopFound = array();
  188. foreach ($userLdapGroupsAdd as $kAppleID => $vGroup) {
  189. $userLdapGroups[$kAppleID] = $vGroup;
  190. $lastLoopFound[] = $vGroup->appleUID;
  191. }
  192. //$lastLoopFound = array_keys($userLdapGroupsAdd);
  193. }
  194. }
  195. return $userLdapGroups;
  196. }
  197. public static function getGroupsByAppleUids($appleUids, $allAttrs = false) {
  198. $allLdapGroups = array();
  199. if (empty($appleUids)) return $allLdapGroups;
  200. $attrMap = array('apple-generateduid'=>'appleUID', 'gidNumber'=>'gidNumber', 'cn'=>'cn');// (givenName, sn) = cn
  201. $attrMap['apple-group-realname'] = 'realName';
  202. $attrMap['apple-group-nestedgroup'] = 'nestedGroups';
  203. Lib::loadClass('LDAP');
  204. $ldap = LDAP::getInstance();
  205. $filters = array();
  206. foreach ($appleUids as $vAppleUid) $filters[] = "(apple-generateduid={$vAppleUid})";
  207. $filter = "(&(objectClass=apple-group)(|" . implode("", $filters) . "))";
  208. $attributes = array();
  209. $res = $ldap->search($filter, 'cn=groups', $attributes);
  210. $entry = $ldap->first_entry($res);
  211. while ($entry) {
  212. $attrs = $ldap->get_attributes($entry);
  213. $groupObj = new stdClass();
  214. if ($allAttrs) {
  215. for ($i = 0; $i < $attrs['count']; $i++) {
  216. $vAttrName = $attrs[$i];
  217. $vFldName = V::get($vAttrName, $vAttrName, $attrMap);
  218. $vAttrVal = $attrs[$vAttrName];
  219. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  220. if ($vAttrVal['count'] > 1) {
  221. $groupObj->{$vFldName} = array();
  222. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  223. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  224. }
  225. } else {
  226. $groupObj->{$vFldName} = $vAttrVal[0];
  227. }
  228. }
  229. }
  230. } else {
  231. foreach ($attrMap as $kAttrName => $vFldName) {
  232. $vAttrVal = V::get($kAttrName, '', $attrs);
  233. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  234. if ($vAttrVal['count'] > 1) {
  235. $groupObj->{$vFldName} = array();
  236. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  237. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  238. }
  239. } else {
  240. $groupObj->{$vFldName} = $vAttrVal[0];
  241. }
  242. }
  243. }
  244. }
  245. if ($groupObj->cn && $groupObj->appleUID) {
  246. $allLdapGroups[$groupObj->appleUID] = $groupObj;
  247. } else {
  248. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Error: brak cn lub apple-generateduid (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r(array('attrs'=>$attrs, 'groupObj'=>$groupObj));echo'</pre>';
  249. }
  250. $entry = $ldap->next_entry($entry);
  251. }
  252. $ldap->free_result($res);
  253. return $allLdapGroups;
  254. }
  255. public static function getParentGroupsByAppleUID($appleUid, $allAttrs = false) {
  256. $allLdapGroups = array();
  257. if (!$appleUid) return $allLdapGroups;
  258. $attrMap = array('apple-generateduid'=>'appleUID', 'gidNumber'=>'gidNumber', 'cn'=>'cn');// (givenName, sn) = cn
  259. $attrMap['apple-group-realname'] = 'realName';
  260. $attrMap['apple-group-nestedgroup'] = 'nestedGroups';
  261. Lib::loadClass('LDAP');
  262. $ldap = LDAP::getInstance();
  263. $filters = array();
  264. $filter = "(&(objectClass=apple-group)(apple-group-nestedgroup={$appleUid}))";
  265. $attributes = array();
  266. $res = $ldap->search($filter, 'cn=groups', $attributes);
  267. $entry = $ldap->first_entry($res);
  268. while ($entry) {
  269. $attrs = $ldap->get_attributes($entry);
  270. $groupObj = new stdClass();
  271. if ($allAttrs) {
  272. for ($i = 0; $i < $attrs['count']; $i++) {
  273. $vAttrName = $attrs[$i];
  274. $vFldName = V::get($vAttrName, $vAttrName, $attrMap);
  275. $vAttrVal = $attrs[$vAttrName];
  276. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  277. if ($vAttrVal['count'] > 1) {
  278. $groupObj->{$vFldName} = array();
  279. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  280. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  281. }
  282. } else {
  283. $groupObj->{$vFldName} = $vAttrVal[0];
  284. }
  285. }
  286. }
  287. } else {
  288. foreach ($attrMap as $kAttrName => $vFldName) {
  289. $vAttrVal = V::get($kAttrName, '', $attrs);
  290. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  291. if ($vAttrVal['count'] > 1) {
  292. $groupObj->{$vFldName} = array();
  293. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  294. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  295. }
  296. } else {
  297. $groupObj->{$vFldName} = $vAttrVal[0];
  298. }
  299. }
  300. }
  301. }
  302. if ($groupObj->cn && $groupObj->appleUID) {
  303. $allLdapGroups[$groupObj->appleUID] = $groupObj;
  304. } else {
  305. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Error: brak cn lub apple-generateduid (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r(array('attrs'=>$attrs, 'groupObj'=>$groupObj));echo'</pre>';
  306. }
  307. $entry = $ldap->next_entry($entry);
  308. }
  309. $ldap->free_result($res);
  310. return $allLdapGroups;
  311. }
  312. public static function getGroupsByID($groupID, $allAttrs = false) {
  313. $allLdapGroups = array();
  314. $attrMap = array('apple-generateduid'=>'appleUID', 'gidNumber'=>'gidNumber', 'cn'=>'cn');// (givenName, sn) = cn
  315. $attrMap['apple-group-realname'] = 'realName';
  316. $attrMap['apple-group-nestedgroup'] = 'nestedGroups';
  317. Lib::loadClass('LDAP');
  318. $ldap = LDAP::getInstance();
  319. $filter = "(&(objectClass=apple-group)(|(cn={$groupID}-*)(cn={$groupID}_*)))";
  320. $attributes = array();
  321. $res = $ldap->search($filter, 'cn=groups', $attributes);
  322. $entry = $ldap->first_entry($res);
  323. while ($entry) {
  324. $attrs = $ldap->get_attributes($entry);
  325. $groupObj = new stdClass();
  326. if ($allAttrs) {
  327. for ($i = 0; $i < $attrs['count']; $i++) {
  328. $vAttrName = $attrs[$i];
  329. $vFldName = V::get($vAttrName, $vAttrName, $attrMap);
  330. $vAttrVal = $attrs[$vAttrName];
  331. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  332. if ($vAttrVal['count'] > 1) {
  333. $groupObj->{$vFldName} = array();
  334. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  335. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  336. }
  337. } else {
  338. $groupObj->{$vFldName} = $vAttrVal[0];
  339. }
  340. }
  341. }
  342. } else {
  343. foreach ($attrMap as $kAttrName => $vFldName) {
  344. $vAttrVal = V::get($kAttrName, '', $attrs);
  345. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  346. if ($vAttrVal['count'] > 1) {
  347. $groupObj->{$vFldName} = array();
  348. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  349. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  350. }
  351. } else {
  352. $groupObj->{$vFldName} = $vAttrVal[0];
  353. }
  354. }
  355. }
  356. }
  357. if ($groupObj->cn && $groupObj->appleUID) {
  358. $allLdapGroups[$groupObj->appleUID] = $groupObj;
  359. } else {
  360. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Error: brak cn lub apple-generateduid (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r(array('attrs'=>$attrs, 'groupObj'=>$groupObj));echo'</pre>';
  361. }
  362. $entry = $ldap->next_entry($entry);
  363. }
  364. $ldap->free_result($res);
  365. return $allLdapGroups;
  366. }
  367. public static function getGroupsAll($allAttrs = false) {
  368. $allLdapGroups = array();
  369. $attrMap = array('apple-generateduid'=>'appleUID', 'gidNumber'=>'gidNumber', 'cn'=>'cn');// (givenName, sn) = cn
  370. $attrMap['apple-group-realname'] = 'realName';
  371. $attrMap['apple-group-nestedgroup'] = 'nestedGroups';
  372. Lib::loadClass('LDAP');
  373. $ldap = LDAP::getInstance();
  374. $filter = "(objectClass=apple-group)";
  375. $attributes = array();
  376. $res = $ldap->search($filter, 'cn=groups', $attributes);
  377. $entry = $ldap->first_entry($res);
  378. while ($entry) {
  379. $attrs = $ldap->get_attributes($entry);
  380. $groupObj = new stdClass();
  381. if ($allAttrs) {
  382. for ($i = 0; $i < $attrs['count']; $i++) {
  383. $vAttrName = $attrs[$i];
  384. $vFldName = V::get($vAttrName, $vAttrName, $attrMap);
  385. $vAttrVal = $attrs[$vAttrName];
  386. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  387. if ($vAttrVal['count'] > 1) {
  388. $groupObj->{$vFldName} = array();
  389. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  390. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  391. }
  392. } else {
  393. $groupObj->{$vFldName} = $vAttrVal[0];
  394. }
  395. }
  396. }
  397. } else {
  398. foreach ($attrMap as $kAttrName => $vFldName) {
  399. $vAttrVal = V::get($kAttrName, '', $attrs);
  400. if (is_array($vAttrVal) && !empty($vAttrVal)) {
  401. if ($vAttrVal['count'] > 1) {
  402. $groupObj->{$vFldName} = array();
  403. for ($j = 0; $j < $vAttrVal['count']; $j++) {
  404. $groupObj->{$vFldName}[] = $vAttrVal[$j];
  405. }
  406. } else {
  407. $groupObj->{$vFldName} = $vAttrVal[0];
  408. }
  409. }
  410. }
  411. }
  412. if ($groupObj->cn && $groupObj->appleUID) {
  413. $allLdapGroups[$groupObj->appleUID] = $groupObj;
  414. } else {
  415. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">Error: brak cn lub apple-generateduid (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r(array('attrs'=>$attrs, 'groupObj'=>$groupObj));echo'</pre>';
  416. }
  417. $entry = $ldap->next_entry($entry);
  418. }
  419. $ldap->free_result($res);
  420. return $allLdapGroups;
  421. }
  422. }