Page MenuHomePhabricator

IP Masking: Change User::isRegistered() and User::isAnon() with User::isNamed in Growth-managed extensions
Closed, ResolvedPublic

Description

For the MVP of IP Masking, the Growth team wants temporary users to behave the same way as anonymous users (T327420#8998167), with the exception of notifications (see T330509). According to the IP Masking guide, this means we need to do the following changes in the codebase:

Current codeChange to
$user->isRegistered()$user->isNamed()
$user->isAnon()!$user->isNamed()

Those changes should be done in a batch of patches that gets merged relatively soon to avoid excessive merge conflicts. After that is done, the features should be checked on dewiki beta and/or locally (with IP Masking enabled, see betawiki config) for issues that might be IP Masking related, such as:

  • Temporary users have access to a feature or a component that should be only available to registered users, or
  • Registered users stopped having access to a feature that should be available to them

Changes made in this task should have no impact on the production wikis, unless and until IP Masking gets enabled there.

Components checklist

(Loosely based on the list from T326877: [Epic] Update Growth Team-owned products that may be affected by IP Masking; PageTriage not included because of T339252, Nuke not included because it has no calls to the relevant functions, Notifications not included because it should actually be available to temp users, NewUserActions/NewUserNotif removed because not Wikimedia-deployed and not responsible as per {MW.org docs](https://www.mediawiki.org/wiki/Developers/Maintainers))

Extensions
Core components

Event Timeline

Change 938830 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] IP Masking: Replace isRegistered/isAnon calls with isNamed()

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

Change 938966 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Add UserIdentityUtils service

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

matej_suchanek renamed this task from IP Masking: Change User::isRegistered() and User::isNamed() with User::isNamed in Growth-managed extensions to IP Masking: Change User::isRegistered() and User::isAnon() with User::isNamed in Growth-managed extensions.Jul 18 2023, 6:12 AM

Change 938966 merged by jenkins-bot:

[mediawiki/core@master] Add UserIdentityUtils service

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

Change 938830 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] IP Masking: Replace isRegistered/isAnon calls with isNamed()

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

Change 943552 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/NewUserMessage@master] IP Masking: Do not welcome temp users

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

GuidedTours/ORES extension appears to require no changes, checking off.

Change 944885 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] watchlist: Prepare for IP Masking

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

Change 943552 merged by jenkins-bot:

[mediawiki/extensions/NewUserMessage@master] IP Masking: Do not welcome temp users

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

We talked about whether it's easier to just disallow anonymous editing in Flow. For reference, this is how it looks:

normaldisallowed
Screenshot Capture - 2023-08-08 - 20-22-51.png (297×620 px, 33 KB)
Screenshot Capture - 2023-08-08 - 20-22-19.png (350×624 px, 42 KB)

It's not super straightforward to do because Flow uses the edit right for permission checks and we can't take that away, but hopefully still fairly straightforward.
Either we can use a permission hook to disallow anon edits to Flow pages, and hope that Flow checks permissions in a way that allows for that; or we can change FlowActions and declare a new flow-edit right.

Change 948208 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] watchlist: Prepare for IP Masking

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

Change 948208 merged by jenkins-bot:

[mediawiki/core@master] watchlist: Prepare for IP Masking

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

Change 944885 abandoned by Urbanecm:

[mediawiki/core@master] watchlist: Prepare for IP Masking

Reason:

in favour of I1ccda3878a658d4251429ae65ebee04c09d81243 (merged alternative)

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

Change 951203 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Allow watchlist UI for temp users with sufficient rights

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

Change 951203 merged by jenkins-bot:

[mediawiki/core@master] Allow watchlist UI for temp users with sufficient rights

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

Closing as Resolved. There are two components that I crossed from the description:

  • StructuredDiscussions: migration here is more challenging than elsewhere, and purely replacing calls as specified in the description here will not be sufficient. Split to T342831, where the work can be discussed & done.
  • RecentChanges: the only affected area is the recent changes filters, which is blocked on a product decision (T343322)

Apart from those components (which are tracked elsewhere), this is done.

Change 974929 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/core@master] Optimize and make UserIdentityUtils::isTemp/isNamed symetrical

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

Change 974929 abandoned by Thiemo Kreuz (WMDE):

[mediawiki/core@master] [POC] Optimize and make UserIdentityUtils::isTemp/isNamed symetrical

Reason:

Oh noes. :(

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