Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php |
— | — | @@ -150,8 +150,7 @@ |
151 | 151 | } else { |
152 | 152 | $this->printDebug( "Failed to connect", NONSENSITIVE ); |
153 | 153 | return false; |
154 | | - } |
155 | | - |
| 154 | + } |
156 | 155 | } |
157 | 156 | |
158 | 157 | /** |
— | — | @@ -165,11 +164,11 @@ |
166 | 165 | global $wgLDAPOptions; |
167 | 166 | |
168 | 167 | $this->printDebug( "Entering Connect", NONSENSITIVE ); |
169 | | - |
170 | | - if ( !function_exists( 'ldap_connect' ) ) { |
| 168 | + |
| 169 | + if ( !function_exists( 'ldap_connect' ) ) { |
171 | 170 | $this->printDebug( "It looks like you are issing LDAP support; please ensure you have either compiled LDAP support in, or have enabled the module. If the authentication is working for you, the plugin isn't properly detecting the LDAP module, and you can safely ignore this message.", NONSENSITIVE ); |
172 | 171 | return false; |
173 | | - } |
| 172 | + } |
174 | 173 | |
175 | 174 | // If the admin didn't set an encryption type, we default to tls |
176 | 175 | if ( isset( $wgLDAPEncryptionType[$_SESSION['wsDomain']] ) ) { |
— | — | @@ -427,11 +426,7 @@ |
428 | 427 | function autoCreate() { |
429 | 428 | global $wgLDAPDisableAutoCreate; |
430 | 429 | |
431 | | - if ( isset( $wgLDAPDisableAutoCreate[$_SESSION['wsDomain']] ) && $wgLDAPDisableAutoCreate[$_SESSION['wsDomain']] ) { |
432 | | - return false; |
433 | | - } else { |
434 | | - return true; |
435 | | - } |
| 430 | + return !( isset( $wgLDAPDisableAutoCreate[$_SESSION['wsDomain']] ) && $wgLDAPDisableAutoCreate[$_SESSION['wsDomain']] ); |
436 | 431 | } |
437 | 432 | |
438 | 433 | /** |
— | — | @@ -582,11 +577,7 @@ |
583 | 578 | function canCreateAccounts() { |
584 | 579 | global $wgLDAPAddLDAPUsers; |
585 | 580 | |
586 | | - if ( isset( $wgLDAPAddLDAPUsers[$_SESSION['wsDomain']] ) && $wgLDAPAddLDAPUsers[$_SESSION['wsDomain']] ) { |
587 | | - return true; |
588 | | - } else { |
589 | | - return false; |
590 | | - } |
| 581 | + return ( isset( $wgLDAPAddLDAPUsers[$_SESSION['wsDomain']] ) && $wgLDAPAddLDAPUsers[$_SESSION['wsDomain']] ); |
591 | 582 | } |
592 | 583 | |
593 | 584 | /** |
— | — | @@ -1330,7 +1321,8 @@ |
1331 | 1322 | |
1332 | 1323 | // Only find all groups if the user has any groups; otherwise, we are |
1333 | 1324 | // just wasting a search. |
1334 | | - if ( ( isset( $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) && $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) && count( $this->userLDAPGroups ) != 0 ) { |
| 1325 | + if ( ( isset( $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ). |
| 1326 | + && $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) && count( $this->userLDAPGroups ) != 0 ) { |
1335 | 1327 | $this->allLDAPGroups = $this->searchGroups( '*' ); |
1336 | 1328 | } |
1337 | 1329 | } |
— | — | @@ -1490,8 +1482,7 @@ |
1491 | 1483 | * @access private |
1492 | 1484 | */ |
1493 | 1485 | function setGroups( &$user ) { |
1494 | | - global $wgLDAPGroupsPrevail, $wgGroupPermissions; |
1495 | | - global $wgLDAPLocallyManagedGroups; |
| 1486 | + global $wgLDAPGroupsPrevail, $wgGroupPermissions, $wgLDAPLocallyManagedGroups; |
1496 | 1487 | |
1497 | 1488 | // TODO: this is *really* ugly code. clean it up! |
1498 | 1489 | |
— | — | @@ -1513,12 +1504,14 @@ |
1514 | 1505 | } |
1515 | 1506 | |
1516 | 1507 | |
1517 | | - # Add ldap groups as local groups |
1518 | | - if ( isset( $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) && $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) { |
| 1508 | + # Add ldap groups as local groups |
| 1509 | + if ( isset( $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) && $wgLDAPGroupsPrevail[$_SESSION['wsDomain']] ) { |
1519 | 1510 | $this->printDebug( "Adding all groups to wgGroupPermissions: ", SENSITIVE, $this->allLDAPGroups ); |
1520 | | - foreach ( $this->allLDAPGroups["short"] as $ldapgroup ) |
1521 | | - if ( !array_key_exists( $ldapgroup, $wgGroupPermissions ) ) |
1522 | | - $wgGroupPermissions[$ldapgroup] = array(); |
| 1511 | + |
| 1512 | + foreach ( $this->allLDAPGroups["short"] as $ldapgroup ) { |
| 1513 | + if ( !array_key_exists( $ldapgroup, $wgGroupPermissions ) ) |
| 1514 | + $wgGroupPermissions[$ldapgroup] = array(); |
| 1515 | + } |
1523 | 1516 | } |
1524 | 1517 | |
1525 | 1518 | $this->printDebug( "Available groups are: ", NONSENSITIVE, $localAvailGrps ); |
— | — | @@ -1707,7 +1700,6 @@ |
1708 | 1701 | return $ret; |
1709 | 1702 | } |
1710 | 1703 | } |
1711 | | - |
1712 | 1704 | } |
1713 | 1705 | |
1714 | 1706 | // The following was derived from the SSL Authentication plugin |