Index: trunk/phase3/includes/User.php |
— | — | @@ -3131,14 +3131,18 @@ |
3132 | 3132 | * non-existent/anonymous user accounts. |
3133 | 3133 | */ |
3134 | 3134 | public function getFirstEditTimestamp() { |
3135 | | - if( $this->getId() == 0 ) return false; // anons |
| 3135 | + if( $this->getId() == 0 ) { |
| 3136 | + return false; // anons |
| 3137 | + } |
3136 | 3138 | $dbr = wfGetDB( DB_SLAVE ); |
3137 | 3139 | $time = $dbr->selectField( 'revision', 'rev_timestamp', |
3138 | 3140 | array( 'rev_user' => $this->getId() ), |
3139 | 3141 | __METHOD__, |
3140 | 3142 | array( 'ORDER BY' => 'rev_timestamp ASC' ) |
3141 | 3143 | ); |
3142 | | - if( !$time ) return false; // no edits |
| 3144 | + if( !$time ) { |
| 3145 | + return false; // no edits |
| 3146 | + } |
3143 | 3147 | return wfTimestamp( TS_MW, $time ); |
3144 | 3148 | } |
3145 | 3149 | |
Index: trunk/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -71,6 +71,21 @@ |
72 | 72 | $this->addWhere( 'u1.user_name' . $db->buildLike( $this->keyToTitle( $params['prefix'] ), $db->anyString() ) ); |
73 | 73 | } |
74 | 74 | |
| 75 | + if ( !is_null( $params['rights'] ) ) { |
| 76 | + $groups = array(); |
| 77 | + foreach( $params['rights'] as $r ) { |
| 78 | + $groups = array_merge( $groups, User::getGroupsWithPermission( $r ) ); |
| 79 | + } |
| 80 | + |
| 81 | + $groups = array_diff( array_unique( $groups ), User::getImplicitGroups() ); |
| 82 | + |
| 83 | + if ( is_null( $params['group'] ) ) { |
| 84 | + $params['group'] = $groups; |
| 85 | + } else { |
| 86 | + $params['group'] = array_unique( array_merge( $params['group'], $groups ) ); |
| 87 | + } |
| 88 | + } |
| 89 | + |
75 | 90 | if ( !is_null( $params['group'] ) ) { |
76 | 91 | $useIndex = false; |
77 | 92 | // Filter only users that belong to a given group |
— | — | @@ -222,8 +237,13 @@ |
223 | 238 | 'to' => null, |
224 | 239 | 'prefix' => null, |
225 | 240 | 'group' => array( |
226 | | - ApiBase::PARAM_TYPE => User::getAllGroups() |
| 241 | + ApiBase::PARAM_TYPE => User::getAllGroups(), |
| 242 | + ApiBase::PARAM_ISMULTI => true, |
227 | 243 | ), |
| 244 | + 'rights' => array( |
| 245 | + ApiBase::PARAM_TYPE => User::getAllRights(), |
| 246 | + ApiBase::PARAM_ISMULTI => true, |
| 247 | + ), |
228 | 248 | 'prop' => array( |
229 | 249 | ApiBase::PARAM_ISMULTI => true, |
230 | 250 | ApiBase::PARAM_TYPE => array( |
— | — | @@ -249,12 +269,13 @@ |
250 | 270 | 'from' => 'The user name to start enumerating from', |
251 | 271 | 'to' => 'The user name to stop enumerating at', |
252 | 272 | 'prefix' => 'Search for all users that begin with this value', |
253 | | - 'group' => 'Limit users to a given group name', |
| 273 | + 'group' => 'Limit users to given group name(s)', |
| 274 | + 'rights' => 'Limit users to given right(s)', |
254 | 275 | 'prop' => array( |
255 | 276 | 'What pieces of information to include.', |
256 | 277 | ' blockinfo - Adds the information about a current block on the user', |
257 | 278 | ' groups - Lists groups that the user is in. This uses more server resources and may return fewer results than the limit', |
258 | | - ' rights - Lists groups that the user has', |
| 279 | + ' rights - Lists rights that the user has', |
259 | 280 | ' editcount - Adds the edit count of the user', |
260 | 281 | ' registration - Adds the timestamp of when the user registered', |
261 | 282 | ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | * Add a &watchuser option to ApiBlock |
68 | 68 | * (bug 26541) Generator-ise ApiQueryRecentChanges |
69 | 69 | * action=parse now correctly returns an error for nonexistent pages |
| 70 | +* (bug 25767) Add userrights properties to allusers and users query lists |
70 | 71 | |
71 | 72 | === Languages updated in 1.18 === |
72 | 73 | |