Page MenuHomePhabricator

Check from UserRequirementsConditionChecker whether a user is performing the request
Closed, ResolvedPublic

Description

Technical background

The new service UserRequirementsConditionChecker is able to distinguish between a user performing the request and not.

Currently callers are supposed to pass to recursivelyCheckCondition whether the user is performing the request or not. However, callers do not always know this. Since UserRequirementsConditionChecker has access to the request context, it could determine whether or not the passed-in user is performing the request.

Bug 1

Special:UserRights displays autopromote groups for a user. Some autopromote conditions, such as APCOND_TOR, check the condition against the request (making the assumption that the user we are interested in is the user performing the request). This leads to incorrect reporting on Special:UserRights.

This is because UserGroupManager::getUserAutopromoteGroups and UserGroupManager::getUserAutopromoteOnceGroups do not pass in whether the user is performing the request, so the user is assumed to be performing the request.

This was an existing bug, but can be fixed now that we have UserRequirementsConditionChecker.

Bug 2

When checking restricted groups, RestrictedUserGroupChecker::doesTargetMeetConditions assumes that the target is not the performing user. However, they may be the performing user if the performing user is editing their own groups.

This is theoretical, as there are unlikely to be restricted groups that require their members to be the performing user at the time the group is added. However, correcting the assumption that the member is not the performing user may be worth doing, to avoid confusion in the future.

Acceptance criteria
  • Special:UserRights can display membership of a group that uses conditions that depend on featuresd of the request (e.g. APCOND_ISIP, APCOND_TOR) correctly if the target is the performing user
  • Special:UserRights displays that a target who is not the performing user is not a member of the group that uses request-specific conditions
  • Special:UserRights correctly treats a group as restricted, even when the target is also the performer

Event Timeline

mszwarc changed the task status from Open to In Progress.Nov 14 2025, 10:19 AM
mszwarc claimed this task.

Change #1205109 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/core@master] UserRequirementsConditionChecker: drop $isPerformingRequest

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

Change #1205133 had a related patch set uploaded (by Mszwarc; author: Mszwarc):

[mediawiki/core@master] UserGroupManagerTest: Test autopromotion with current user

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

Change #1205133 merged by jenkins-bot:

[mediawiki/core@master] UserGroupManagerTest: Test autopromotion with current user

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

Change #1205109 merged by jenkins-bot:

[mediawiki/core@master] UserRequirementsConditionChecker: drop $isPerformingRequest

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