CentralAuthIdLookup::isAttached() takes a $wikiId parameter, but it also takes a UserIdentity object that has a wiki ID associated with it. We should enforce that the two wiki IDs match, to avoid programming errors. However, the last time we tried it, it caused problems with the GlobalUserPage extension (T374122).
Description
Details
Related Objects
Event Timeline
Change #1071006 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):
[mediawiki/extensions/CentralAuth@master] CentralAuthIdLookup: Assert that user belongs to the right wiki
Change #1070970 had a related patch set uploaded (by Bartosz Dziewoński; author: Zabe):
[mediawiki/extensions/GlobalUserPage@master] Do not use full User objects for cross-wiki stuff in GlobalUserPage
I'm not planning to work on this right now, it's free for taking if anyone wants to look into it. Current status is that the proposed GlobalUserPage change seems to work, but its CI isn't configured in a way that would allow the tests to pass with the change.
How about this:
- we create a UserNameIdentity interface, which is UserIdentity without the user ID (and existence checks / isRegistered; unlike UserIdentity)
- UserIdentity extends UserNameIdentity
- UserNameIdentityValue implements UserNameIdentity
- UserNameIdentity gets an isIP method, which is what isAnonymous should have been in a sane world (that needs UserNameUtils so we'd need a factory method or a slight DI violation to create UserNameIdentityValue objects, which is not ideal but not tragic either, User/UserIdentity need a factory as well)
- CentralIdLookup interfaces are relaxed to accept UserNameIdentity in place of UserIdentity
- wiki gets enforced like proposed here
Change #1071006 abandoned by Bartosz Dziewoński:
[mediawiki/extensions/CentralAuth@master] CentralAuthIdLookup: Assert that user belongs to the right wiki
Reason:
This does not seem worth the effort.