r105358 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105357‎ | r105358 | r105359 >
Date:21:28, 6 December 2011
Author:reedy
Status:deferred
Tags:
Comment:
Upsteam changes from Toolserver working copy

http://pastebin.com/s9xZGSKN
Modified paths:
  • /trunk/extensions/CrowdAuthentication/CrowdAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CrowdAuthentication/CrowdAuthentication.php
@@ -236,11 +236,8 @@
237237 * Find the groups this user is a member of.
238238 */
239239
240 - $restr = new caSearchRestriction();
241 - $restr->name = "group.principal.member";
242 - $restr->value = $this->findUsername( $user->getName() );
243 - $groups = $this->crowd->searchGroups( array( "in0" => $this->token, "in1" => array( $restr ) ) );
244 - $groups = $groups->out->SOAPGroup;
 240+ $groups = $this->crowd->findGroupMemberships( array( "in0" => $this->token, "in1" => $user->getName() ) );
 241+ $groups = $groups->out->string;
245242
246243 $dbw = wfGetDB( DB_MASTER );
247244 if ( $caOverwriteLocalGroups ) {
@@ -248,7 +245,7 @@
249246 }
250247
251248 foreach ( $groups as $group ) {
252 - $user->addGroup( $group->name );
 249+ $user->addGroup( $group );
253250 }
254251 return true;
255252 }
@@ -320,7 +317,7 @@
321318 $nameparts = split( " ", $realname, 2 );
322319 $firstname = $user->getName();
323320 $lastname = "";
324 - if ( count( $nameparts ) > 0 ) {
 321+ if ( count( $nameparts ) > 0 && strlen( $nameparts[0] ) ) {
325322 $firstname = $nameparts[0];
326323
327324 if ( count( $nameparts ) > 1 ) {
@@ -335,10 +332,10 @@
336333 new caSOAPAttribute( "mail", $email ),
337334 new caSOAPAttribute( "givenName", $firstname ),
338335 new caSOAPAttribute( "sn", $lastname ),
339 - new caSOAPAttribute( "invalidPasswordAttempts", 0 ),
340 - new caSOAPAttribute( "lastAuthenticated", 0 ),
341 - new caSOAPAttribute( "passwordLastChanged", 0 ),
342 - new caSOAPAttribute( "requiresPasswordChange", 0 ),
 336+ // new caSOAPAttribute( "invalidPasswordAttempts", 0 ),
 337+ // new caSOAPAttribute( "lastAuthenticated", 0 ),
 338+ // new caSOAPAttribute( "passwordLastChanged", 0 ),
 339+ // new caSOAPAttribute( "requiresPasswordChange", 0 ),
343340 );
344341 $principal->active = true;
345342 $principal->conception = 0;
@@ -351,7 +348,10 @@
352349 )
353350 );
354351 foreach ( $caDefaultGroups as $group ) {
355 - $crowd->addPrincipalToGroup( array( "in0" => $this->token, "in1" => $user->getName(), "in2" => $group ) );
 352+ // XXX hack from Toolserver
 353+ try {
 354+ $crowd->addPrincipalToGroup( array( "in0" => $this->token, "in1" => $user->getName(), "in2" => $group ) );
 355+ } catch (Exception $e) { }
356356 }
357357
358358 return true;

Status & tagging log