r48873 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r48872 | r48873 (on ViewVC) | r48874 >
Date:13:10, 26 March 2009
Author:catrope
Status:ok
Tags:api 
Comment:API: Added uiprop=changeablegroups to meta=userinfo
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUserInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryUserInfo.php	(revision 48872)
+++ trunk/phase3/includes/api/ApiQueryUserInfo.php	(revision 48873)
@@ -80,6 +80,13 @@
 			$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 @@
 					'hasmsg',
 					'groups',
 					'rights',
+					'changeablegroups',
 					'options',
 					'preferencestoken',
 					'editcount',
@@ -161,7 +169,8 @@
 				'  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'
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 48872)
+++ trunk/phase3/RELEASE-NOTES	(revision 48873)
@@ -342,6 +342,7 @@
 * (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 ===
 

Status & tagging log

Views
Toolbox