MediaWiki
1.28.0
|
The CentralIdLookup service allows for connecting local users with cluster-wide IDs. More...
Public Member Functions | |
centralIdFromLocalUser (User $user, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) | |
Given a local User object, return the central ID. More... | |
centralIdFromName ($name, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) | |
Given a (local) user name, return the central ID. More... | |
getProviderId () | |
isAttached (User $user, $wikiId=null) | |
Check that a User is attached on the specified wiki. More... | |
localUserFromCentralId ($id, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) | |
Given a central user ID, return a local User object. More... | |
lookupCentralIds (array $idToName, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) | |
Given central user IDs, return the (local) user names. More... | |
lookupUserNames (array $nameToId, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) | |
Given (local) user names, return the central IDs. More... | |
nameFromCentralId ($id, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) | |
Given a central user ID, return the (local) user name. More... | |
Static Public Member Functions | |
static | factory ($providerId=null) |
Fetch a CentralIdLookup. More... | |
static | resetCache () |
Reset internal cache for unit testing. More... | |
Public Attributes | |
const | AUDIENCE_PUBLIC = 1 |
const | AUDIENCE_RAW = 2 |
Public Attributes inherited from IDBAccessObject | |
const | READ_LOCKING = 3 |
Constants for object loading bitfield flags (higher => higher QoS) More... | |
const | READ_NONE = -1 |
Protected Member Functions | |
checkAudience ($audience) | |
Check that the "audience" parameter is valid. More... | |
Private Attributes | |
string | $providerId |
Static Private Attributes | |
static CentralIdLookup[] | $instances = [] |
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
Definition at line 29 of file CentralIdLookup.php.
CentralIdLookup::centralIdFromLocalUser | ( | User | $user, |
$audience = self::AUDIENCE_PUBLIC , |
|||
$flags = self::READ_NORMAL |
|||
) |
Given a local User object, return the central ID.
User | $user | Local user |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
Definition at line 212 of file CentralIdLookup.php.
References $flags, centralIdFromName(), User\getName(), and isAttached().
CentralIdLookup::centralIdFromName | ( | $name, | |
$audience = self::AUDIENCE_PUBLIC , |
|||
$flags = self::READ_NORMAL |
|||
) |
Given a (local) user name, return the central ID.
string | $name | Canonicalized user name |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
Definition at line 170 of file CentralIdLookup.php.
References $flags, $name, and lookupUserNames().
Referenced by centralIdFromLocalUser().
|
protected |
Check that the "audience" parameter is valid.
int | User | $audience | One of the audience constants, or a specific user |
InvalidArgumentException |
Definition at line 87 of file CentralIdLookup.php.
References User.
Referenced by LocalIdLookup\lookupCentralIds(), and LocalIdLookup\lookupUserNames().
|
static |
Fetch a CentralIdLookup.
string | null | $providerId | Provider ID from $wgCentralIdLookupProviders |
Definition at line 45 of file CentralIdLookup.php.
References $providerId, ObjectFactory\getObjectFromSpec(), and global.
Referenced by MediaWiki\Session\BotPasswordSessionProviderTest\addDBDataOnce(), SpecialBotPasswords\checkExecutePermissions(), ApiQueryUserInfo\getCentralUserInfo(), BotPassword\invalidateAllPasswordsForUser(), BotPassword\newFromUser(), BotPassword\newUnsaved(), BotPassword\removeAllPasswordsForUser(), ApiLoginTest\testBotPassword(), and CentralIdLookupTest\testFactory().
|
final |
Definition at line 77 of file CentralIdLookup.php.
References $providerId.
|
abstract |
Check that a User is attached on the specified wiki.
If unattached local accounts don't exist in your extension, this comes down to a check whether the central account exists at all and that $wikiId is using the same central database.
User | $user | |
string | null | $wikiId | Wiki to check attachment status. If null, check the current wiki. |
Referenced by centralIdFromLocalUser(), and localUserFromCentralId().
CentralIdLookup::localUserFromCentralId | ( | $id, | |
$audience = self::AUDIENCE_PUBLIC , |
|||
$flags = self::READ_NORMAL |
|||
) |
Given a central user ID, return a local User object.
int | $id | Central user ID |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
Definition at line 188 of file CentralIdLookup.php.
References $flags, $name, $user, isAttached(), nameFromCentralId(), and User\newFromName().
|
abstract |
Given central user IDs, return the (local) user names.
array | $idToName | Array with keys being central user IDs |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
Referenced by nameFromCentralId().
|
abstract |
Given (local) user names, return the central IDs.
array | $nameToId | Array with keys being canonicalized user names |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
Referenced by centralIdFromName().
CentralIdLookup::nameFromCentralId | ( | $id, | |
$audience = self::AUDIENCE_PUBLIC , |
|||
$flags = self::READ_NORMAL |
|||
) |
Given a central user ID, return the (local) user name.
int | $id | Central user ID |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
Definition at line 153 of file CentralIdLookup.php.
References $flags, and lookupCentralIds().
Referenced by localUserFromCentralId().
|
static |
Reset internal cache for unit testing.
Definition at line 70 of file CentralIdLookup.php.
Referenced by BotPasswordTest\setUp().
|
staticprivate |
Definition at line 35 of file CentralIdLookup.php.
|
private |
Definition at line 38 of file CentralIdLookup.php.
Referenced by factory(), and getProviderId().
const CentralIdLookup::AUDIENCE_PUBLIC = 1 |
Definition at line 31 of file CentralIdLookup.php.
Referenced by CentralIdLookupTest\testCheckAudience().
const CentralIdLookup::AUDIENCE_RAW = 2 |
Definition at line 32 of file CentralIdLookup.php.
Referenced by BotPassword\invalidateAllPasswordsForUser(), BotPassword\newFromUser(), BotPassword\newUnsaved(), BotPassword\removeAllPasswordsForUser(), CentralIdLookupTest\testCentralIdFromLocalUser(), CentralIdLookupTest\testCentralIdFromName(), CentralIdLookupTest\testCheckAudience(), CentralIdLookupTest\testLocalUserFromCentralId(), LocalIdLookupTest\testLookupCentralIds(), LocalIdLookupTest\testLookupUserNames(), and CentralIdLookupTest\testNameFromCentralId().