Index: trunk/phase3/includes/api/ApiUserrights.php |
— | — | @@ -45,8 +45,7 @@ |
46 | 46 | if(is_null($params['token'])) |
47 | 47 | $this->dieUsageMsg(array('missingparam', 'token')); |
48 | 48 | |
49 | | - $form = new UserrightsPage; |
50 | | - $user = $form->fetchUser($params['user']); |
| 49 | + $user = UserrightsPage::fetchUser($params['user']); |
51 | 50 | if($user instanceof WikiErrorMsg) |
52 | 51 | $this->dieUsageMsg(array_merge( |
53 | 52 | (array)$user->getMessageKey(), |
Index: trunk/phase3/includes/api/ApiQueryUsers.php |
— | — | @@ -170,9 +170,26 @@ |
171 | 171 | } |
172 | 172 | // Second pass: add result data to $retval |
173 | 173 | foreach($goodNames as $u) { |
174 | | - if(!isset($data[$u])) |
175 | | - $data[$u] = array('name' => $u, 'missing' => ''); |
176 | | - else { |
| 174 | + if(!isset($data[$u])) { |
| 175 | + $data[$u] = array('name' => $u); |
| 176 | + $iwUser = UserrightsPage::fetchUser($u); |
| 177 | + if($iwUser instanceof UserRightsProxy) { |
| 178 | + $data[$u]['interwiki'] = ''; |
| 179 | + if(!is_null($params['token'])) |
| 180 | + { |
| 181 | + $tokenFunctions = $this->getTokenFunctions(); |
| 182 | + foreach($params['token'] as $t) |
| 183 | + { |
| 184 | + $val = call_user_func($tokenFunctions[$t], $iwUser); |
| 185 | + if($val === false) |
| 186 | + $this->setWarning("Action '$t' is not allowed for the current user"); |
| 187 | + else |
| 188 | + $data[$u][$t . 'token'] = $val; |
| 189 | + } |
| 190 | + } |
| 191 | + } else |
| 192 | + $data[$u]['missing'] = ''; |
| 193 | + } else { |
177 | 194 | if(isset($this->prop['groups']) && isset($data[$u]['groups'])) |
178 | 195 | $this->getResult()->setIndexedTagName($data[$u]['groups'], 'g'); |
179 | 196 | } |
Index: trunk/phase3/includes/specials/SpecialUserrights.php |
— | — | @@ -272,7 +272,7 @@ |
273 | 273 | * Side effects: error output for invalid access |
274 | 274 | * @return mixed User, UserRightsProxy, or WikiErrorMsg |
275 | 275 | */ |
276 | | - function fetchUser( $username ) { |
| 276 | + public static function fetchUser( $username ) { |
277 | 277 | global $wgUser, $wgUserrightsInterwikiDelimiter; |
278 | 278 | |
279 | 279 | $parts = explode( $wgUserrightsInterwikiDelimiter, $username ); |