r79556 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79555‎ | r79556 | r79557 >
Date:03:36, 4 January 2011
Author:reedy
Status:resolved
Tags:
Comment:
* (bug 26559) list=allusers auprop=rights does not match list=users usprop=rights
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryAllUsers.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUsers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryAllUsers.php
@@ -112,6 +112,7 @@
113113 } else {
114114 $sqlLimit = $limit + 1;
115115 }
 116+
116117 if ( $fld_blockinfo ) {
117118 $this->addTables( 'ipblocks' );
118119 $this->addTables( 'user', 'u2' );
Index: trunk/phase3/includes/api/ApiQueryUsers.php
@@ -126,6 +126,9 @@
127127
128128 $data = array();
129129 $res = $this->select( __METHOD__ );
 130+
 131+ $result = $this->getResult();
 132+
130133 foreach ( $res as $row ) {
131134 $user = User::newFromRow( $row );
132135 $name = $user->getName();
@@ -140,14 +143,23 @@
141144 }
142145
143146 if ( isset( $this->prop['groups'] ) && !is_null( $row->ug_group ) ) {
 147+ if ( !isset( $data[$u]['groups'] ) ) {
 148+ $data[$u]['groups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $u ) );
 149+ }
 150+
144151 // This row contains only one group, others will be added from other rows
145152 $data[$name]['groups'][] = $row->ug_group;
 153+ $result->setIndexedTagName( $data[$u]['groups'], 'g' );
146154 }
147155
148 - if ( isset( $this->prop['rights'] ) && !isset( $data[$name]['rights'] ) ) {
149 - // User::getRights() may return duplicate values, strip them
150 - $data[$name]['rights'] = array_values( array_unique( $user->getRights() ) );
151 - $result->setIndexedTagName( $data[$name]['rights'], 'r' ); // even if empty
 156+ if ( isset( $this->prop['rights'] ) && !is_null( $row->ug_group ) ) {
 157+ if ( !isset( $data[$name]['rights'] ) ) {
 158+ $data[$name]['rights'] = User::getGroupPermissions( User::getImplicitGroups() );
 159+ }
 160+
 161+ $data[$name]['rights'] = array_unique( array_merge( $data[$name]['rights'],
 162+ User::getGroupPermissions( array( $row->ug_group ) ) ) );
 163+ $result->setIndexedTagName( $data[$name]['rights'], 'r' );
152164 }
153165
154166 if ( isset( $this->prop['blockinfo'] ) && !is_null( $row->blocker_name ) ) {
@@ -206,15 +218,8 @@
207219 } else {
208220 $data[$u]['missing'] = '';
209221 }
210 - } else {
211 - if ( isset( $this->prop['groups'] ) && isset( $data[$u]['groups'] ) ) {
212 - $autolist = ApiQueryUsers::getAutoGroups( User::newFromName( $u ) );
 222+ }
213223
214 - $data[$u]['groups'] = array_merge( $autolist, $data[$u]['groups'] );
215 -
216 - $this->getResult()->setIndexedTagName( $data[$u]['groups'], 'g' );
217 - }
218 - }
219224 $fit = $result->addValue( array( 'query', $this->getModuleName() ),
220225 null, $data[$u] );
221226 if ( !$fit ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -68,6 +68,7 @@
6969 * action=parse now correctly returns an error for nonexistent pages
7070 * (bug 25767) Add userrights properties to allusers and users query lists
7171 * (bug 26558) list=allusers auprop=groups does not list groups a user is automatically a member of
 72+* (bug 26559) list=allusers auprop=rights does not match list=users usprop=rights
7273
7374 === Languages updated in 1.18 ===
7475

Follow-up revisions

RevisionCommit summaryAuthorDate
r83787* (bug 28010) Passing a non existant user to list=users gives internal error...reedy22:23, 12 March 2011

Status & tagging log