MediaWiki
1.27.3
|
Utility class for bot passwords. More...
Public Member Functions | |
delete () | |
Delete the BotPassword from the database. More... | |
getAppId () | |
Get the app ID. More... | |
getGrants () | |
Get the grants. More... | |
getRestrictions () | |
Get the restrictions. More... | |
getToken () | |
Get the token. More... | |
getUserCentralId () | |
Get the central user ID. More... | |
isSaved () | |
Indicate whether this is known to be saved. More... | |
save ($operation, Password $password=null) | |
Save the BotPassword to the database. More... | |
Static Public Member Functions | |
static | getDB ($db) |
Get a database connection for the bot passwords database. More... | |
static | getSeparator () |
Get the separator for combined user name + app ID. More... | |
static | invalidateAllPasswordsForCentralId ($centralId) |
Invalidate all passwords for a user, by central ID. More... | |
static | invalidateAllPasswordsForUser ($username) |
Invalidate all passwords for a user, by name. More... | |
static | login ($username, $password, WebRequest $request) |
Try to log the user in. More... | |
static | newFromCentralId ($centralId, $appId, $flags=self::READ_NORMAL) |
Load a BotPassword from the database. More... | |
static | newFromUser (User $user, $appId, $flags=self::READ_NORMAL) |
Load a BotPassword from the database. More... | |
static | newUnsaved (array $data, $flags=self::READ_NORMAL) |
Create an unsaved BotPassword. More... | |
static | removeAllPasswordsForCentralId ($centralId) |
Remove all passwords for a user, by central ID. More... | |
static | removeAllPasswordsForUser ($username) |
Remove all passwords for a user, by name. More... | |
Public Attributes | |
const | APPID_MAXLENGTH = 32 |
Public Attributes inherited from IDBAccessObject | |
const | READ_EXCLUSIVE = 7 |
const | READ_LATEST = 1 |
const | READ_LOCKING = 3 |
const | READ_NONE = -1 |
const | READ_NORMAL = 0 |
Protected Member Functions | |
__construct ($row, $isSaved, $flags=self::READ_NORMAL) | |
getPassword () | |
Get the password. More... | |
Private Attributes | |
string | $appId |
int | $centralId |
int | $flags = self::READ_NORMAL |
string[] | $grants |
bool | $isSaved |
MWRestrictions | $restrictions |
string | $token |
|
protected |
object | $row | bot_passwords database row |
bool | $isSaved | Whether the bot password was read from the database |
int | $flags | IDBAccessObject read flags |
Definition at line 57 of file BotPassword.php.
References $flags, $isSaved, FormatJson\decode(), flags, isSaved(), and MWRestrictions\newFromJson().
BotPassword::delete | ( | ) |
Delete the BotPassword from the database.
Definition at line 309 of file BotPassword.php.
References $appId, $centralId, DB_MASTER, and isSaved().
BotPassword::getAppId | ( | ) |
Get the app ID.
Definition at line 197 of file BotPassword.php.
References $appId.
Referenced by MediaWiki\Session\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Get a database connection for the bot passwords database.
int | $db | Index of the connection to get, e.g. DB_MASTER or DB_SLAVE. |
Definition at line 73 of file BotPassword.php.
References global, wfGetLB(), and wfGetLBFactory().
Referenced by SpecialBotPasswords\getFormFields().
BotPassword::getGrants | ( | ) |
Get the grants.
Definition at line 221 of file BotPassword.php.
References $grants.
Referenced by MediaWiki\Session\Session\BotPasswordSessionProvider\newSessionForRequest().
|
protected |
Get the password.
Definition at line 238 of file BotPassword.php.
References $options, flags, DBAccessObjectUtils\getDBOptions(), RequestContext\getMain(), list, and PasswordFactory\newInvalidPassword().
BotPassword::getRestrictions | ( | ) |
Get the restrictions.
Definition at line 213 of file BotPassword.php.
References $restrictions.
|
static |
Get the separator for combined user name + app ID.
Definition at line 229 of file BotPassword.php.
References global.
Referenced by ApiLogin\execute(), SpecialBotPasswords\getFormFields(), SpecialBotPasswords\onSuccess(), BotPasswordTest\testBasics(), and ApiLoginTest\testBotPassword().
BotPassword::getToken | ( | ) |
Get the token.
Definition at line 205 of file BotPassword.php.
References $token.
Referenced by MediaWiki\Session\Session\BotPasswordSessionProvider\newSessionForRequest().
BotPassword::getUserCentralId | ( | ) |
Get the central user ID.
Definition at line 189 of file BotPassword.php.
References $centralId.
Referenced by MediaWiki\Session\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Invalidate all passwords for a user, by central ID.
int | $centralId |
Definition at line 341 of file BotPassword.php.
References DB_MASTER, global, and PasswordFactory\newInvalidPassword().
|
static |
Invalidate all passwords for a user, by name.
string | $username | User name |
Definition at line 329 of file BotPassword.php.
References $username, CentralIdLookup\AUDIENCE_RAW, CentralIdLookup\factory(), and IDBAccessObject\READ_LATEST.
Referenced by MediaWiki\Auth\AuthManager\changeAuthenticationData(), and BotPasswordTest\testInvalidateAllPasswordsForUser().
BotPassword::isSaved | ( | ) |
Indicate whether this is known to be saved.
Definition at line 181 of file BotPassword.php.
References $isSaved.
Referenced by __construct(), delete(), and save().
|
static |
Try to log the user in.
string | $username | Combined user name and app ID |
string | $password | Supplied password |
WebRequest | $request |
Definition at line 398 of file BotPassword.php.
References $name, $status, $user, $username, class, global, list, Status\newFatal(), User\newFromName(), Status\newGood(), and MediaWiki\Session\SessionManager\singleton().
Referenced by ApiLogin\execute(), and BotPasswordTest\testLogin().
|
static |
Load a BotPassword from the database.
int | $centralId | from CentralIdLookup |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 103 of file BotPassword.php.
References $flags, $options, DBAccessObjectUtils\getDBOptions(), global, and list.
Referenced by SpecialBotPasswords\getFormFields(), SpecialBotPasswords\onSubmit(), MediaWiki\Session\Session\BotPasswordSessionProvider\refreshSessionInfo(), BotPasswordTest\testGetPassword(), BotPasswordTest\testInvalidateAllPasswordsForUser(), BotPasswordTest\testRemoveAllPasswordsForUser(), and BotPasswordTest\testSave().
|
static |
Load a BotPassword from the database.
User | $user | |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 89 of file BotPassword.php.
References CentralIdLookup\AUDIENCE_RAW, and CentralIdLookup\factory().
Referenced by BotPasswordTest\testBasics(), MediaWiki\Session\BotPasswordSessionProviderTest\testCheckSessionInfo(), and MediaWiki\Session\BotPasswordSessionProviderTest\testNewSessionInfoForRequest().
|
static |
Create an unsaved BotPassword.
array | $data | Data to use to create the bot password. Keys are:
|
int | $flags | IDBAccessObject read flags |
Definition at line 134 of file BotPassword.php.
References $flags, CentralIdLookup\AUDIENCE_RAW, FormatJson\encode(), CentralIdLookup\factory(), MWRestrictions\newDefault(), and object.
Referenced by SpecialBotPasswords\getFormFields(), SpecialBotPasswords\save(), BotPasswordTest\testSave(), and BotPasswordTest\testUnsaved().
|
static |
Remove all passwords for a user, by central ID.
int | $centralId |
Definition at line 375 of file BotPassword.php.
|
static |
Remove all passwords for a user, by name.
string | $username | User name |
Definition at line 363 of file BotPassword.php.
References $username, CentralIdLookup\AUDIENCE_RAW, CentralIdLookup\factory(), and IDBAccessObject\READ_LATEST.
Referenced by MediaWiki\Session\Session\BotPasswordSessionProvider\preventSessionsForUser(), and BotPasswordTest\testRemoveAllPasswordsForUser().
BotPassword::save | ( | $operation, | |
Password | $password = null |
||
) |
Save the BotPassword to the database.
Definition at line 267 of file BotPassword.php.
References $appId, $centralId, DB_MASTER, FormatJson\encode(), MWCryptRand\generateHex(), isSaved(), PasswordFactory\newInvalidPassword(), and User\TOKEN_LENGTH.
|
private |
Definition at line 38 of file BotPassword.php.
Referenced by delete(), getAppId(), and save().
|
private |
Definition at line 35 of file BotPassword.php.
Referenced by delete(), getUserCentralId(), and save().
|
private |
Definition at line 50 of file BotPassword.php.
Referenced by __construct(), newFromCentralId(), and newUnsaved().
|
private |
Definition at line 47 of file BotPassword.php.
Referenced by getGrants().
|
private |
Definition at line 32 of file BotPassword.php.
Referenced by __construct(), and isSaved().
|
private |
Definition at line 44 of file BotPassword.php.
Referenced by getRestrictions().
|
private |
Definition at line 41 of file BotPassword.php.
Referenced by getToken().
const BotPassword::APPID_MAXLENGTH = 32 |
Definition at line 29 of file BotPassword.php.
Referenced by SpecialBotPasswords\execute(), SpecialBotPasswords\getFormFields(), and BotPasswordTest\testUnsaved().