$fld_groups = isset( $prop['groups'] );
$fld_rights = isset( $prop['rights'] );
$fld_registration = isset( $prop['registration'] );
+ $fld_implicitgroups = isset( $prop['implicitgroups'] );
} else {
- $fld_blockinfo = $fld_editcount = $fld_groups = $fld_registration = $fld_rights = false;
+ $fld_blockinfo = $fld_editcount = $fld_groups = $fld_registration = $fld_rights = $fld_implicitgroups = false;
}
$limit = $params['limit'];
$result->setIndexedTagName( $lastUserData['groups'], 'g' );
}
+ if ( $fld_implicitgroups && !isset( $lastUserData['implicitgroups'] ) ) {
+ $lastUserData['implicitgroups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $lastUser ) );
+ $result->setIndexedTagName( $lastUserData['implicitgroups'], 'g' );
+ }
if ( $fld_rights ) {
if ( !isset( $lastUserData['rights'] ) ) {
$lastUserData['rights'] = User::getGroupPermissions( User::newFromName( $lastUser )->getAutomaticGroups() );
ApiBase::PARAM_TYPE => array(
'blockinfo',
'groups',
+ 'implicitgroups',
'rights',
'editcount',
'registration'
'rights' => 'Limit users to given right(s)',
'prop' => array(
'What pieces of information to include.',
- ' blockinfo - Adds the information about a current block on the user',
- ' groups - Lists groups that the user is in. This uses more server resources and may return fewer results than the limit',
- ' rights - Lists rights that the user has',
- ' editcount - Adds the edit count of the user',
- ' registration - Adds the timestamp of when the user registered if available (may be blank)',
+ ' blockinfo - Adds the information about a current block on the user',
+ ' groups - Lists groups that the user is in. This uses more server resources and may return fewer results than the limit',
+ ' implicitgroups - Lists all the groups the user is automatically in',
+ ' rights - Lists rights that the user has',
+ ' editcount - Adds the edit count of the user',
+ ' registration - Adds the timestamp of when the user registered if available (may be blank)',
),
'limit' => 'How many total user names to return',
'witheditsonly' => 'Only list users who have made edits',
}
}
+ 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() );
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',