Refactored addition of block information, and also checked if user is allowed to view hidden user fields
* (bug 27862) Useremail module didn't properly return success on success.
* (bug 27590) prop=imageinfo now allows querying the media type
* (bug 27587) list=filearchive now outputs full title info
-(bug 27018) Added action=filerevert to revert files to an old version
+* (bug 27018) Added action=filerevert to revert files to an old version
+* (bug 27897) list=allusers and list=users list hidden users
=== Languages updated in 1.18 ===
$sqlLimit = $limit + 1;
}
- if ( $fld_blockinfo ) {
- $this->addTables( 'ipblocks' );
- $this->addJoinConds( array(
- 'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ),
- ) );
- $this->addFields( array( 'ipb_reason', 'ipb_by_text', 'ipb_expiry' ) );
- }
+ $this->showHiddenUsersAddBlockInfo( $fld_blockinfo );
$this->addOption( 'LIMIT', $sqlLimit );
return null;
}
+ /**
+ * Filters hidden users (where the user doesn't have the right to view them)
+ * Also adds relevant block information
+ *
+ * @param bool $showBlockInfo
+ * @return void
+ */
+ public function showHiddenUsersAddBlockInfo( $showBlockInfo ) {
+ global $wgUser;
+ $userCanViewHiddenUsers = $wgUser->isAllowed( 'hideuser' );
+
+ if ( $showBlockInfo || !$userCanViewHiddenUsers ) {
+ $this->addTables( 'ipblocks' );
+ $this->addJoinConds( array(
+ 'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ),
+ ) );
+
+ if ( $showBlockInfo ) {
+ $this->addFields( array( 'ipb_reason', 'ipb_by_text', 'ipb_expiry' ) );
+ }
+
+ // Don't show hidden names
+ if ( !$userCanViewHiddenUsers ) {
+ $this->addWhere( 'ipb_deleted IS NULL' );
+ }
+ }
+ }
+
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'invalidtitle', 'title' ),
$this->addJoinConds( array( 'user_groups' => array( 'LEFT JOIN', 'ug_user=user_id' ) ) );
$this->addFields( 'ug_group' );
}
- if ( isset( $this->prop['blockinfo'] ) ) {
- $this->addTables( 'ipblocks' );
- $this->addJoinConds( array(
- 'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ),
- ) );
- $this->addFields( array( 'ipb_reason', 'ipb_by_text', 'ipb_expiry' ) );
- }
+
+ $this->showHiddenUsersAddBlockInfo( isset( $this->prop['blockinfo'] ) );
$data = array();
$res = $this->select( __METHOD__ );