r43763 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43762‎ | r43763 | r43764 >
Date:14:46, 20 November 2008
Author:catrope
Status:ok (Comments)
Tags:
Comment:
API: (bug 16398) meta=userinfo&uiprop=rights lists a right twice if it's granted to two groups the user is in
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUserInfo.php
@@ -76,7 +76,8 @@
7777 $result->setIndexedTagName($vals['groups'], 'g'); // even if empty
7878 }
7979 if (isset($this->prop['rights'])) {
80 - $vals['rights'] = $wgUser->getRights();
 80+ // User::getRights() may return duplicate values, strip them
 81+ $vals['rights'] = array_unique($wgUser->getRights());
8182 $result->setIndexedTagName($vals['rights'], 'r'); // even if empty
8283 }
8384 if (isset($this->prop['options'])) {
Index: trunk/phase3/RELEASE-NOTES
@@ -446,6 +446,7 @@
447447 sifilter parameter.
448448 * (bug 12760) meta=userinfo&uiprop=ratelimits doesn't list group-specific rate
449449 limits
 450+* (bug 16398) meta=userinfo&uiprop=rights lists some rights twice in some cases
450451
451452 === Languages updated in 1.14 ===
452453

Comments

#Comment by Bryan (talk | contribs)   19:53, 20 November 2008

Is there a reason for User::getRights to return duplicate values? I think the array_unique should be moved to User::getRights.

#Comment by Catrope (talk | contribs)   21:55, 20 November 2008

Why bother? AFAIK, there's no other part of the software that has a problem with these duplicates, so filtering them out seems like a waste of computing time.

Status & tagging log