public function FeedsDrupalUserLdapEntryFetcherResult::getRaw in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_feeds/FeedsDrupalUserLdapEntryFetcher.inc \FeedsDrupalUserLdapEntryFetcherResult::getRaw()
- 7 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 35 - 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']));
if ($this->filterRoles) {
$selectedRoles = array_filter($this->filterRoles);
$filterOnRoles = (bool) count($selectedRoles);
}
else {
$filterOnRoles = FALSE;
}
foreach ($users as $uid => $user) {
if ($uid == 0 || $uid == 1 || $this->filterLdapAuthenticated && !isset($user->data['ldap_user']) || $filterOnRoles && !array_intersect(array_values($selectedRoles), array_keys($user->roles))) {
continue;
}
if ($ldap_user = ldap_servers_get_user_ldap_data($user)) {
unset($ldap_user['mail']);
$ldap_user['attr']['count'] = $ldap_user['attr']['count'] + count($this->availableDrupalUserAttributes);
foreach ($this->availableDrupalUserAttributes as $attr_name => $attr_conf) {
$ldap_user['attr'][] = $attr_conf['token'];
$ldap_user['attr'][$attr_conf['token']]['count'] = 1;
$ldap_user['attr'][$attr_conf['token']][0] = (string) $user->{$attr_name};
}
$results[] = $ldap_user;
}
}
$results['count'] = count($results);
return $results;
}