ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLDAPQuery Class Reference
+ Collaboration diagram for ilLDAPQuery:

Public Member Functions

 __construct (ilLDAPServer $a_server, $a_url='')
 Constructur. More...
 
 getServer ()
 Get server. More...
 
 getLogger ()
 Get logger. More...
 
 fetchUser ($a_name)
 Get one user by login name. More...
 
 fetchUsers ()
 Fetch all users. More...
 
 query ($a_search_base, $a_filter, $a_scope, $a_attributes)
 Perform a query. More...
 
 modAdd ($a_dn, $a_attribute)
 Add value to an existing attribute. More...
 
 modDelete ($a_dn, $a_attribute)
 Delete value from an existing attribute. More...
 
 checkGroupMembership ($a_ldap_user_name, $ldap_user_data)
 check group membership More...
 
 bind ($a_binding_type=IL_LDAP_BIND_DEFAULT, $a_user_dn='', $a_password='')
 Bind to LDAP server. More...
 
 __destruct ()
 Destructor unbind from ldap server. More...
 

Private Member Functions

 readAllUsers ()
 Fetch all users This function splits the query to filters like e.g (uid=a*) (uid=b*)... This avoids AD page_size_limit. More...
 
 fetchGroupMembers ($a_name='')
 Fetch group member ids. More...
 
 readUserData ($a_name, $a_check_dn=false, $a_try_group_user_filter=false)
 Read user data. More...
 
 parseAuthMode ()
 Parse authentication mode. More...
 
 queryByScope ($a_scope, $a_base_dn, $a_filter, $a_attributes)
 Query by scope IL_SCOPE_SUB => ldap_search IL_SCOPE_ONE => ldap_list. More...
 
 connect ()
 Connect to LDAP server. More...
 
 fetchUserProfileFields ()
 fetch required fields of user profile data More...
 
 unbind ()
 Unbind. More...
 

Private Attributes

 $ldap_server_url = null
 
 $settings = null
 
 $log = null
 
 $user_fields = array()
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_Calls

Definition at line 42 of file class.ilLDAPQuery.php.

Constructor & Destructor Documentation

◆ __construct()

ilLDAPQuery::__construct ( ilLDAPServer  $a_server,
  $a_url = '' 
)

Constructur.

@access private

Parameters
objectilLDAPServer or subclass
Exceptions
ilLDAPQueryException

Definition at line 62 of file class.ilLDAPQuery.php.

63 {
64 $this->settings = $a_server;
65
66 if (strlen($a_url)) {
67 $this->ldap_server_url = $a_url;
68 } else {
69 $this->ldap_server_url = $this->settings->getUrl();
70 }
71
72 $this->mapping = ilLDAPAttributeMapping::_getInstanceByServerId($this->settings->getServerId());
73 $this->log = $GLOBALS['DIC']->logger()->auth();
74
76 $this->connect();
77 }
static _getInstanceByServerId($a_server_id)
Get instance of class.
fetchUserProfileFields()
fetch required fields of user profile data
connect()
Connect to LDAP server.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
settings()
Definition: settings.php:2

References $GLOBALS, ilLDAPAttributeMapping\_getInstanceByServerId(), connect(), fetchUserProfileFields(), and settings().

+ Here is the call graph for this function:

◆ __destruct()

ilLDAPQuery::__destruct ( )

Destructor unbind from ldap server.

@access private

Parameters

Definition at line 667 of file class.ilLDAPQuery.php.

668 {
669 if ($this->lh) {
670 @ldap_unbind($this->lh);
671 }
672 }

Member Function Documentation

◆ bind()

ilLDAPQuery::bind (   $a_binding_type = IL_LDAP_BIND_DEFAULT,
  $a_user_dn = '',
  $a_password = '' 
)

Bind to LDAP server.

@access public

Parameters
intbinding_type IL_LDAP_BIND_DEFAULT || IL_LDAP_BIND_ADMIN
Exceptions
ilLDAPQueryExceptionon connection failure.

Definition at line 569 of file class.ilLDAPQuery.php.

570 {
571 switch ($a_binding_type) {
573 ldap_set_option($this->lh, LDAP_OPT_NETWORK_TIMEOUT, ilLDAPServer::DEFAULT_NETWORK_TIMEOUT);
574 // fall through
575 // no break
577 // Now bind anonymously or as user
578 if (
579 IL_LDAP_BIND_USER == $this->settings->getBindingType() &&
580 strlen($this->settings->getBindUser())
581 ) {
582 $user = $this->settings->getBindUser();
583 $pass = $this->settings->getBindPassword();
584
585 define('IL_LDAP_REBIND_USER', $user);
586 define('IL_LDAP_REBIND_PASS', $pass);
587 $this->log->debug('Bind as ' . $user);
588 } else {
589 $user = $pass = '';
590 $this->log->debug('Bind anonymous');
591 }
592 break;
593
595 $user = $this->settings->getRoleBindDN();
596 $pass = $this->settings->getRoleBindPassword();
597
598 if (!strlen($user) or !strlen($pass)) {
599 $user = $this->settings->getBindUser();
600 $pass = $this->settings->getBindPassword();
601 }
602
603 define('IL_LDAP_REBIND_USER', $user);
604 define('IL_LDAP_REBIND_PASS', $pass);
605 break;
606
608 $this->log->debug('Trying to bind as: ' . $a_user_dn);
609 $user = $a_user_dn;
610 $pass = $a_password;
611 break;
612
613
614 default:
615 throw new ilLDAPQueryException('LDAP: unknown binding type in: ' . __METHOD__);
616 }
617
618 if (!@ldap_bind($this->lh, $user, $pass)) {
619 throw new ilLDAPQueryException('LDAP: Cannot bind as ' . $user . ' with message: ' . ldap_err2str(ldap_errno($this->lh)) . ' Trying fallback...', ldap_errno($this->lh));
620 } else {
621 $this->log->debug('Bind successful.');
622 }
623 }
const IL_LDAP_BIND_AUTH
const IL_LDAP_BIND_DEFAULT
const IL_LDAP_BIND_ADMIN
const IL_LDAP_BIND_TEST
const IL_LDAP_BIND_USER
const DEFAULT_NETWORK_TIMEOUT
$user
Definition: migrateto20.php:57

References $pass, $user, ilLDAPServer\DEFAULT_NETWORK_TIMEOUT, IL_LDAP_BIND_ADMIN, IL_LDAP_BIND_AUTH, IL_LDAP_BIND_DEFAULT, IL_LDAP_BIND_TEST, IL_LDAP_BIND_USER, and settings().

+ Here is the call graph for this function:

◆ checkGroupMembership()

ilLDAPQuery::checkGroupMembership (   $a_ldap_user_name,
  $ldap_user_data 
)

check group membership

Parameters
stringlogin name
arrayuser data
Returns
bool

Definition at line 272 of file class.ilLDAPQuery.php.

273 {
274 $group_names = $this->getServer()->getGroupNames();
275
276 if (!count($group_names)) {
277 $this->getLogger()->debug('No LDAP group restrictions found');
278 return true;
279 }
280
281 $group_dn = $this->getServer()->getGroupDN();
282 if (
283 $group_dn &&
284 (substr($group_dn, -1) != ',')
285 ) {
286 $group_dn .= ',';
287 }
288 $group_dn .= $this->getServer()->getBaseDN();
289
290 foreach ($group_names as $group) {
291 $user = $a_ldap_user_name;
292 if ($this->getServer()->enabledGroupMemberIsDN()) {
293 if ($this->getServer()->enabledEscapeDN()) {
294 $user = ldap_escape($ldap_user_data['dn'], "", LDAP_ESCAPE_FILTER);
295 } else {
296 $user = $ldap_user_data['dn'];
297 }
298 }
299
300 $filter = sprintf(
301 '(&(%s=%s)(%s=%s)%s)',
302 $this->getServer()->getGroupAttribute(),
303 $group,
304 $this->getServer()->getGroupMember(),
305 $user,
306 $this->getServer()->getGroupFilter()
307 );
308 $this->getLogger()->debug('Current group search base: ' . $group_dn);
309 $this->getLogger()->debug('Current group filter: ' . $filter);
310
311 $res = $this->queryByScope(
312 $this->getServer()->getGroupScope(),
313 $group_dn,
314 $filter,
315 [$this->getServer()->getGroupMember()]
316 );
317
318 $this->getLogger()->dump($res);
319
320 $tmp_result = new ilLDAPResult($this->lh, $res);
321 $group_result = $tmp_result->getRows();
322
323 $this->getLogger()->debug('Group query returned: ');
324 $this->getLogger()->dump($group_result, ilLogLevel::DEBUG);
325
326 if (count($group_result)) {
327 return true;
328 }
329 }
330
331 // group restrictions failed check optional membership
332 if ($this->getServer()->isMembershipOptional()) {
333 $this->getLogger()->debug('Group restrictions failed, checking user filter.');
334 if ($this->readUserData($a_ldap_user_name, true, true)) {
335 $this->getLogger()->debug('User filter matches.');
336 return true;
337 }
338 }
339 $this->getLogger()->debug('Group restrictions failed.');
340 return false;
341 }
queryByScope($a_scope, $a_base_dn, $a_filter, $a_attributes)
Query by scope IL_SCOPE_SUB => ldap_search IL_SCOPE_ONE => ldap_list.
getServer()
Get server.
readUserData($a_name, $a_check_dn=false, $a_try_group_user_filter=false)
Read user data.
getLogger()
Get logger.
foreach($_POST as $key=> $value) $res

References $res, $user, ilLogLevel\DEBUG, getLogger(), getServer(), queryByScope(), and readUserData().

+ Here is the call graph for this function:

◆ connect()

ilLDAPQuery::connect ( )
private

Connect to LDAP server.

@access private

Exceptions
ilLDAPQueryException

Definition at line 531 of file class.ilLDAPQuery.php.

532 {
533 $this->lh = @ldap_connect($this->ldap_server_url);
534
535 // LDAP Connect
536 if (!$this->lh) {
537 throw new ilLDAPQueryException("LDAP: Cannot connect to LDAP Server: " . $this->settings->getUrl());
538 }
539 // LDAP Version
540 if (!ldap_set_option($this->lh, LDAP_OPT_PROTOCOL_VERSION, $this->settings->getVersion())) {
541 throw new ilLDAPQueryException("LDAP: Cannot set version to: " . $this->settings->getVersion());
542 }
543 // Switch on referrals
544 if ($this->settings->isActiveReferrer()) {
545 if (!ldap_set_option($this->lh, LDAP_OPT_REFERRALS, true)) {
546 throw new ilLDAPQueryException("LDAP: Cannot switch on LDAP referrals");
547 }
548 #@ldap_set_rebind_proc($this->lh,'referralRebind');
549 } else {
550 ldap_set_option($this->lh, LDAP_OPT_REFERRALS, false);
551 $this->log->debug('Switching referrals to false.');
552 }
553 // Start TLS
554 if ($this->settings->isActiveTLS()) {
555 if (!ldap_start_tls($this->lh)) {
556 throw new ilLDAPQueryException("LDAP: Cannot start LDAP TLS");
557 }
558 }
559 }

References settings().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchGroupMembers()

ilLDAPQuery::fetchGroupMembers (   $a_name = '')
private

Fetch group member ids.

@access public

Definition at line 350 of file class.ilLDAPQuery.php.

351 {
352 $group_name = strlen($a_name) ? $a_name : $this->settings->getGroupName();
353
354 // Build filter
355 $filter = sprintf(
356 '(&(%s=%s)%s)',
357 $this->settings->getGroupAttribute(),
358 $group_name,
359 $this->settings->getGroupFilter()
360 );
361
362
363 // Build search base
364 if (($gdn = $this->settings->getGroupDN()) && substr($gdn, -1) != ',') {
365 $gdn .= ',';
366 }
367 $gdn .= $this->settings->getBaseDN();
368
369 $this->log->debug('Using filter ' . $filter);
370 $this->log->debug('Using DN ' . $gdn);
371 $res = $this->queryByScope(
372 $this->settings->getGroupScope(),
373 $gdn,
374 $filter,
375 array($this->settings->getGroupMember())
376 );
377
378 $tmp_result = new ilLDAPResult($this->lh, $res);
379 $group_data = $tmp_result->getRows();
380
381
382 if (!$tmp_result->numRows()) {
383 $this->log->info('No group found.');
384 return false;
385 }
386
387 $attribute_name = strtolower($this->settings->getGroupMember());
388
389 // All groups
390 foreach ($group_data as $data) {
391 if (is_array($data[$attribute_name])) {
392 $this->log->debug('Found ' . count($data[$attribute_name]) . ' group members for group ' . $data['dn']);
393 foreach ($data[$attribute_name] as $name) {
394 $this->readUserData($name, true, true);
395 }
396 } else {
397 $this->readUserData($data[$attribute_name], true, true);
398 }
399 }
400 unset($tmp_result);
401 return;
402 }
$data
Definition: bench.php:6

References $data, $name, $res, queryByScope(), readUserData(), and settings().

Referenced by fetchUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchUser()

ilLDAPQuery::fetchUser (   $a_name)

Get one user by login name.

@access public

Parameters
stringlogin name
Returns
array of user data

Definition at line 105 of file class.ilLDAPQuery.php.

106 {
107 if (!$this->readUserData($a_name)) {
108 return array();
109 } else {
110 return $this->users;
111 }
112 }
$users
Definition: authpage.php:44

References $users, and readUserData().

+ Here is the call graph for this function:

◆ fetchUserProfileFields()

ilLDAPQuery::fetchUserProfileFields ( )
private

fetch required fields of user profile data

@access private

Parameters

Definition at line 632 of file class.ilLDAPQuery.php.

633 {
634 include_once('Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php');
635
636 $this->user_fields = array_merge(
637 array($this->settings->getUserAttribute()),
638 array('dn'),
639 $this->mapping->getFields(),
640 ilLDAPRoleAssignmentRules::getAttributeNames($this->getServer()->getServerId())
641 );
642 }
static getAttributeNames($a_server_id)
get all possible attribute names

References ilLDAPRoleAssignmentRules\getAttributeNames(), and settings().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchUsers()

ilLDAPQuery::fetchUsers ( )

Fetch all users.

@access public

Returns
array array of user data

Definition at line 121 of file class.ilLDAPQuery.php.

122 {
123 // First of all check if a group restriction is enabled
124 // YES: => fetch all group members
125 // No: => fetch all users
126 if (strlen($this->settings->getGroupName())) {
127 $this->log->debug('Searching for group members.');
128
129 $groups = $this->settings->getGroupNames();
130 if (count($groups) <= 1) {
131 $this->fetchGroupMembers();
132 } else {
133 foreach ($groups as $group) {
134 $this->fetchGroupMembers($group);
135 }
136 }
137 }
138 if (!strlen($this->settings->getGroupName()) or $this->settings->isMembershipOptional()) {
139 $this->log->info('Start reading all users...');
140 $this->readAllUsers();
141 #throw new ilLDAPQueryException('LDAP: Called import of users without specifying group restrictions. NOT IMPLEMENTED YET!');
142 }
143 return $this->users ? $this->users : array();
144 }
fetchGroupMembers($a_name='')
Fetch group member ids.
readAllUsers()
Fetch all users This function splits the query to filters like e.g (uid=a*) (uid=b*)....

References fetchGroupMembers(), readAllUsers(), and settings().

+ Here is the call graph for this function:

◆ getLogger()

ilLDAPQuery::getLogger ( )

Get logger.

Returns
ilLogger

Definition at line 93 of file class.ilLDAPQuery.php.

94 {
95 return $this->log;
96 }

References $log.

Referenced by checkGroupMembership(), and queryByScope().

+ Here is the caller graph for this function:

◆ getServer()

ilLDAPQuery::getServer ( )

Get server.

Returns
ilLDAPServer

Definition at line 84 of file class.ilLDAPQuery.php.

85 {
86 return $this->settings;
87 }

References $settings.

Referenced by checkGroupMembership().

+ Here is the caller graph for this function:

◆ modAdd()

ilLDAPQuery::modAdd (   $a_dn,
  $a_attribute 
)

Add value to an existing attribute.

@access public

Exceptions
ilLDAPQueryException

Definition at line 178 of file class.ilLDAPQuery.php.

179 {
180 if (@ldap_mod_add($this->lh, $a_dn, $a_attribute)) {
181 return true;
182 }
183 throw new ilLDAPQueryException(__METHOD__ . ' ' . ldap_error($this->lh));
184 }

◆ modDelete()

ilLDAPQuery::modDelete (   $a_dn,
  $a_attribute 
)

Delete value from an existing attribute.

@access public

Exceptions
ilLDAPQueryException

Definition at line 192 of file class.ilLDAPQuery.php.

193 {
194 if (@ldap_mod_del($this->lh, $a_dn, $a_attribute)) {
195 return true;
196 }
197 throw new ilLDAPQueryException(__METHOD__ . ' ' . ldap_error($this->lh));
198 }

◆ parseAuthMode()

ilLDAPQuery::parseAuthMode ( )
private

Parse authentication mode.

Returns
string auth mode

Definition at line 478 of file class.ilLDAPQuery.php.

479 {
480 return $this->settings->getAuthenticationMappingKey();
481 }

References settings().

+ Here is the call graph for this function:

◆ query()

ilLDAPQuery::query (   $a_search_base,
  $a_filter,
  $a_scope,
  $a_attributes 
)

Perform a query.

@access public

Parameters
stringsearch base
stringfilter
intscope
arrayattributes
Returns
object ilLDAPResult
Exceptions
ilLDAPQueryException

Definition at line 157 of file class.ilLDAPQuery.php.

158 {
159 $res = $this->queryByScope($a_scope, $a_search_base, $a_filter, $a_attributes);
160 if ($res === false) {
161 throw new ilLDAPQueryException(__METHOD__ . ' ' . ldap_error($this->lh) . ' ' .
162 sprintf(
163 'DN: %s, Filter: %s, Scope: %s',
164 $a_search_base,
165 $a_filter,
166 $a_scope
167 ));
168 }
169 return new ilLDAPResult($this->lh, $res);
170 }

References $res, and queryByScope().

+ Here is the call graph for this function:

◆ queryByScope()

ilLDAPQuery::queryByScope (   $a_scope,
  $a_base_dn,
  $a_filter,
  $a_attributes 
)
private

Query by scope IL_SCOPE_SUB => ldap_search IL_SCOPE_ONE => ldap_list.

@access private

Parameters

Definition at line 492 of file class.ilLDAPQuery.php.

493 {
494 $a_filter = $a_filter ? $a_filter : "(objectclass=*)";
495
496 switch ($a_scope) {
498 $res = @ldap_search($this->lh, $a_base_dn, $a_filter, $a_attributes);
499 break;
500
502 $res = @ldap_list($this->lh, $a_base_dn, $a_filter, $a_attributes);
503 break;
504
506
507 $res = @ldap_read($this->lh, $a_base_dn, $a_filter, $a_attributes);
508 break;
509
510 default:
511 $this->log->warning("LDAP: LDAPQuery: Unknown search scope");
512 }
513
514 $error = ldap_error($this->lh);
515 if (strcmp('Success', $error) !== 0) {
516 $this->getLogger()->warning($error);
517 $this->getLogger()->warning('Base DN:' . $a_base_dn);
518 $this->getLogger()->warning('Filter: ' . $a_filter);
519 }
520
521 return $res;
522 }
const IL_LDAP_SCOPE_BASE
const IL_LDAP_SCOPE_SUB
const IL_LDAP_SCOPE_ONE

References $res, getLogger(), IL_LDAP_SCOPE_BASE, IL_LDAP_SCOPE_ONE, and IL_LDAP_SCOPE_SUB.

Referenced by checkGroupMembership(), fetchGroupMembers(), query(), readAllUsers(), and readUserData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readAllUsers()

ilLDAPQuery::readAllUsers ( )
private

Fetch all users This function splits the query to filters like e.g (uid=a*) (uid=b*)... This avoids AD page_size_limit.

@access public

Definition at line 208 of file class.ilLDAPQuery.php.

209 {
210 // Build search base
211 if (($dn = $this->settings->getSearchBase()) && substr($dn, -1) != ',') {
212 $dn .= ',';
213 }
214 $dn .= $this->settings->getBaseDN();
215
216 // page results
217 $filter = $this->settings->getFilter();
218 $page_filter = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','-');
219 $chars = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
220
221 foreach ($page_filter as $letter) {
222 $new_filter = '(&';
223 $new_filter .= $filter;
224
225 switch ($letter) {
226 case '-':
227 $new_filter .= ('(!(|');
228 foreach ($chars as $char) {
229 $new_filter .= ('(' . $this->settings->getUserAttribute() . '=' . $char . '*)');
230 }
231 $new_filter .= ')))';
232 break;
233
234 default:
235 $new_filter .= ('(' . $this->settings->getUserAttribute() . '=' . $letter . '*))');
236 break;
237 }
238
239 $this->log->info('Searching with ldap search and filter ' . $new_filter . ' in ' . $dn);
240 $res = $this->queryByScope(
241 $this->settings->getUserScope(),
242 $dn,
243 $new_filter,
244 array($this->settings->getUserAttribute())
245 );
246
247 $tmp_result = new ilLDAPResult($this->lh, $res);
248 if (!$tmp_result->numRows()) {
249 $this->log->notice('No users found. Aborting.');
250 continue;
251 }
252 $this->log->info('Found ' . $tmp_result->numRows() . ' users.');
253 $attribute = strtolower($this->settings->getUserAttribute());
254 foreach ($tmp_result->getRows() as $data) {
255 if (isset($data[$attribute])) {
256 $this->readUserData($data[$attribute], false, false);
257 } else {
258 $this->log->warning('Unknown error. No user attribute found.');
259 }
260 }
261 unset($tmp_result);
262 }
263 return true;
264 }

References $data, $res, queryByScope(), readUserData(), and settings().

Referenced by fetchUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readUserData()

ilLDAPQuery::readUserData (   $a_name,
  $a_check_dn = false,
  $a_try_group_user_filter = false 
)
private

Read user data.

Parameters
boolcheck dn
booluse group filter @access private

Definition at line 410 of file class.ilLDAPQuery.php.

411 {
412 $filter = $this->settings->getFilter();
413 if ($a_try_group_user_filter) {
414 if ($this->settings->isMembershipOptional()) {
415 $filter = $this->settings->getGroupUserFilter();
416 }
417 }
418
419 // Build filter
420 if ($this->settings->enabledGroupMemberIsDN() and $a_check_dn) {
421 $dn = $a_name;
422 #$res = $this->queryByScope(IL_LDAP_SCOPE_BASE,$dn,$filter,$this->user_fields);
423
424 $fields = array_merge($this->user_fields, array('useraccountcontrol'));
425 $res = $this->queryByScope(IL_LDAP_SCOPE_BASE, strtolower($dn), $filter, $fields);
426 } else {
427 $filter = sprintf(
428 '(&(%s=%s)%s)',
429 $this->settings->getUserAttribute(),
430 $a_name,
431 $filter
432 );
433
434 // Build search base
435 if (($dn = $this->settings->getSearchBase()) && substr($dn, -1) != ',') {
436 $dn .= ',';
437 }
438 $dn .= $this->settings->getBaseDN();
439 $fields = array_merge($this->user_fields, array('useraccountcontrol'));
440 $res = $this->queryByScope($this->settings->getUserScope(), strtolower($dn), $filter, $fields);
441 }
442
443
444 $tmp_result = new ilLDAPResult($this->lh, $res);
445 if (!$tmp_result->numRows()) {
446 $this->log->info('LDAP: No user data found for: ' . $a_name);
447 unset($tmp_result);
448 return false;
449 }
450
451 if ($user_data = $tmp_result->get()) {
452 if (isset($user_data['useraccountcontrol'])) {
453 if (($user_data['useraccountcontrol'] & 0x02)) {
454 $this->log->notice('LDAP: ' . $a_name . ' account disabled.');
455 return;
456 }
457 }
458
459 $account = $user_data[strtolower($this->settings->getUserAttribute())];
460 if (is_array($account)) {
461 $user_ext = strtolower(array_shift($account));
462 } else {
463 $user_ext = strtolower($account);
464 }
465
466 // auth mode depends on ldap server settings
467 $auth_mode = $this->settings->getAuthenticationMappingKey();
468 $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount($auth_mode, $user_ext);
469 $this->users[$user_ext] = $user_data;
470 }
471 return true;
472 }
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user

References $res, ilObjUser\_checkExternalAuthAccount(), IL_LDAP_SCOPE_BASE, queryByScope(), and settings().

Referenced by checkGroupMembership(), fetchGroupMembers(), fetchUser(), and readAllUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unbind()

ilLDAPQuery::unbind ( )
private

Unbind.

@access private

Parameters

Definition at line 652 of file class.ilLDAPQuery.php.

653 {
654 if ($this->lh) {
655 @ldap_unbind($this->lh);
656 }
657 }

Field Documentation

◆ $ldap_server_url

ilLDAPQuery::$ldap_server_url = null
private

Definition at line 44 of file class.ilLDAPQuery.php.

◆ $log

ilLDAPQuery::$log = null
private

Definition at line 50 of file class.ilLDAPQuery.php.

Referenced by getLogger().

◆ $settings

ilLDAPQuery::$settings = null
private

Definition at line 45 of file class.ilLDAPQuery.php.

Referenced by getServer().

◆ $user_fields

ilLDAPQuery::$user_fields = array()
private

Definition at line 52 of file class.ilLDAPQuery.php.


The documentation for this class was generated from the following file: