* (bug 24009) Include implicit groups in action=query&list=users&usprop=groups
authorSam Reed <reedy@users.mediawiki.org>
Thu, 17 Jun 2010 07:39:31 +0000 (07:39 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Thu, 17 Jun 2010 07:39:31 +0000 (07:39 +0000)
Add some whitespace, fix some braces in ApiQueryUsers

Add a few braces to SpecialUserrights.php, change or to || and and to &&

RELEASE-NOTES
includes/api/ApiQueryUsers.php
includes/specials/SpecialUserrights.php

index b912955..7dfa759 100644 (file)
@@ -222,6 +222,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   thumbnailing larger than original image
 * (bug 23835) Need "thumbmime" result in "imageinfo" query
 * (bug 23851) Repair diff for file redirect pages
+* (bug 24009) Include implicit groups in action=query&list=users&usprop=groups
 
 === Languages updated in 1.17 ===
 
index 947838e..12e5391 100644 (file)
@@ -130,20 +130,25 @@ if ( !defined( 'MEDIAWIKI' ) ) {
                                $user = User::newFromRow( $r );
                                $name = $user->getName();
                                $data[$name]['name'] = $name;
+
                                if ( isset( $this->prop['editcount'] ) ) {
                                        $data[$name]['editcount'] = intval( $user->getEditCount() );
                                }
+
                                if ( isset( $this->prop['registration'] ) ) {
                                        $data[$name]['registration'] = wfTimestampOrNull( TS_ISO_8601, $user->getRegistration() );
                                }
+
                                if ( isset( $this->prop['groups'] ) && !is_null( $r->ug_group ) ) {
                                        // This row contains only one group, others will be added from other rows
                                        $data[$name]['groups'][] = $r->ug_group;
                                }
+
                                if ( isset( $this->prop['blockinfo'] ) && !is_null( $r->blocker_name ) ) {
                                        $data[$name]['blockedby'] = $r->blocker_name;
                                        $data[$name]['blockreason'] = $r->ipb_reason;
                                }
+
                                if ( isset( $this->prop['emailable'] ) && $user->canReceiveEmail() ) {
                                        $data[$name]['emailable'] = '';
                                }
@@ -175,10 +180,13 @@ if ( !defined( 'MEDIAWIKI' ) ) {
                                $data[$u] = array( 'name' => $u );
                                $urPage = new UserrightsPage;
                                $iwUser = $urPage->fetchUser( $u );
+
                                if ( $iwUser instanceof UserRightsProxy ) {
                                        $data[$u]['interwiki'] = '';
+
                                        if ( !is_null( $params['token'] ) ) {
                                                $tokenFunctions = $this->getTokenFunctions();
+
                                                foreach ( $params['token'] as $t ) {
                                                        $val = call_user_func( $tokenFunctions[$t], $iwUser );
                                                        if ( $val === false ) {
@@ -192,8 +200,15 @@ if ( !defined( 'MEDIAWIKI' ) ) {
                                        $data[$u]['missing'] = '';
                                }
                        } else {
-                               if ( isset( $this->prop['groups'] ) && isset( $data[$u]['groups'] ) )
-                               {
+                               if ( isset( $this->prop['groups'] ) && isset( $data[$u]['groups'] ) ) {
+                                       $autolist = array();
+                                       $autolist[] = "*";
+                                       foreach( Autopromote::getAutopromoteGroups( User::newFromName( $u ) ) as $group ) {
+                                               $autolist[] = $group;
+                                       }
+                                       
+                                       $data[$u]['groups'] = array_merge( $autolist, $data[$u]['groups'] );
+                               
                                        $this->getResult()->setIndexedTagName( $data[$u]['groups'], 'g' );
                                }
                        }
index 052f9a3..e922830 100644 (file)
@@ -32,10 +32,10 @@ class UserrightsPage extends SpecialPage {
        public function userCanChangeRights( $user, $checkIfSelf = true ) {
                $available = $this->changeableGroups();
                return !empty( $available['add'] )
-                       or !empty( $available['remove'] )
-                       or ( ( $this->isself || !$checkIfSelf ) and
+                       || !empty( $available['remove'] )
+                       || ( ( $this->isself || !$checkIfSelf ) &&
                                ( !empty( $available['add-self'] )
-                                or !empty( $available['remove-self'] ) ) );
+                                || !empty( $available['remove-self'] ) ) );
        }
 
        /**
@@ -77,8 +77,9 @@ class UserrightsPage extends SpecialPage {
                                $this->mTarget = $wgUser->getName();
                }
 
-               if ( User::getCanonicalName( $this->mTarget ) == $wgUser->getName() )
+               if ( User::getCanonicalName( $this->mTarget ) == $wgUser->getName() ) {
                        $this->isself = true;
+               }
 
                if( !$this->userCanChangeRights( $wgUser, true ) ) {
                        // fixme... there may be intermediate groups we can mention.
@@ -99,8 +100,9 @@ class UserrightsPage extends SpecialPage {
                $this->setHeaders();
 
                // show the general form
-               if ( count( $available['add'] ) || count( $available['remove'] ) )
+               if ( count( $available['add'] ) || count( $available['remove'] ) ) {
                        $this->switchForm();
+               }
 
                if( $wgRequest->wasPosted() ) {
                        // save settings