Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php |
— | — | @@ -280,9 +280,8 @@ |
281 | 281 | global $wgLDAPServerNames; |
282 | 282 | if ( isset( $wgLDAPServerNames[$domain] ) ) { |
283 | 283 | return $wgLDAPServerNames[$domain]; |
284 | | - } else { |
285 | | - return array(); |
286 | 284 | } |
| 285 | + return array(); |
287 | 286 | case 'UseLocal': |
288 | 287 | global $wgLDAPUseLocal; |
289 | 288 | return $wgLDAPUseLocal; |
— | — | @@ -290,112 +289,86 @@ |
291 | 290 | global $wgLDAPEncryptionType; |
292 | 291 | if ( isset( $wgLDAPEncryptionType[$domain] ) ) { |
293 | 292 | return $wgLDAPEncryptionType[$domain]; |
294 | | - } else { |
295 | | - return 'tls'; |
296 | 293 | } |
| 294 | + return 'tls'; |
297 | 295 | case 'Options': |
298 | 296 | global $wgLDAPOptions; |
299 | 297 | if ( isset( $wgLDAPOptions[$domain] ) ) { |
300 | 298 | return $wgLDAPOptions[$domain]; |
301 | | - } else { |
302 | | - return array(); |
303 | 299 | } |
| 300 | + return array(); |
304 | 301 | case 'Port': |
305 | 302 | global $wgLDAPPort; |
306 | 303 | if ( isset( $wgLDAPPort[$domain] ) ) { |
307 | 304 | $this->printDebug( "Using non-standard port: " . $wgLDAPPort[$domain], SENSITIVE ); |
308 | 305 | return (string)$wgLDAPPort[$domain]; |
| 306 | + } elseif ( $this->getConf( 'EncryptionType' ) == 'ssl' ) { |
| 307 | + return "636"; |
309 | 308 | } else { |
310 | | - if ( $this->getConf( 'EncryptionType' ) == 'ssl' ) { |
311 | | - return "636"; |
312 | | - } else { |
313 | | - return "389"; |
314 | | - } |
| 309 | + return "389"; |
315 | 310 | } |
316 | 311 | case 'SearchString': |
317 | 312 | global $wgLDAPSearchStrings; |
318 | 313 | if ( isset( $wgLDAPSearchStrings[$domain] ) ) { |
319 | 314 | return $wgLDAPSearchStrings[$domain]; |
320 | | - } else { |
321 | | - return ''; |
322 | 315 | } |
323 | 316 | case 'ProxyAgent': |
324 | 317 | global $wgLDAPProxyAgent; |
325 | 318 | if ( isset( $wgLDAPProxyAgent[$domain] ) ) { |
326 | 319 | return $wgLDAPProxyAgent[$domain]; |
327 | | - } else { |
328 | | - return ''; |
329 | 320 | } |
330 | 321 | case 'ProxyAgentPassword': |
331 | 322 | global $wgLDAPProxyAgentPassword; |
332 | 323 | if ( isset( $wgLDAPProxyAgentPassword[$domain] ) ) { |
333 | 324 | return $wgLDAPProxyAgentPassword[$domain]; |
334 | | - } else { |
335 | | - return ''; |
336 | 325 | } |
337 | 326 | case 'SearchAttribute': |
338 | 327 | global $wgLDAPSearchAttributes; |
339 | 328 | if ( isset( $wgLDAPSearchAttributes[$domain] ) ) { |
340 | 329 | return $wgLDAPSearchAttributes[$domain]; |
341 | | - } else { |
342 | | - return ''; |
343 | 330 | } |
344 | 331 | case 'BaseDN': |
345 | 332 | global $wgLDAPBaseDNs; |
346 | 333 | if ( isset( $wgLDAPBaseDNs[$domain] ) ) { |
347 | 334 | return $wgLDAPBaseDNs[$domain]; |
348 | | - } else { |
349 | | - return ''; |
350 | 335 | } |
351 | 336 | case 'GroupBaseDN': |
352 | 337 | global $wgLDAPGroupBaseDNs; |
353 | 338 | if ( isset( $wgLDAPGroupBaseDNs[$domain] ) ) { |
354 | 339 | return $wgLDAPGroupBaseDNs[$domain]; |
355 | | - } else { |
356 | | - return ''; |
357 | 340 | } |
358 | 341 | case 'UserBaseDN': |
359 | 342 | global $wgLDAPUserBaseDNs; |
360 | 343 | if ( isset( $wgLDAPUserBaseDNs[$domain] ) ) { |
361 | 344 | return $wgLDAPUserBaseDNs[$domain]; |
362 | | - } else { |
363 | | - return ''; |
364 | 345 | } |
365 | 346 | case 'WriterDN': |
366 | 347 | global $wgLDAPWriterDN; |
367 | 348 | if ( isset( $wgLDAPWriterDN[$domain] ) ) { |
368 | 349 | return $wgLDAPWriterDN[$domain]; |
369 | | - } else { |
370 | | - return ''; |
371 | 350 | } |
372 | 351 | case 'WriterPassword': |
373 | 352 | global $wgLDAPWriterPassword; |
374 | 353 | if ( isset( $wgLDAPWriterPassword[$domain] ) ) { |
375 | 354 | return $wgLDAPWriterPassword[$domain]; |
376 | | - } else { |
377 | | - return ''; |
378 | 355 | } |
379 | 356 | case 'WriteLocation': |
380 | 357 | global $wgLDAPWriteLocation; |
381 | 358 | if ( isset( $wgLDAPWriteLocation[$domain] ) ) { |
382 | 359 | return $wgLDAPWriteLocation[$domain]; |
383 | | - } else { |
384 | | - return ''; |
385 | 360 | } |
386 | 361 | case 'AddLDAPUsers': |
387 | 362 | global $wgLDAPAddLDAPUsers; |
388 | 363 | if ( isset( $wgLDAPAddLDAPUsers[$domain] ) ) { |
389 | 364 | return $wgLDAPAddLDAPUsers[$domain]; |
390 | | - } else { |
391 | | - return false; |
392 | 365 | } |
| 366 | + return false; |
393 | 367 | case 'UpdateLDAP': |
394 | 368 | global $wgLDAPUpdateLDAP; |
395 | 369 | if ( isset( $wgLDAPUpdateLDAP[$domain] ) ) { |
396 | 370 | return $wgLDAPUpdateLDAP[$domain]; |
397 | | - } else { |
398 | | - return false; |
399 | 371 | } |
| 372 | + return false; |
400 | 373 | case 'PasswordHash': |
401 | 374 | global $wgLDAPPasswordHash; |
402 | 375 | if ( isset( $wgLDAPPasswordHash[$domain] ) ) { |
— | — | @@ -407,38 +380,33 @@ |
408 | 381 | global $wgLDAPMailPassword; |
409 | 382 | if ( isset( $wgLDAPMailPassword[$domain] ) ) { |
410 | 383 | return $wgLDAPMailPassword[$domain]; |
411 | | - } else { |
412 | | - return false; |
413 | 384 | } |
| 385 | + return false; |
414 | 386 | case 'Preferences': |
415 | 387 | global $wgLDAPPreferences; |
416 | 388 | if ( isset( $wgLDAPPreferences[$domain] ) ) { |
417 | 389 | return $wgLDAPPreferences[$domain]; |
418 | | - } else { |
419 | | - return array(); |
420 | 390 | } |
| 391 | + return array(); |
421 | 392 | case 'DisableAutoCreate': |
422 | 393 | global $wgLDAPDisableAutoCreate; |
423 | 394 | if ( isset( $wgLDAPDisableAutoCreate[$domain] ) ) { |
424 | 395 | return $wgLDAPDisableAutoCreate[$domain]; |
425 | | - } else { |
426 | | - return false; |
427 | 396 | } |
| 397 | + return false; |
428 | 398 | case 'GroupUseFullDN': |
429 | 399 | global $wgLDAPGroupUseFullDN; |
430 | 400 | if ( isset( $wgLDAPGroupUseFullDN[$domain] ) ) { |
431 | 401 | return $wgLDAPGroupUseFullDN[$domain]; |
432 | | - } else { |
433 | | - return false; |
434 | 402 | } |
| 403 | + return false; |
435 | 404 | case 'LowerCaseUsername': |
436 | 405 | global $wgLDAPLowerCaseUsername; |
437 | 406 | if ( isset( $wgLDAPLowerCaseUsername[$domain] ) ) { |
438 | 407 | $this->printDebug( "Configuration set to lowercase username.", NONSENSITIVE ); |
439 | 408 | return $wgLDAPLowerCaseUsername[$domain]; |
440 | | - } else { |
441 | | - return false; |
442 | 409 | } |
| 410 | + return false; |
443 | 411 | case 'LowerCaseUsernameScheme': |
444 | 412 | global $wgLDAPLowerCaseUsernameScheme; |
445 | 413 | if ( isset( $wgLDAPLowerCaseUsernameScheme[$domain] ) ) { |
— | — | @@ -452,85 +420,69 @@ |
453 | 421 | global $wgLDAPGroupUseRetrievedUsername; |
454 | 422 | if ( isset( $wgLDAPGroupUseRetrievedUsername[$domain] ) ) { |
455 | 423 | return $wgLDAPGroupUseRetrievedUsername[$domain]; |
456 | | - } else { |
457 | | - return false; |
458 | 424 | } |
| 425 | + return false; |
459 | 426 | case 'GroupObjectclass': |
460 | 427 | global $wgLDAPGroupObjectclass; |
461 | 428 | if ( isset( $wgLDAPGroupObjectclass[$domain] ) ) { |
462 | 429 | return $wgLDAPGroupObjectclass[$domain]; |
463 | | - } else { |
464 | | - return ''; |
465 | 430 | } |
466 | 431 | case 'GroupAttribute': |
467 | 432 | global $wgLDAPGroupAttribute; |
468 | 433 | if ( isset( $wgLDAPGroupAttribute[$domain] ) ) { |
469 | 434 | return $wgLDAPGroupAttribute[$domain]; |
470 | | - } else { |
471 | | - return ''; |
472 | 435 | } |
473 | 436 | case 'GroupNameAttribute': |
474 | 437 | global $wgLDAPGroupNameAttribute; |
475 | 438 | if ( isset( $wgLDAPGroupNameAttribute[$domain] ) ) { |
476 | 439 | return $wgLDAPGroupNameAttribute[$domain]; |
477 | | - } else { |
478 | | - return ''; |
479 | 440 | } |
480 | 441 | case 'GroupsUseMemberOf': |
481 | 442 | global $wgLDAPGroupsUseMemberOf; |
482 | 443 | if ( isset( $wgLDAPGroupsUseMemberOf[$domain] ) ) { |
483 | 444 | return $wgLDAPGroupsUseMemberOf[$domain]; |
484 | | - } else { |
485 | | - return false; |
486 | 445 | } |
| 446 | + return false; |
487 | 447 | case 'UseLDAPGroups': |
488 | 448 | global $wgLDAPUseLDAPGroups; |
489 | 449 | if ( isset( $wgLDAPUseLDAPGroups[$domain] ) ) { |
490 | 450 | return $wgLDAPUseLDAPGroups[$domain]; |
491 | | - } else { |
492 | | - return false; |
493 | 451 | } |
| 452 | + return false; |
494 | 453 | case 'LocallyManagedGroups': |
495 | 454 | global $wgLDAPLocallyManagedGroups; |
496 | 455 | if ( isset( $wgLDAPLocallyManagedGroups[$domain] ) ) { |
497 | 456 | return $wgLDAPLocallyManagedGroups[$domain]; |
498 | | - } else { |
499 | | - return array(); |
500 | 457 | } |
| 458 | + return array(); |
501 | 459 | case 'GroupsPrevail': |
502 | 460 | global $wgLDAPGroupsPrevail; |
503 | 461 | if ( isset( $wgLDAPGroupsPrevail[$domain] ) ) { |
504 | 462 | return $wgLDAPGroupsPrevail[$domain]; |
505 | | - } else { |
506 | | - return false; |
507 | 463 | } |
| 464 | + return false; |
508 | 465 | case 'RequiredGroups': |
509 | 466 | global $wgLDAPRequiredGroups; |
510 | 467 | if ( isset( $wgLDAPRequiredGroups[$domain] ) ) { |
511 | 468 | return $wgLDAPRequiredGroups[$domain]; |
512 | | - } else { |
513 | | - return array(); |
514 | 469 | } |
| 470 | + return array(); |
515 | 471 | case 'ExcludedGroups': |
516 | 472 | global $wgLDAPExcludedGroups; |
517 | 473 | if ( isset( $wgLDAPExcludedGroups[$domain] ) ) { |
518 | 474 | return $wgLDAPExcludedGroups[$domain]; |
519 | | - } else { |
520 | | - return array(); |
521 | 475 | } |
| 476 | + return array(); |
522 | 477 | case 'GroupSearchNestedGroups': |
523 | 478 | global $wgLDAPGroupSearchNestedGroups; |
524 | 479 | if ( isset( $wgLDAPGroupSearchNestedGroups[$domain] ) ) { |
525 | 480 | return $wgLDAPGroupSearchNestedGroups[$domain]; |
526 | | - } else { |
527 | | - return false; |
528 | 481 | } |
| 482 | + return false; |
529 | 483 | case 'AuthAttribute': |
530 | 484 | global $wgLDAPAuthAttribute; |
531 | 485 | if ( isset( $wgLDAPAuthAttribute[$domain] ) ) { |
532 | 486 | return $wgLDAPAuthAttribute[$domain]; |
533 | | - } else { |
534 | | - return ''; |
535 | 487 | } |
536 | 488 | case 'AutoAuthUsername': |
537 | 489 | global $wgLDAPAutoAuthUsername; |
— | — | @@ -539,6 +491,7 @@ |
540 | 492 | global $wgLDAPAutoAuthDomain; |
541 | 493 | return $wgLDAPAutoAuthDomain; |
542 | 494 | } |
| 495 | + return ''; |
543 | 496 | } |
544 | 497 | |
545 | 498 | /** |