Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -466,6 +466,34 @@ |
467 | 467 | return null; |
468 | 468 | } |
469 | 469 | |
| 470 | + /** |
| 471 | + * Filters hidden users (where the user doesn't have the right to view them) |
| 472 | + * Also adds relevant block information |
| 473 | + * |
| 474 | + * @param bool $showBlockInfo |
| 475 | + * @return void |
| 476 | + */ |
| 477 | + public function showHiddenUsersAddBlockInfo( $showBlockInfo ) { |
| 478 | + global $wgUser; |
| 479 | + $userCanViewHiddenUsers = $wgUser->isAllowed( 'hideuser' ); |
| 480 | + |
| 481 | + if ( $showBlockInfo || !$userCanViewHiddenUsers ) { |
| 482 | + $this->addTables( 'ipblocks' ); |
| 483 | + $this->addJoinConds( array( |
| 484 | + 'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ), |
| 485 | + ) ); |
| 486 | + |
| 487 | + if ( $showBlockInfo ) { |
| 488 | + $this->addFields( array( 'ipb_reason', 'ipb_by_text', 'ipb_expiry' ) ); |
| 489 | + } |
| 490 | + |
| 491 | + // Don't show hidden names |
| 492 | + if ( !$userCanViewHiddenUsers ) { |
| 493 | + $this->addWhere( 'ipb_deleted IS NULL' ); |
| 494 | + } |
| 495 | + } |
| 496 | + } |
| 497 | + |
470 | 498 | public function getPossibleErrors() { |
471 | 499 | return array_merge( parent::getPossibleErrors(), array( |
472 | 500 | array( 'invalidtitle', 'title' ), |
Index: trunk/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -112,13 +112,7 @@ |
113 | 113 | $sqlLimit = $limit + 1; |
114 | 114 | } |
115 | 115 | |
116 | | - if ( $fld_blockinfo ) { |
117 | | - $this->addTables( 'ipblocks' ); |
118 | | - $this->addJoinConds( array( |
119 | | - 'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ), |
120 | | - ) ); |
121 | | - $this->addFields( array( 'ipb_reason', 'ipb_by_text', 'ipb_expiry' ) ); |
122 | | - } |
| 116 | + $this->showHiddenUsersAddBlockInfo( $fld_blockinfo ); |
123 | 117 | |
124 | 118 | $this->addOption( 'LIMIT', $sqlLimit ); |
125 | 119 | |
Index: trunk/phase3/includes/api/ApiQueryUsers.php |
— | — | @@ -119,14 +119,9 @@ |
120 | 120 | $this->addJoinConds( array( 'user_groups' => array( 'LEFT JOIN', 'ug_user=user_id' ) ) ); |
121 | 121 | $this->addFields( 'ug_group' ); |
122 | 122 | } |
123 | | - if ( isset( $this->prop['blockinfo'] ) ) { |
124 | | - $this->addTables( 'ipblocks' ); |
125 | | - $this->addJoinConds( array( |
126 | | - 'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ), |
127 | | - ) ); |
128 | | - $this->addFields( array( 'ipb_reason', 'ipb_by_text', 'ipb_expiry' ) ); |
129 | | - } |
130 | 123 | |
| 124 | + $this->showHiddenUsersAddBlockInfo( isset( $this->prop['blockinfo'] ) ); |
| 125 | + |
131 | 126 | $data = array(); |
132 | 127 | $res = $this->select( __METHOD__ ); |
133 | 128 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -214,7 +214,8 @@ |
215 | 215 | * (bug 27862) Useremail module didn't properly return success on success. |
216 | 216 | * (bug 27590) prop=imageinfo now allows querying the media type |
217 | 217 | * (bug 27587) list=filearchive now outputs full title info |
218 | | -(bug 27018) Added action=filerevert to revert files to an old version |
| 218 | +* (bug 27018) Added action=filerevert to revert files to an old version |
| 219 | +* (bug 27897) list=allusers and list=users list hidden users |
219 | 220 | |
220 | 221 | === Languages updated in 1.18 === |
221 | 222 | |