* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* Query module to get information about a list of users
*
return $this->tokenFunctions;
}
- /**
- * @param $user User
- * @return String
- */
+ /**
+ * @param $user User
+ * @return String
+ */
public static function getUserrightsToken( $user ) {
global $wgUser;
// Since the permissions check for userrights is non-trivial,
// don't bother with it here
- return $wgUser->editToken( $user->getName() );
+ return $wgUser->getEditToken( $user->getName() );
}
public function execute() {
}
}
+ if ( isset( $this->prop['implicitgroups'] ) && !isset( $data[$name]['implicitgroups'] ) ) {
+ $data[$name]['implicitgroups'] = self::getAutoGroups( $user );
+ }
+
if ( isset( $this->prop['rights'] ) ) {
if ( !isset( $data[$name]['rights'] ) ) {
$data[$name]['rights'] = User::getGroupPermissions( $user->getAutomaticGroups() );
$data[$name]['hidden'] = '';
}
if ( isset( $this->prop['blockinfo'] ) && !is_null( $row->ipb_by_text ) ) {
+ $data[$name]['blockid'] = $row->ipb_id;
$data[$name]['blockedby'] = $row->ipb_by_text;
+ $data[$name]['blockedbyid'] = $row->ipb_by;
$data[$name]['blockreason'] = $row->ipb_reason;
$data[$name]['blockexpiry'] = $row->ipb_expiry;
}
if ( isset( $this->prop['groups'] ) && isset( $data[$u]['groups'] ) ) {
$result->setIndexedTagName( $data[$u]['groups'], 'g' );
}
+ if ( isset( $this->prop['implicitgroups'] ) && isset( $data[$u]['implicitgroups'] ) ) {
+ $result->setIndexedTagName( $data[$u]['implicitgroups'], 'g' );
+ }
if ( isset( $this->prop['rights'] ) && isset( $data[$u]['rights'] ) ) {
$result->setIndexedTagName( $data[$u]['rights'], 'r' );
}
$groups[] = 'user';
}
- $builtGroups = array();
- foreach( array_merge( $groups, Autopromote::getAutopromoteGroups( $user ) ) as $i => $group ) {
- $builtGroups[$i] = array( 'implicit' => '' );
- ApiResult::setContent( $builtGroups[$i], $group );
- }
- return $builtGroups;
+ return array_merge( $groups, Autopromote::getAutopromoteGroups( $user ) );
}
public function getCacheMode( $params ) {
ApiBase::PARAM_TYPE => array(
'blockinfo',
'groups',
+ 'implicitgroups',
'rights',
'editcount',
'registration',
return array(
'prop' => array(
'What pieces of information to include',
- ' blockinfo - Tags if the user is blocked, by whom, and for what reason',
- ' groups - Lists all the groups the user(s) belongs to',
- ' rights - Lists all the rights the user(s) has',
- ' editcount - Adds the user\'s edit count',
- ' registration - Adds the user\'s registration timestamp',
- ' emailable - Tags if the user can and wants to receive e-mail through [[Special:Emailuser]]',
- ' gender - Tags the gender of the user. Returns "male", "female", or "unknown"',
+ ' blockinfo - Tags if the user is blocked, by whom, and for what reason',
+ ' groups - Lists all the groups the user(s) belongs to',
+ ' implicitgroups - Lists all the groups a user is automatically a member of',
+ ' rights - Lists all the rights the user(s) has',
+ ' editcount - Adds the user\'s edit count',
+ ' registration - Adds the user\'s registration timestamp',
+ ' emailable - Tags if the user can and wants to receive e-mail through [[Special:Emailuser]]',
+ ' gender - Tags the gender of the user. Returns "male", "female", or "unknown"',
),
'users' => 'A list of users to obtain the same information for',
'token' => 'Which tokens to obtain for each user',
}
public function getHelpUrls() {
- return 'http://www.mediawiki.org/wiki/API:Users';
+ return 'https://www.mediawiki.org/wiki/API:Users';
}
public function getVersion() {