|
MediaWiki master
|
Find central user IDs associated with local user IDs, e.g. More...
Inherited by MediaWiki\User\CentralId\LocalIdLookup.
Public Member Functions | |
| centralIdFromLocalUser (UserIdentity $user, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given a local UserIdentity object, return the central ID. | |
| centralIdFromName ( $name, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given a (local) user name, return the central ID. | |
| centralIdsFromNames (array $names, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given an array of (local) user names, return the central IDs. | |
| getProviderId () | |
| getScope () | |
| Return a scope that can be used to differentiate the central IDs returned by this object from central IDs returned by different CentralIdLookup implementations and/or on different wikis of the same farm. | |
| init (string $providerId, UserIdentityLookup $userIdentityLookup, UserFactory $userFactory) | |
| Initialize the provider. | |
| isAttached (UserIdentity $user, $wikiId=UserIdentity::LOCAL) | |
| Check that a user is attached on the specified wiki. | |
| isOwned (UserIdentity $user, $wikiId=UserIdentity::LOCAL) | |
| Check that a username is owned by the central user on the specified wiki. | |
| localUserFromCentralId ( $id, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given a central user ID, return a local user object. | |
| lookupAttachedUserNames (array $nameToId, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL, $wikiId=UserIdentity::LOCAL) | |
| Given user names on the wiki specified by $wikiId, return the central IDs, but only include IDs for local users attached to the central user, i.e. | |
| lookupCentralIds (array $idToName, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given central user IDs, return the (local) user names. | |
| lookupOwnedUserNames (array $nameToId, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL, $wikiId=UserIdentity::LOCAL) | |
| Given user names on the wiki specified by $wikiId, return the central IDs, but only include IDs for local users owned by the central user, i.e. | |
| lookupUserNames (array $nameToId, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given (local) user names, return the central IDs. | |
| nameFromCentralId ( $id, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given a central user ID, return the (local) user name. | |
| namesFromCentralIds (array $ids, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL) | |
| Given a an array of central user IDs, return the (local) user names. | |
Public Attributes | |
| const | AUDIENCE_PUBLIC = 1 |
| const | AUDIENCE_RAW = 2 |
| const | FILTER_ATTACHED = 'attached' |
| const | FILTER_NONE = 'none' |
| const | FILTER_OWNED = 'owned' |
Protected Member Functions | |
| checkAudience ( $audience) | |
| Check that the "audience" parameter is valid. | |
| lookupUserNamesWithFilter (array $nameToId, $filter, $audience=self::AUDIENCE_PUBLIC, $flags=IDBAccessObject::READ_NORMAL, $wikiId=UserIdentity::LOCAL) | |
| Given user names on the wiki specified by $wikiId, return the central IDs. | |
Find central user IDs associated with local user IDs, e.g.
across a wiki farm.
Default implementation is MediaWiki\User\CentralId\LocalIdLookup.
Definition at line 27 of file CentralIdLookup.php.
| MediaWiki\User\CentralId\CentralIdLookup::centralIdFromLocalUser | ( | UserIdentity | $user, |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given a local UserIdentity object, return the central ID.
Unlike centralIdFromName(), this does guarantee that the local user is attached to the central account.
| UserIdentity | $user | Local user |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 351 of file CentralIdLookup.php.
References lookupAttachedUserNames().
| MediaWiki\User\CentralId\CentralIdLookup::centralIdFromName | ( | $name, | |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given a (local) user name, return the central ID.
There's no requirement that the user name actually exists locally, or if it does that it's actually attached to the central account.
| string | $name | Canonicalized user name |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 281 of file CentralIdLookup.php.
References lookupUserNames().
| MediaWiki\User\CentralId\CentralIdLookup::centralIdsFromNames | ( | array | $names, |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given an array of (local) user names, return the central IDs.
| string[] | $names | Canonicalized user names |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 296 of file CentralIdLookup.php.
References lookupUserNames().
|
protected |
Check that the "audience" parameter is valid.
| int | Authority | $audience | One of the audience constants, or a specific authority |
| InvalidArgumentException |
Definition at line 70 of file CentralIdLookup.php.
References if.
| MediaWiki\User\CentralId\CentralIdLookup::getProviderId | ( | ) |
Definition at line 60 of file CentralIdLookup.php.
References return.
Referenced by getScope(), and MediaWiki\User\CentralId\LocalIdLookup\getScope().
| MediaWiki\User\CentralId\CentralIdLookup::getScope | ( | ) |
Return a scope that can be used to differentiate the central IDs returned by this object from central IDs returned by different CentralIdLookup implementations and/or on different wikis of the same farm.
The scope will take the form of <provider-id>:<instance-id> where <provider-id> is the CentralIdLookup provider's ID (as in ::getProviderId()), and <instance-id> is used to differentiate between multiple instances of the same provider (e.g. could be a wiki ID for farms where each wiki has its own userbase); it is an arbitrary string (possibly empty) except it can't contain any more : characters.
Most subclasses should override the default implementation.
Reimplemented in MediaWiki\User\CentralId\LocalIdLookup.
Definition at line 376 of file CentralIdLookup.php.
References getProviderId(), and return.
| MediaWiki\User\CentralId\CentralIdLookup::init | ( | string | $providerId, |
| UserIdentityLookup | $userIdentityLookup, | ||
| UserFactory | $userFactory ) |
|
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.
| UserIdentity | $user | |
| string | false | $wikiId | Wiki to check attachment status. If false, check the current wiki. |
Reimplemented in MediaWiki\User\CentralId\LocalIdLookup.
References MediaWiki\DAO\WikiAwareEntity\LOCAL.
Referenced by isOwned().
| MediaWiki\User\CentralId\CentralIdLookup::isOwned | ( | UserIdentity | $user, |
| $wikiId = UserIdentity::LOCAL ) |
Check that a username is owned by the central user on the specified wiki.
This should return true if the local account exists and is attached (see isAttached()), or if it does not exist but is reserved for the central user (it's guaranteed that if it's ever created, then it will be attached to the central user).
| UserIdentity | $user | |
| string | false | $wikiId | Wiki to check attachment status. If false, check the current wiki. |
Definition at line 111 of file CentralIdLookup.php.
References isAttached(), MediaWiki\DAO\WikiAwareEntity\LOCAL, and return.
| MediaWiki\User\CentralId\CentralIdLookup::localUserFromCentralId | ( | $id, | |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given a central user ID, return a local user object.
Unlike nameFromCentralId(), this does guarantee that the local user exists and is attached to the central account.
| int | $id | Central user ID |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 323 of file CentralIdLookup.php.
References nameFromCentralId().
| MediaWiki\User\CentralId\CentralIdLookup::lookupAttachedUserNames | ( | array | $nameToId, |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL, | |||
| $wikiId = UserIdentity::LOCAL ) |
Given user names on the wiki specified by $wikiId, return the central IDs, but only include IDs for local users attached to the central user, i.e.
isAttached() would be true.
| array | $nameToId | Array with keys being canonicalized user names |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
| string | false | $wikiId | Wiki to check attachment status. If false, check the current wiki. |
Definition at line 192 of file CentralIdLookup.php.
References MediaWiki\DAO\WikiAwareEntity\LOCAL, and lookupUserNamesWithFilter().
Referenced by centralIdFromLocalUser().
|
abstract |
Given central user IDs, return the (local) user names.
There's no requirement that the user names actually exist locally, or if they do that they're actually attached to the central account.
| array | $idToName | Array with keys being central user IDs |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Reimplemented in MediaWiki\User\CentralId\LocalIdLookup.
Referenced by nameFromCentralId(), and namesFromCentralIds().
| MediaWiki\User\CentralId\CentralIdLookup::lookupOwnedUserNames | ( | array | $nameToId, |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL, | |||
| $wikiId = UserIdentity::LOCAL ) |
Given user names on the wiki specified by $wikiId, return the central IDs, but only include IDs for local users owned by the central user, i.e.
isOwned() would be true.
| array | $nameToId | Array with keys being canonicalized user names |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
| string | false | $wikiId | Wiki to check attachment status. If false, check the current wiki. |
Definition at line 167 of file CentralIdLookup.php.
References MediaWiki\DAO\WikiAwareEntity\LOCAL, and lookupUserNamesWithFilter().
| MediaWiki\User\CentralId\CentralIdLookup::lookupUserNames | ( | array | $nameToId, |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given (local) user names, return the central IDs.
There's no requirement that the user names actually exist locally, or if they do that they're actually attached to the central account.
| array | $nameToId | Array with keys being canonicalized user names |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 145 of file CentralIdLookup.php.
References FILTER_NONE, lookupUserNamesWithFilter(), and return.
Referenced by centralIdFromName(), and centralIdsFromNames().
|
abstractprotected |
Given user names on the wiki specified by $wikiId, return the central IDs.
If $filter is not FILTER_NONE, filter the users by owned or attached status.
| array | $nameToId | Array with keys being canonicalized user names |
| string | $filter | One of:
|
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
| string | false | $wikiId | Wiki to check attachment status. If false, check the current wiki. |
Reimplemented in MediaWiki\User\CentralId\LocalIdLookup.
References MediaWiki\DAO\WikiAwareEntity\LOCAL.
Referenced by lookupAttachedUserNames(), lookupOwnedUserNames(), and lookupUserNames().
| MediaWiki\User\CentralId\CentralIdLookup::nameFromCentralId | ( | $id, | |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given a central user ID, return the (local) user name.
There's no requirement that the user name actually exists locally, or if it does that it's actually attached to the central account.
| int | $id | Central user ID |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 241 of file CentralIdLookup.php.
References lookupCentralIds().
Referenced by localUserFromCentralId().
| MediaWiki\User\CentralId\CentralIdLookup::namesFromCentralIds | ( | array | $ids, |
| $audience = self::AUDIENCE_PUBLIC, | |||
| $flags = IDBAccessObject::READ_NORMAL ) |
Given a an array of central user IDs, return the (local) user names.
| int[] | $ids | Central user IDs |
| int | Authority | $audience | One of the audience constants, or a specific authority |
| int | $flags | IDBAccessObject read flags |
Definition at line 256 of file CentralIdLookup.php.
References lookupCentralIds().
| const MediaWiki\User\CentralId\CentralIdLookup::AUDIENCE_PUBLIC = 1 |
Definition at line 29 of file CentralIdLookup.php.
| const MediaWiki\User\CentralId\CentralIdLookup::AUDIENCE_RAW = 2 |
Definition at line 30 of file CentralIdLookup.php.
| const MediaWiki\User\CentralId\CentralIdLookup::FILTER_ATTACHED = 'attached' |
Definition at line 33 of file CentralIdLookup.php.
| const MediaWiki\User\CentralId\CentralIdLookup::FILTER_NONE = 'none' |
Definition at line 32 of file CentralIdLookup.php.
Referenced by lookupUserNames().
| const MediaWiki\User\CentralId\CentralIdLookup::FILTER_OWNED = 'owned' |
Definition at line 34 of file CentralIdLookup.php.