From 3d33524baab49d56128b6c7a694037e0eeac30fc Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 26 Mar 2009 13:10:13 +0000 Subject: [PATCH] API: Added uiprop=changeablegroups to meta=userinfo --- RELEASE-NOTES | 1 + includes/api/ApiQueryUserInfo.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 59cc122585..582fc22732 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 18feb7071b..a3b8a98a2f 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -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' -- 2.20.1