public function FeedsDrupalUserLdapEntryFetcherResult::getRaw in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc \FeedsDrupalUserLdapEntryFetcherResult::getRaw()
- 7.2 ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc \FeedsDrupalUserLdapEntryFetcherResult::getRaw()
Overrides parent::getRaw();
Overrides FeedsFetcherResult::getRaw
1 call to FeedsDrupalUserLdapEntryFetcherResult::getRaw()
- FeedsDrupalUserLdapEntryFetcherResult::__construct in ldap_feeds/
FeedsDrupalUserLdapEntryFetcher.inc - Constructor.
File
- ldap_feeds/
FeedsDrupalUserLdapEntryFetcher.inc, line 33 - FeedsDrupalUserLdapEntryFetcher
Class
Code
public function getRaw() {
// needs to loop through all users, and query ldap for each, one at a time
$query = new EntityFieldQuery();
$entities = $query
->entityCondition('entity_type', 'user')
->execute();
$users = entity_load('user', array_keys($entities['user']));
$selectedRoles = array_filter($this->filterRoles);
$filterOnRoles = (bool) count($selectedRoles);
foreach ($users as $uid => $user) {
if ($uid == 0 || $uid == 1 || $this->filterLdapAuthenticated && !isset($user->data['ldap_authentication']) || $filterOnRoles && !array_intersect(array_values($selectedRoles), array_keys($user->roles))) {
continue;
}
if ($ldap_entry = ldap_servers_get_user_ldap_data($user)) {
unset($ldap_entry['mail']);
$ldap_entry['attr']['count'] = $ldap_entry['attr']['count'] + count($this->availableDrupalUserAttributes);
foreach ($this->availableDrupalUserAttributes as $attr_name => $attr_conf) {
$ldap_entry['attr'][] = $attr_conf['token'];
$ldap_entry['attr'][$attr_conf['token']]['count'] = 1;
$ldap_entry['attr'][$attr_conf['token']][0] = (string) $user->{$attr_name};
}
$results[] = $ldap_entry;
}
}
$results['count'] = count($results);
// drupal_set_message("<pre>" . print_r($results, TRUE));
return $results;
}