Page MenuHomePhabricator

Decide how to represent the identity of users from another wiki.
Open, MediumPublic


UserIdentity currently cannot fully represent the identity of users from another wiki: it cannot expose the user's ID on that wiki (see T222212: RevisionStore must not expose user IDs from a foreign wiki), and there is no good way to distinguish "local" from "remote" users.

The primary issue is that UserIdentity::getId (which inherites the usage and semantics of User::getId) is currenty interpreted to return a user ID on the local wiki. Returning from this method an ID that related to another wiki's database might be very confusing. Just adding a getWikiId() (or getDBDomain) method on UserIdentity will not fix this, since existing callers would be unaware that they need to check the new method.

One (somewhat hacky) option would be to return a string from getId(), and add a prefix to that string when the ID refers to a user from another wiki. We are already doing something similar with user names from imports, see (T111605, T20209, T9240). This would be backwards compatible thanks to the fact that PHP will interpret non-numerical strings as 0 when used in a numerical context. Though this would require user IDs to always cast to int before comparisons, or comparisons to use == and not ===.

A cleaner solution would be to leave getId() to return only local user IDs, and introduce new methods for the user's ID "at home". Finding good names may be tricky, though.

Event Timeline

daniel created this task.May 2 2019, 4:38 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 2 2019, 4:38 PM
Tgr added a subscriber: Tgr.May 2 2019, 5:01 PM
daniel updated the task description. (Show Details)May 2 2019, 5:24 PM
Tgr added a comment.May 2 2019, 5:27 PM

If we do something that requires major changes, it would be nice to be forward-looking and not limit this to user accounts on the same wiki farm. Even if other types of external users are not relevant for RevisionStore, we'll probably want to have a way to handle them in a future where networks of Wikibase installs pushing recent changes info to each other are more common. I filed T216112: Support data sharing in complex networks of MediaWiki wikis a while ago to track the high-level goal that IMO follows from our KaaS strategic direction; having some kind of truly global user identification would IMO be a big part of that.

Aside aside, we have three separate concepts of identification in wikifarms: wiki/database IDs (the sanest, can uniquely identify any wiki in the farm; but not used currently for users), central user IDs (used for storing global user information; not actually related to wikifarms conceptually, but auth methods) and interwikis (used to identify users in revision history / recent changes; also not conceptually related to wiki farms; not every wiki has an interwiki), so that mess should probably be sorted out somehow. (I'm hoping to find the time in the next few weeks to flesh out T221535: Provide a "wiki farm" abstraction in MediaWiki core into something closer to an RfC.)