Page MenuHomePhabricator

Prevent temporary users from being added to autopromote-once groups
Closed, ResolvedPublic

Description

This is for T330816: [Epic] Temporary users should not be assigned to user groups. See also T330816#8958447.

For related work on autopromote groups, see T340462: Special:UserRights should not list autopromote groups for temporary users.

PageUpdater::saveRevision add users to autopromote-once groups by calling UserGroupManager::addUserToAutopromoteOnceGroups. This returns an empty array for anon users, and should do the same for temporary users.

Since UserGroupManager::getUserAutopromoteOnceGroups is a public method, it should also be updated to return an empty array.

Related Objects

StatusSubtypeAssignedTask
Resolvedkostajh
DeclinedNone
In ProgressNiharika
OpenNone
OpenTchanders
OpenNone
ResolvedSTran
ResolvedUmherirrender
Resolved AGueyte
Duplicate AGueyte
ResolvedSTran
ResolvedDreamy_Jazz
ResolvedSTran
ResolvedSTran
ResolvedSTran
ResolvedSTran
ResolvedSTran
Openkostajh
ResolvedSTran
ResolvedTchanders
ResolvedSTran
ResolvedSTran
ResolvedSTran
Opensgrabarczuk
ResolvedSTran
ResolvedBUG REPORTDreamy_Jazz
ResolvedSTran
Resolved TThoabala
Resolved TThoabala
Resolved TThoabala
Resolved AGueyte
ResolvedBUG REPORT AGueyte
ResolvedBUG REPORT AGueyte
Resolved AGueyte
Resolved AGueyte
ResolvedCyndymediawiksim
DuplicateNone
OpenNone
ResolvedTchanders
ResolvedTchanders

Event Timeline

Tchanders updated the task description. (Show Details)

Change 933986 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/core@master] Disable autopromote-once for temporary users

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

Testing notes

Autopromoteonce is similar to autopromote, documented here: https://www.mediawiki.org/wiki/Manual:$wgAutopromoteOnce

This is easiest to test locally, since it relies on specific configuration.

Create an autopromoteonce group

Set something like the following configuration:

$wgAutopromoteOnce['onEdit'] = [
	'editedonce' => [
		'&',
		[ APCOND_EDITCOUNT, 1 ],
	],
];

This creates a group called 'editedonce', which users get autopromoted(-once) to after editing 1 time.

EITHER: Check groups on Special:UserRights

(If testing before T340458: Throw an error from API Userrights explaining that temporary users do not have groups is merged.)

  • Create a new temporary user by editing
  • Visit Special:UserRights/<the temp user's name>
  • Before this task, they would be reported as belonging to the group 'editedonce'. After it, they shouldn't.

Note that autopromoteonce groups are reported separately from autopromote groups on Special:UserRights:

Member of: <autopromoteonce groups>
Implicit member of: <autopromote groups>

OR: Check groups via maintenance/shell.php

If testing after T340458: Throw an error from API Userrights explaining that temporary users do not have groups is merged:

  • Create a new temporary user by editing
  • run the following in maintenance/shell.php:
use MediaWiki\MediaWikiServices;

$ugm = $MediaWikiServices::getInstance()->get('UserGroupManager');
$temp = User::newFromName('*Unregistered 100'); // Replace with your temp user's name

$ugm->addUserToAutopromoteOnceGroups($temp, 'edit'); // returns []
$ugm->getUserAutopromoteOnceGroups($temp, 'edit'); // returns []

Change 933986 merged by jenkins-bot:

[mediawiki/core@master] Disable autopromote-once for temporary users

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

@Tchanders Thanks for the config. I did not come across any issues of them belonging to the same group as seen in the screenshot with the new patch. The task will be moved to Done. Thanks for all your work!

Browsers: Chrome 114, Safari 16.5, Firefox 114
Skins: Vector, Monobook, Timeless
Environment: Local

Old Patch

T340646_IPMasking_AutoPromoteOnce_Old.png (868×3 px, 497 KB)

New Patch

T340646_IPMasking_AutoPromoteOnce_New.png (784×3 px, 420 KB)

Change 974186 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/core@master] User: Clarify that isNewbie does not include temp users

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

Change 974186 merged by jenkins-bot:

[mediawiki/core@master] User: Clarify that isNewbie() includes temp account users

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