API: Added uiprop=changeablegroups to meta=userinfo
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 26 Mar 2009 13:10:13 +0000 (13:10 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 26 Mar 2009 13:10:13 +0000 (13:10 +0000)
RELEASE-NOTES
includes/api/ApiQueryUserInfo.php

index 59cc122..582fc22 100644 (file)
@@ -342,6 +342,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 15935) Added action=userrights to add/remove users to/from groups
 * (bug 18099) Using appendtext to edit a non-existent page causes an interface
   message to be included in the page text
+* Added uiprop=changeablegroups to meta=userinfo
 
 === Languages updated in 1.15 ===
 
index 18feb70..a3b8a98 100644 (file)
@@ -80,6 +80,13 @@ class ApiQueryUserInfo extends ApiQueryBase {
                        $vals['rights'] = array_values(array_unique($wgUser->getRights()));
                        $result->setIndexedTagName($vals['rights'], 'r');       // even if empty
                }
+               if (isset($this->prop['changeablegroups'])) {
+                       $vals['changeablegroups'] = $wgUser->changeableGroups();
+                       $result->setIndexedTagName($vals['changeablegroups']['add'], 'g');
+                       $result->setIndexedTagName($vals['changeablegroups']['remove'], 'g');
+                       $result->setIndexedTagName($vals['changeablegroups']['add-self'], 'g');
+                       $result->setIndexedTagName($vals['changeablegroups']['remove-self'], 'g');
+               }
                if (isset($this->prop['options'])) {
                        $vals['options'] = (is_null($wgUser->mOptions) ? User::getDefaultOptions() : $wgUser->mOptions);
                }
@@ -144,6 +151,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
                                        'hasmsg',
                                        'groups',
                                        'rights',
+                                       'changeablegroups',
                                        'options',
                                        'preferencestoken',
                                        'editcount',
@@ -161,7 +169,8 @@ class ApiQueryUserInfo extends ApiQueryBase {
                                '  blockinfo  - tags if the current user is blocked, by whom, and for what reason',
                                '  hasmsg     - adds a tag "message" if the current user has pending messages',
                                '  groups     - lists all the groups the current user belongs to',
-                               '  rights     - lists of all rights the current user has',
+                               '  rights     - lists all the rights the current user has',
+                               '  changeablegroups - lists the groups the current user can add to and remove from',
                                '  options    - lists all preferences the current user has set',
                                '  editcount  - adds the current user\'s edit count',
                                '  ratelimits - lists all rate limits applying to the current user'