| | |
| | | if (empty($entry[$attr])) |
| | | return $group_members; |
| | | |
| | | // add group record to cache if it isn't yet there |
| | | $group_id = self::dn_encode($dn); |
| | | $group_cache = $this->cache->get('groups'); |
| | | if (!$group_cache[$group_id]) { |
| | | $name_attr = $this->prop['groups']['name_attr']; |
| | | $group_name = is_array($ldap_data[$i][$name_attr]) ? $ldap_data[$i][$name_attr][0] : $ldap_data[$i][$name_attr]; |
| | | |
| | | $group_cache[$group_id]['ID'] = $group_id; |
| | | $group_cache[$group_id]['dn'] = $dn; |
| | | $group_cache[$group_id]['name'] = $group_name; |
| | | $group_cache[$group_id]['member_attr'] = $this->get_group_member_attr($entry[$i]['objectclass']); |
| | | |
| | | $this->cache->set('groups', $group_cache); |
| | | } |
| | | |
| | | // read these attributes for all members |
| | | $attrib = $count ? array('dn') : array_values($this->fieldmap); |
| | | $attrib[] = 'objectClass'; |
| | |
| | | $attrib[] = 'uniqueMember'; |
| | | $attrib[] = 'memberURL'; |
| | | |
| | | $filter = $this->prop['groups']['member_filter'] ? $this->prop['groups']['member_filter'] : '(objectclass=*)'; |
| | | |
| | | for ($i=0; $i < $entry[$attr]['count']; $i++) |
| | | { |
| | | if (empty($entry[$attr][$i])) |
| | | continue; |
| | | |
| | | $result = @ldap_read($this->conn, $entry[$attr][$i], '(objectclass=*)', |
| | | $result = @ldap_read($this->conn, $entry[$attr][$i], $filter, |
| | | $attrib, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit']); |
| | | |
| | | $members = @ldap_get_entries($this->conn, $result); |
| | |
| | | */ |
| | | private function _ldap2result($rec) |
| | | { |
| | | $out = array(); |
| | | $out = array('_type' => 'person'); |
| | | |
| | | if ($rec['dn']) |
| | | $out[$this->primary_key] = self::dn_encode($rec['dn']); |
| | | |
| | | // determine record type |
| | | if (array_intersect(array('groupofuniquenames','kolabgroupofuniquenames'), (array)$rec['objectclass'])) { |
| | | $out['_type'] = 'group'; |
| | | $out['readonly'] = true; |
| | | if ($this->fieldmap['groupname']) { |
| | | $this->fieldmap['name'] = $this->fieldmap['groupname']; |
| | | } |
| | | } |
| | | |
| | | foreach ($this->fieldmap as $rf => $lf) |
| | | { |
| | |
| | | for ($i=0; $i < $group_count; $i++) |
| | | { |
| | | $group_name = is_array($ldap_data[$i][$name_attr]) ? $ldap_data[$i][$name_attr][0] : $ldap_data[$i][$name_attr]; |
| | | $group_id = self::dn_encode($group_name); |
| | | $group_id = self::dn_encode($ldap_data[$i]['dn']); |
| | | $groups[$group_id]['ID'] = $group_id; |
| | | $groups[$group_id]['dn'] = $ldap_data[$i]['dn']; |
| | | $groups[$group_id]['name'] = $group_name; |