MediaWiki master
MediaWiki\User\MultiFormatUserIdentityLookup Class Reference

A service to look up user identities based on the user input. More...

Public Member Functions

 __construct (private readonly ActorStoreFactory $actorStoreFactory, private readonly UserFactory $userFactory, private readonly ServiceOptions $options,)
 
 getUserIdentity (string $designator, ?Authority $viewer=null)
 Looks up for a user identity based on the passed designator string.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

A service to look up user identities based on the user input.

This class is similar to UserIdentityLookup but allows to search for users using multiple input formats (e.g. user ID, user name, user name with interwiki suffix).

This service is designed to be of higher level than UserIdentityLookup and handy in places like special pages or API modules where the input can be in multiple formats. Additionally, this service allows to check for user rights, e.g. whether a hidden user should be returned or not.

Since
1.45

Definition at line 29 of file MultiFormatUserIdentityLookup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\MultiFormatUserIdentityLookup::__construct ( private readonly ActorStoreFactory $actorStoreFactory,
private readonly UserFactory $userFactory,
private readonly ServiceOptions $options )

Definition at line 37 of file MultiFormatUserIdentityLookup.php.

Member Function Documentation

◆ getUserIdentity()

MediaWiki\User\MultiFormatUserIdentityLookup::getUserIdentity ( string $designator,
?Authority $viewer = null )

Looks up for a user identity based on the passed designator string.

The designator can be in one of the following formats:

  • username (e.g. "Example"),
  • user ID (e.g. "#123"),
  • username or id with interwiki suffix (e.g. "Example@wiki", "#123@wiki"), where the separator between those two parts is defined by the wgUserrightsInterwikiDelimiter config option.

For interwiki users, this service assures that the remote wiki exists and is considered a local database (i.e. is listed in wgLocalDatabases).

Parameters
string$designator
Authority | null$viewer
Returns
Status<UserIdentity>

Definition at line 60 of file MultiFormatUserIdentityLookup.php.

References MediaWiki\MainConfigNames\LocalDatabases.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\MultiFormatUserIdentityLookup::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const LocalDatabases
Name constant for the LocalDatabases setting, for use with Config::get()
const UserrightsInterwikiDelimiter
Name constant for the UserrightsInterwikiDelimiter setting, for use with Config::get()
Access: internal

Definition at line 32 of file MultiFormatUserIdentityLookup.php.


The documentation for this class was generated from the following file: