r65189 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65188‎ | r65189 | r65190 >
Date:21:26, 17 April 2010
Author:reedy
Status:deferred
Tags:
Comment:
LdapAuthentication:

Fixup some indentation

Fixup some if ( true ) { return true; } else { return false; }
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -150,8 +150,7 @@
151151 } else {
152152 $this->printDebug( "Failed to connect", NONSENSITIVE );
153153 return false;
154 - }
155 -
 154+ }
156155 }
157156
158157 /**
@@ -165,11 +164,11 @@
166165 global $wgLDAPOptions;
167166
168167 $this->printDebug( "Entering Connect", NONSENSITIVE );
169 -
170 - if ( !function_exists( 'ldap_connect' ) ) {
 168+
 169+ if ( !function_exists( 'ldap_connect' ) ) {
171170 $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 );
172171 return false;
173 - }
 172+ }
174173
175174 // If the admin didn't set an encryption type, we default to tls
176175 if ( isset( $wgLDAPEncryptionType[$_SESSION['wsDomain']] ) ) {
@@ -427,11 +426,7 @@
428427 function autoCreate() {
429428 global $wgLDAPDisableAutoCreate;
430429
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']] );
436431 }
437432
438433 /**
@@ -582,11 +577,7 @@
583578 function canCreateAccounts() {
584579 global $wgLDAPAddLDAPUsers;
585580
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']] );
591582 }
592583
593584 /**
@@ -1330,7 +1321,8 @@
13311322
13321323 // Only find all groups if the user has any groups; otherwise, we are
13331324 // 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 ) {
13351327 $this->allLDAPGroups = $this->searchGroups( '*' );
13361328 }
13371329 }
@@ -1490,8 +1482,7 @@
14911483 * @access private
14921484 */
14931485 function setGroups( &$user ) {
1494 - global $wgLDAPGroupsPrevail, $wgGroupPermissions;
1495 - global $wgLDAPLocallyManagedGroups;
 1486+ global $wgLDAPGroupsPrevail, $wgGroupPermissions, $wgLDAPLocallyManagedGroups;
14961487
14971488 // TODO: this is *really* ugly code. clean it up!
14981489
@@ -1513,12 +1504,14 @@
15141505 }
15151506
15161507
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']] ) {
15191510 $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+ }
15231516 }
15241517
15251518 $this->printDebug( "Available groups are: ", NONSENSITIVE, $localAvailGrps );
@@ -1707,7 +1700,6 @@
17081701 return $ret;
17091702 }
17101703 }
1711 -
17121704 }
17131705
17141706 // The following was derived from the SSL Authentication plugin

Follow-up revisions

RevisionCommit summaryAuthorDate
r65285Follow-up r65189: Fix syntax errorraymond18:24, 19 April 2010

Status & tagging log