MediaWiki
1.30.0
|
Object holding data about a session's user. More...
Public Member Functions | |
__toString () | |
getId () | |
Return the user ID. More... | |
getName () | |
Return the user name. More... | |
getToken () | |
Return the user token. More... | |
getUser () | |
Return a User object. More... | |
isAnon () | |
Return whether this is an anonymous user. More... | |
isVerified () | |
Return whether this represents a verified user. More... | |
verified () | |
Return a verified version of this object. More... | |
Static Public Member Functions | |
static | newAnonymous () |
Create an instance for an anonymous (i.e. More... | |
static | newFromId ( $id, $verified=false) |
Create an instance for a logged-in user by ID. More... | |
static | newFromName ( $name, $verified=false) |
Create an instance for a logged-in user by name. More... | |
static | newFromUser (User $user, $verified=false) |
Create an instance from an existing User object. More... | |
Private Member Functions | |
__construct (User $user=null, $verified) | |
Private Attributes | |
User null | $user = null |
$verified = false | |
Object holding data about a session's user.
In general, this class exists for two purposes:
A UserInfo may be "verified". This indicates that the creator knows that the request really comes from that user, whether that's by validating OAuth credentials, SSL client certificates, or by having both the user ID and token available from cookies.
An "unverified" UserInfo should be used when it's not possible to authenticate the user, e.g. the user ID cookie is set but the user Token cookie isn't. If the Token is available but doesn't match, don't return a UserInfo at all.
Definition at line 51 of file UserInfo.php.
|
private |
Definition at line 57 of file UserInfo.php.
References MediaWiki\Session\UserInfo\$user, MediaWiki\Session\UserInfo\$verified, User\getName(), User\isAnon(), User\isUsableName(), user, and MediaWiki\Session\UserInfo\verified().
MediaWiki\Session\UserInfo::__toString | ( | ) |
Definition at line 177 of file UserInfo.php.
References MediaWiki\Session\UserInfo\getId(), MediaWiki\Session\UserInfo\getName(), user, and MediaWiki\Session\UserInfo\verified().
MediaWiki\Session\UserInfo::getId | ( | ) |
Return the user ID.
Definition at line 141 of file UserInfo.php.
References user.
Referenced by MediaWiki\Session\UserInfo\__toString().
MediaWiki\Session\UserInfo::getName | ( | ) |
Return the user name.
Definition at line 149 of file UserInfo.php.
References user.
Referenced by MediaWiki\Session\UserInfo\__toString().
MediaWiki\Session\UserInfo::getToken | ( | ) |
MediaWiki\Session\UserInfo::getUser | ( | ) |
Return a User object.
Definition at line 165 of file UserInfo.php.
References MediaWiki\Session\UserInfo\$user, user, and User.
MediaWiki\Session\UserInfo::isAnon | ( | ) |
Return whether this is an anonymous user.
Definition at line 124 of file UserInfo.php.
References user.
MediaWiki\Session\UserInfo::isVerified | ( | ) |
Return whether this represents a verified user.
Definition at line 132 of file UserInfo.php.
References MediaWiki\Session\UserInfo\$verified.
|
static |
Create an instance for an anonymous (i.e.
not logged in) user
Logged-out users are always "verified".
Definition at line 74 of file UserInfo.php.
References true.
Referenced by MediaWiki\Session\SessionManager\loadSessionInfoFromStore(), MediaWiki\Session\CookieSessionProvider\provideSessionInfo(), MediaWiki\Session\SessionInfoTest\testBasics(), MediaWiki\Session\SessionManagerTest\testGetEmptySession(), MediaWiki\Session\SessionManagerTest\testGetSessionForRequest(), and MediaWiki\Session\UserInfoTest\testNewAnonymous().
|
static |
Create an instance for a logged-in user by ID.
int | $id | User ID |
bool | $verified | True if the user is verified |
Definition at line 84 of file UserInfo.php.
References MediaWiki\Session\UserInfo\$user, MediaWiki\Session\UserInfo\$verified, User\isAnon(), User\load(), and User\newFromId().
Referenced by MediaWiki\Session\SessionManager\loadSessionInfoFromStore(), MediaWiki\Session\CookieSessionProvider\provideSessionInfo(), and MediaWiki\Session\UserInfoTest\testNewFromId().
|
static |
Create an instance for a logged-in user by name.
string | $name | User name (need not exist locally) |
bool | $verified | True if the user is verified |
Definition at line 102 of file UserInfo.php.
References $name, MediaWiki\Session\UserInfo\$user, MediaWiki\Session\UserInfo\$verified, and User\newFromName().
Referenced by MediaWiki\Session\SessionManager\loadSessionInfoFromStore(), MediaWiki\Session\SessionInfoTest\testBasics(), MediaWiki\Session\SessionBackendTest\testConstructor(), MediaWiki\Session\SessionManagerTest\testGetSessionForRequest(), MediaWiki\Session\SessionManagerTest\testGetSessionFromInfo(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), and MediaWiki\Session\UserInfoTest\testNewFromName().
Create an instance from an existing User object.
User | $user | (need not exist locally) |
bool | $verified | True if the user is verified |
Definition at line 116 of file UserInfo.php.
References MediaWiki\Session\UserInfo\$user, and MediaWiki\Session\UserInfo\$verified.
Referenced by MediaWiki\Session\SessionBackendTest\getBackend(), MediaWiki\Session\Session\BotPasswordSessionProvider\newSessionForRequest(), MediaWiki\Session\BotPasswordSessionProviderTest\testCheckSessionInfo(), MediaWiki\Session\UserInfoTest\testNewFromUser(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testPersistSession(), and MediaWiki\Auth\AuthManagerTest\testSecuritySensitiveOperationStatus().
MediaWiki\Session\UserInfo::verified | ( | ) |
Return a verified version of this object.
Definition at line 173 of file UserInfo.php.
References MediaWiki\Session\UserInfo\$user, and true.
Referenced by MediaWiki\Session\UserInfo\__construct(), and MediaWiki\Session\UserInfo\__toString().
|
private |
Definition at line 55 of file UserInfo.php.
Referenced by MediaWiki\Session\UserInfo\__construct(), MediaWiki\Session\UserInfo\getUser(), MediaWiki\Session\UserInfo\newFromId(), MediaWiki\Session\UserInfo\newFromName(), MediaWiki\Session\UserInfo\newFromUser(), and MediaWiki\Session\UserInfo\verified().
|
private |
Definition at line 52 of file UserInfo.php.
Referenced by MediaWiki\Session\UserInfo\__construct(), MediaWiki\Session\UserInfo\isVerified(), MediaWiki\Session\UserInfo\newFromId(), MediaWiki\Session\UserInfo\newFromName(), and MediaWiki\Session\UserInfo\newFromUser().