The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
More...
|
| centralIdFromLocalUser (User $user, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given a local User object, return the central ID.
|
|
| centralIdFromName ( $name, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given a (local) user name, return the central ID.
|
|
| centralIdsFromNames (array $names, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given an array of (local) user names, return the central IDs.
|
|
| getProviderId () |
|
| isAttached (User $user, $wikiId=null) |
| Check that a User is attached on the specified wiki.
|
|
| localUserFromCentralId ( $id, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given a central user ID, return a local User object.
|
|
| lookupCentralIds (array $idToName, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given central user IDs, return the (local) user names.
|
|
| lookupUserNames (array $nameToId, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given (local) user names, return the central IDs.
|
|
| nameFromCentralId ( $id, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given a central user ID, return the (local) user name.
|
|
| namesFromCentralIds (array $ids, $audience=self::AUDIENCE_PUBLIC, $flags=self::READ_NORMAL) |
| Given a an array of central user IDs, return the (local) user names.
|
|
|
| checkAudience ( $audience) |
| Check that the "audience" parameter is valid.
|
|
The CentralIdLookup service allows for connecting local users with cluster-wide IDs.
- Since
- 1.27
Definition at line 30 of file CentralIdLookup.php.
◆ centralIdFromLocalUser()
CentralIdLookup::centralIdFromLocalUser |
( |
User | $user, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
Given a local User object, return the central ID.
- Note
- Unlike centralIdFromName(), this does guarantee that the local user is attached to the central account.
- Parameters
-
User | $user | Local user |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
- Returns
- int User ID; 0 if the local user does not correspond to a central user, $audience lacks the rights needed to see it, or the central user isn't locally attached.
Definition at line 286 of file CentralIdLookup.php.
References User\getName().
◆ centralIdFromName()
CentralIdLookup::centralIdFromName |
( |
| $name, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
Given a (local) user name, return the central ID.
- Note
- There's no requirement that the user name actually exists locally, or if it does that it's actually attached to the central account.
- Parameters
-
string | $name | Canonicalized user name |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
- Returns
- int User ID; 0 if the name does not correspond to a user or $audience lacks the rights needed to see it.
Definition at line 223 of file CentralIdLookup.php.
◆ centralIdsFromNames()
CentralIdLookup::centralIdsFromNames |
( |
array | $names, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
Given an array of (local) user names, return the central IDs.
- Parameters
-
string[] | $names | Canonicalized user names |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
- Returns
- int[] User IDs
- Since
- 1.30
Definition at line 238 of file CentralIdLookup.php.
◆ checkAudience()
CentralIdLookup::checkAudience |
( |
| $audience | ) |
|
|
protected |
◆ factory()
static CentralIdLookup::factory |
( |
| $providerId = null | ) |
|
|
static |
◆ factoryNonLocal()
static CentralIdLookup::factoryNonLocal |
( |
| ) |
|
|
static |
Returns a CentralIdLookup that is guaranteed to be non-local.
If no such guarantee can be made, returns null.
If this function returns a non-null CentralIdLookup, that lookup is expected to provide IDs that are shared with some set of other wikis. However, you should still be cautious when using those IDs, as they will not necessarily work with all other wikis, and it can be hard to tell if another wiki is in the same set as this one or not.
- Since
- 1.34.3
- Returns
- CentralIdLookup|null
Definition at line 82 of file CentralIdLookup.php.
References factory().
◆ getProviderId()
CentralIdLookup::getProviderId |
( |
| ) |
|
|
final |
◆ isAttached()
CentralIdLookup::isAttached |
( |
User | $user, |
|
|
| $wikiId = null ) |
|
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.
- Parameters
-
User | $user | |
string | null | $wikiId | Wiki to check attachment status. If null, check the current wiki. |
- Returns
- bool
Reimplemented in LocalIdLookup.
◆ localUserFromCentralId()
CentralIdLookup::localUserFromCentralId |
( |
| $id, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
Given a central user ID, return a local User object.
- Note
- Unlike nameFromCentralId(), this does guarantee that the local user exists and is attached to the central account.
- Parameters
-
int | $id | Central user ID |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
- Returns
- User|null Local user, or null if: $id doesn't correspond to a user, $audience lacks the rights needed to see the user, the user doesn't exist locally, or the user isn't locally attached.
Definition at line 262 of file CentralIdLookup.php.
◆ lookupCentralIds()
CentralIdLookup::lookupCentralIds |
( |
array | $idToName, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
|
abstract |
Given central user IDs, return the (local) user names.
- Note
- There's no requirement that the user names actually exist locally, or if they do that they're actually attached to the central account.
- Parameters
-
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 |
- Returns
- array Copy of $idToName with values set to user names (or empty-string if the user exists but $audience lacks the rights needed to see it). IDs not corresponding to a user are unchanged.
Reimplemented in LocalIdLookup.
◆ lookupUserNames()
CentralIdLookup::lookupUserNames |
( |
array | $nameToId, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
|
abstract |
Given (local) user names, return the central IDs.
- Note
- There's no requirement that the user names actually exist locally, or if they do that they're actually attached to the central account.
- Parameters
-
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 |
- Returns
- array Copy of $nameToId with values set to central IDs. Names not corresponding to a user (or $audience lacks the rights needed to see it) are unchanged.
Reimplemented in LocalIdLookup.
◆ nameFromCentralId()
CentralIdLookup::nameFromCentralId |
( |
| $id, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
Given a central user ID, return the (local) user name.
- Note
- There's no requirement that the user name actually exists locally, or if it does that it's actually attached to the central account.
- Parameters
-
int | $id | Central user ID |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
- Returns
- string|null User name, or empty string if $audience lacks the rights needed to see it, or null if $id doesn't correspond to a user
Definition at line 185 of file CentralIdLookup.php.
◆ namesFromCentralIds()
CentralIdLookup::namesFromCentralIds |
( |
array | $ids, |
|
|
| $audience = self::AUDIENCE_PUBLIC, |
|
|
| $flags = self::READ_NORMAL ) |
Given a an array of central user IDs, return the (local) user names.
- Parameters
-
int[] | $ids | Central user IDs |
int | User | $audience | One of the audience constants, or a specific user |
int | $flags | IDBAccessObject read flags |
- Returns
- string[] User names
- Since
- 1.30
Definition at line 200 of file CentralIdLookup.php.
◆ resetCache()
static CentralIdLookup::resetCache |
( |
| ) |
|
|
static |
◆ $instances
◆ $providerId
string CentralIdLookup::$providerId |
|
private |
◆ AUDIENCE_PUBLIC
const CentralIdLookup::AUDIENCE_PUBLIC = 1 |
◆ AUDIENCE_RAW
const CentralIdLookup::AUDIENCE_RAW = 2 |
The documentation for this class was generated from the following file: