Page MenuHomePhabricator

Global group membership cannot be changed
Closed, ResolvedPublic

Description

Hello,

I am unable to change group membership, despite having globalgroupmembership should allow me to add/remove anyone from any global group.

Special:GlobalUserRights/Martin_Urbanec at meta looks like this:

image.png (798×950 px, 57 KB)

I can demote myself from steward, or promote someone else to steward, but not add other global groups.

Since this blocks steward's work significantly, I am boldly triaging this as a train blocker. I have verified this was caused in wmf.34 by temporarily adding globalgrouppermissions to the global steward group, and loading the page at cswiki.

Best,
Martin

Event Timeline

Trying via the api on the beta cluster:

{
    "error": {
        "code": "internal_api_error_Error",
        "info": "[XtAeOqwQBHcAAH9Vo68AAAAR] Exception caught: Cannot use object of type User as array",
        "errorclass": "Error",
        "trace": "Error at /srv/mediawiki/php-master/extensions/CentralAuth/includes/specials/SpecialGlobalGroupMembership.php(107)\n#0 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(147): SpecialGlobalGroupMembership->fetchUser(User)\n#1 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(103): ApiUserrights->getUrUser(array)\n#2 /srv/mediawiki/php-master/includes/api/ApiMain.php(1583): ApiUserrights->execute()\n#3 /srv/mediawiki/php-master/includes/api/ApiMain.php(523): ApiMain->executeAction()\n#4 /srv/mediawiki/php-master/includes/api/ApiMain.php(494): ApiMain->executeActionWithErrorHandling()\n#5 /srv/mediawiki/php-master/api.php(84): ApiMain->execute()\n#6 /srv/mediawiki/w/api.php(3): require(string)\n#7 {main}"
    },
    "servedby": "deployment-mediawiki-07"
}
Stack trace
Error at /srv/mediawiki/php-master/extensions/CentralAuth/includes/specials/SpecialGlobalGroupMembership.php(107)
#0 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(147): SpecialGlobalGroupMembership->fetchUser(User)
#1 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(103): ApiUserrights->getUrUser(array)
#2 /srv/mediawiki/php-master/includes/api/ApiMain.php(1583): ApiUserrights->execute()
#3 /srv/mediawiki/php-master/includes/api/ApiMain.php(523): ApiMain->executeAction()
#4 /srv/mediawiki/php-master/includes/api/ApiMain.php(494): ApiMain->executeActionWithErrorHandling()
#5 /srv/mediawiki/php-master/api.php(84): ApiMain->execute()
#6 /srv/mediawiki/w/api.php(3): require(string)
#7 {main}

That being said, I believe the issue is unrelated the the error above. UserrightsPage::changeableGroups and some other methods were made private (had no visibility), and SpecialGlobalGroupMembership tries to override them

Change 599432 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] UserrightsPage: Restore public visibility

https://gerrit.wikimedia.org/r/599432

SpecialUserRights->fetchUser and SpecialGlobalGroupMembership->fetchUser both expect a string username.

But:

#0 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(147): SpecialGlobalGroupMembership->fetchUser(User)
#1 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(103): ApiUserrights->getUrUser(array)

.. indicates that ApiUserrights->getUrUser is sending down a User object instead. Where does ApiUserrights get it from? Did that change recently?

SpecialUserRights->fetchUser and SpecialGlobalGroupMembership->fetchUser both expect a string username.

But:

#0 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(147): SpecialGlobalGroupMembership->fetchUser(User)
#1 /srv/mediawiki/php-master/includes/api/ApiUserrights.php(103): ApiUserrights->getUrUser(array)

.. indicates that ApiUserrights->getUrUser is sending down a User object instead. Where does ApiUserrights get it from? Did that change recently?

Couldn't find anything that changed that recently, but is it possible that the bug was there previously and wasn't seen?
getUrUser should be sending $params['user'] ?? '#' . $params['userid']; which is a string

@Urbanecm What is the error exactly? Or is there no program error?

[…]

.. indicates that ApiUserrights->getUrUser is sending down a User object instead. Where does ApiUserrights get it from? Did that change recently?

Couldn't find anything that changed that recently, but is it possible that the bug was there previously and wasn't seen?
getUrUser should be sending $params['user'] ?? '#' . $params['userid']; which is a string

It isn't a string, but I agree that it should be indeed. This might explain why:

ApiUserrights.php
			'user' => [
				ApiBase::PARAM_TYPE => 'user',
				¬
				UserDef::PARAM_RETURN_OBJECT => true,

Anyway, I suggest we move this to a different ticket as this error is not happening in production and possibly not related to the current report.

@Urbanecm What is the error exactly? Or is there no program error?

There is no exception, it just claims I can't change the rights. Screenshot is in description. Danny's patch should fix this (thanks), althrough setting UserrightsPage::changeableGroups to protected should be enough for this particular bug.

Change 599438 had a related patch set uploaded (by Reedy; owner: DannyS712):
[mediawiki/core@wmf/1.35.0-wmf.34] UserrightsPage: Restore visibility (previously implicitely public)

https://gerrit.wikimedia.org/r/599438

Change 599438 merged by jenkins-bot:
[mediawiki/core@wmf/1.35.0-wmf.34] UserrightsPage: Restore visibility (previously implicitely public)

https://gerrit.wikimedia.org/r/599438

Change 599432 merged by jenkins-bot:
[mediawiki/core@master] UserrightsPage: Restore visibility (previously implicitely public)

https://gerrit.wikimedia.org/r/599432

Mentioned in SAL (#wikimedia-operations) [2020-05-28T21:12:17Z] <jforrester@deploy1001> Synchronized php-1.35.0-wmf.34/includes/specials/SpecialUserrights.php: T253909 Restore visibility (previously implicitely public) (duration: 01m 06s)

Jdforrester-WMF subscribed.

I can now set your global groups again. :-)