[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Remove UserRightsProxy and replace its usages with UserGroupManager (remove in 1.42)
Closed, ResolvedPublic

Description

The UserRightsProxy was used to get/set groups for the users in foreign wikis. We need to remove all usages of this class, since now the correct way of accessing groups for users in the foreign wikis is to use UserGroupManagerFactory to create a manager pointing to the correct domain.

CodeSearch: https://codesearch.wmcloud.org/search/?q=UserRightsProxy&files=&excludeFiles=&repos=

Details

SubjectRepoBranchLines +/-
mediawiki/coremaster+101 -631
mediawiki/coremaster+45 -5
mediawiki/coremaster+12 -11
mediawiki/corewmf/1.41.0-wmf.22+23 -5
mediawiki/coremaster+23 -5
mediawiki/coremaster+47 -34
mediawiki/extensions/BatchUserRightsmaster+6 -30
mediawiki/coremaster+4 -2
mediawiki/coremaster+33 -46
mediawiki/coremaster+1 -1
mediawiki/extensions/CentralAuthmaster+48 -201
mediawiki/extensions/GlobalUserrightsmaster+5 -4
mediawiki/corewmf/1.41.0-wmf.19+33 -46
mediawiki/coremaster+46 -33
mediawiki/coremaster+30 -14
mediawiki/coremaster+134 -26
mediawiki/extensions/Echomaster+7 -4
mediawiki/extensions/CentralAuthmaster+3 -4
mediawiki/coremaster+3 -0
mediawiki/coremaster+69 -19
Show related patches Customize query in gerrit

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 762064 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/core@master] Formally deprecate UserRightsProxy

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

Change 762064 merged by jenkins-bot:

[mediawiki/core@master] Formally deprecate UserRightsProxy

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

Something interesting came out while grepping usages: T301642. That needs to be fixed somehow. Making it not use UserrightsPage at all would be nice.

What should be used for invalidateCache? Should UserRightsManager have something that can do that, or should it go elsewhere?

What should be used for invalidateCache? Should UserRightsManager have something that can do that, or should it go elsewhere?

UserRightsProxy is only there for changing user rights cross-wiki. There is UserGroupManager::clearCache(), which cleans cached group memberships for some user identity. I don't think more is needed since changing the user rights cross-wiki doesn't actually touch the user table.

It changes the user table for the other wiki, right? Surely that's why UserRightsProxy::invalidateCache exists to begin with?

I'll try to give my two cents, but @Zabe and @Urbanecm probably have a better understanding of the intended and current semantics.

So here's my current take:

  • historically, SpecialGlobalGroupMembership used to extend UserrightsPage. It used to override fetchUser, and returned a CentralAuthGroupMembershipProxy instead of the UserrightsProxy that the base class would return. CentralAuthGroupMembershipProxy was made to be duck-type compatible with UserrightsProxy, and everything relied on that fact.
  • Zabe fixed this recently, in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/738574. Now, SpecialGlobalGroupMembership is independent of UserrightsPage, and CentralAuthGroupMembershipProxy is independent of UserrightsProxy. That should make this task here a whole lot simpler!
  • This means that UserrightsPage no longer needs to support cross-wiki functionality at all. (Is that correct? Please let me know if I am mistaking here!)
  • Methods like saveSettings() and invalidateCache() can become private methods in UserrightsPage.

One more thing for context, because I saw it discussed elsewhere and now I can't find it: Title and WikiPage are guaranteed to be local. Making them support non-local pages would break that guarantee and violate LSP!

  • This means that UserrightsPage no longer needs to support cross-wiki functionality at all. (Is that correct? Please let me know if I am mistaking here!)

Core still needs to support the raw interwiki rights syntax (Username@dbnamewiki).

In T255309#7876308, @Majavah wrote:

Core still needs to support the raw interwiki rights syntax (Username@dbnamewiki).

Darn. Ok then.

I think it should be still possible to do the following:

  • create a getUserIdentity() method, and use it instead of fetchUser().
  • change all code in UserrightsPage that currently operates on a User or UserrightsProxy to operate on a UserIdentity. Move all logic from UserrightsProxy into UserrightsPage. Make sure to use the correct DB connection (and the correct UserGroupManager) per UserIdentity::getWikiId().
  • deprecate fetchUser, and make UserrightsProxy a stub. It can have the UserrightsPage injected, and delegate all calls back to UserrightsPage (the relevant methods on UserrightsPage should be tagged @internal).

Note the following code in the constructor of UserrightsdPage:

		// TODO don't hard code false, use interwiki domains. See T14518
		$this->userGroupManager = ( $userGroupManagerFactory ?? $services->getUserGroupManagerFactory() )
			->getUserGroupManager( false );

My suggestion above should fix that, I hope.

FTR, I made an attempt at removing usages of UserRightsProxy: r762507. I remember having a few doubts as to how to proceed, though. One of those questions was whether it would be better/easier to do something like r762118 (ChangeUserGroups command) first, or the other way around.

Simetrical renamed this task from Remove UserRightsProxy and replace it's usages with UserGroupManager to Remove UserRightsProxy and replace its usages with UserGroupManager.Apr 26 2022, 3:03 PM

So a basic question: if I have the ID of a non-local wiki, how do I find out the corresponding database domain? This is necessary to implement UserRightsProxy::invalidateCache as a method of UserrightsPage.

So a basic question: if I have the ID of a non-local wiki, how do I find out the corresponding database domain? This is necessary to implement UserRightsProxy::invalidateCache as a method of UserrightsPage.

For now we can assume that the wiki ID *is* the database domain. Or at least we can assume that the LoadBalancer will treat it as an alias.

Change 786318 had a related patch set uploaded (by Simetrical; author: Simetrical):

[mediawiki/core@master] Remove UserRightsProxy

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

Change 787917 had a related patch set uploaded (by Simetrical; author: Simetrical):

[mediawiki/extensions/CentralAuth@master] Try converting special page to UserIdentity

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

Change 787920 had a related patch set uploaded (by Simetrical; author: Simetrical):

[mediawiki/extensions/Echo@master] Don't mention deprecated UserRightsProxy

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

Change 787920 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Don't mention deprecated UserRightsProxy

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

Change 787917 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Remove mentions of deprecated UserRightsProxy

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

Change 890510 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] [DNM] PoC: Create a UserIdentityCacheUpdater service

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

Change 890510 merged by jenkins-bot:

[mediawiki/core@master] user: Move UserRightsProxy::invalidateCache to UserFactory

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

Change 914900 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] user: Assert wikiId in UserGroupManager

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

Change 914900 merged by jenkins-bot:

[mediawiki/core@master] user: Assert wikiId in UserGroupManager

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

Change 923706 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights

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

Change 923706 merged by jenkins-bot:

[mediawiki/core@master] specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights

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

Change 941516 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/GlobalUserrights@master] Adjust doc type to UserIdentity

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

Change 941519 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/BatchUserRights@master] Use cross-wiki aware UserIdentityLookup on Special:BatchUserRights

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

Change 941522 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/CentralAuth@master] Inline calls to CentralAuthGroupMembershipProxy and remove proxy

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

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

[mediawiki/core@master] Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights"

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

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

[mediawiki/core@wmf/1.41.0-wmf.19] Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights"

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

Change 941877 merged by jenkins-bot:

[mediawiki/core@wmf/1.41.0-wmf.19] Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights"

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

Mentioned in SAL (#wikimedia-operations) [2023-07-26T14:00:51Z] <urbanecm@deploy1002> Started scap: Backport for [[gerrit:941877|Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights" (T255309 T342747)]]

Mentioned in SAL (#wikimedia-operations) [2023-07-26T14:02:29Z] <urbanecm@deploy1002> urbanecm: Backport for [[gerrit:941877|Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights" (T255309 T342747)]] synced to the testservers mwdebug2001.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug2002.codfw.wmnet, mwdebug1002.eqiad.wmnet, and mw-debug kubernetes deployment (accessible via k8s-experimental XWD option)

Mentioned in SAL (#wikimedia-operations) [2023-07-26T14:13:25Z] <urbanecm@deploy1002> Finished scap: Backport for [[gerrit:941877|Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights" (T255309 T342747)]] (duration: 12m 33s)

Change 941968 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] user: Call UserFactory::invalidateCache for user group changes

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

Change 941516 merged by Umherirrender:

[mediawiki/extensions/GlobalUserrights@master] Adjust doc type to UserIdentity

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

Change 941876 merged by jenkins-bot:

[mediawiki/core@master] Revert "specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights"

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

Change 941513 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] maintenance: Remove UserRightsProxy from CreateAndPromote::addLogEntry

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

Change 941522 abandoned by Umherirrender:

[mediawiki/extensions/CentralAuth@master] Inline calls to CentralAuthGroupMembershipProxy and remove proxy

Reason:

I am go with If2722377dcce5349b4ed8dc2507f9e7a1dcaa9a5

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

Change 941513 merged by jenkins-bot:

[mediawiki/core@master] maintenance: Remove UserRightsProxy from CreateAndPromote::addLogEntry

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

Change 944188 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights

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

Change 941968 abandoned by Umherirrender:

[mediawiki/core@master] user: Call UserFactory::invalidateCache for user group changes

Reason:

Moved to https://gerrit.wikimedia.org/r/c/mediawiki/core/+/944188

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

Change 941519 merged by jenkins-bot:

[mediawiki/extensions/BatchUserRights@master] Remove cross-wiki user right change support from Special:BatchUserRights

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

Change 944188 merged by jenkins-bot:

[mediawiki/core@master] specials: Use cross-wiki aware UserIdentityLookup on Special:UserRights

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

Change 949939 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] cross-wiki userrights: Add SpecialUserRights::getDisplayName

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

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

[mediawiki/core@wmf/1.41.0-wmf.22] cross-wiki userrights: Add SpecialUserRights::getDisplayUsername

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

Change 949939 merged by jenkins-bot:

[mediawiki/core@master] cross-wiki userrights: Add SpecialUserRights::getDisplayUsername

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

Change 949582 merged by jenkins-bot:

[mediawiki/core@wmf/1.41.0-wmf.22] cross-wiki userrights: Add SpecialUserRights::getDisplayUsername

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

Mentioned in SAL (#wikimedia-operations) [2023-08-17T13:23:05Z] <urbanecm@deploy1002> Started scap: Backport for [[gerrit:949582|cross-wiki userrights: Add SpecialUserRights::getDisplayUsername (T344391 T255309)]], [[gerrit:949577|revalidateLinkRecommendations: Make it possible to revalidate based on score (T316079)]], [[gerrit:949576|revalidateLinkRecommendations: Make it possible to revalidate based on score (T316079)]]

Mentioned in SAL (#wikimedia-operations) [2023-08-17T13:23:55Z] <urbanecm@deploy1002> urbanecm: Backport for [[gerrit:949582|cross-wiki userrights: Add SpecialUserRights::getDisplayUsername (T344391 T255309)]], [[gerrit:949577|revalidateLinkRecommendations: Make it possible to revalidate based on score (T316079)]], [[gerrit:949576|revalidateLinkRecommendations: Make it possible to revalidate based on score (T316079)]] synced to the testservers mwdebug2001.codfw.wmnet, mwdebug2002.c

Mentioned in SAL (#wikimedia-operations) [2023-08-17T13:28:52Z] <urbanecm@deploy1002> Finished scap: Backport for [[gerrit:949582|cross-wiki userrights: Add SpecialUserRights::getDisplayUsername (T344391 T255309)]], [[gerrit:949577|revalidateLinkRecommendations: Make it possible to revalidate based on score (T316079)]], [[gerrit:949576|revalidateLinkRecommendations: Make it possible to revalidate based on score (T316079)]] (duration: 05m 46s)

Change 950003 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] cross-wiki userrights: Restore hook compatibility

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

Change 950003 merged by jenkins-bot:

[mediawiki/core@master] cross-wiki userrights: Restore hook compatibility

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

Change 953329 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] user: Hard-deprecate UserRightsProxy

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

Change 953329 merged by jenkins-bot:

[mediawiki/core@master] user: Hard-deprecate UserRightsProxy

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

Umherirrender renamed this task from Remove UserRightsProxy and replace its usages with UserGroupManager to Remove UserRightsProxy and replace its usages with UserGroupManager (remove in 1.42).Aug 29 2023, 7:34 PM
Umherirrender changed the task status from Open to Stalled.
Umherirrender removed a project: Patch-For-Review.
Umherirrender changed the task status from Stalled to Open.Oct 13 2023, 3:47 PM

Change 966656 had a related patch set uploaded (by Daniel Kinzler; author: Tim Starling):

[mediawiki/core@master] Remove UserRightsProxy

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

Umherirrender removed a project: Patch-For-Review.

Change 966656 had a related patch set uploaded (by Daniel Kinzler; author: Tim Starling):

[mediawiki/core@master] Remove UserRightsProxy

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

Now merged

Change 786318 abandoned by Umherirrender:

[mediawiki/core@master] Remove UserRightsProxy

Reason:

It's done, the class was now removed with Icb3395dfc53a4441b667f001ac1227f36d1f2e8d

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