MediaWiki REL1_40
|
Utility class for bot passwords. More...
Inherits IDBAccessObject.
Public Member Functions | |
__construct ( $row, $isSaved, $flags=self::READ_NORMAL) | |
delete () | |
Delete the BotPassword from the database. | |
getAppId () | |
getGrants () | |
getRestrictions () | |
getToken () | |
getUserCentralId () | |
Get the central user ID. | |
isInvalid () | |
Whether the password is currently invalid. | |
isSaved () | |
Indicate whether this is known to be saved. | |
save ( $operation, Password $password=null) | |
Save the BotPassword to the database. | |
Static Public Member Functions | |
static | canonicalizeLoginData ( $username, $password) |
There are two ways to login with a bot password: "username@appId", "password" and "username", "appId@password". | |
static | generatePassword ( $config) |
Returns a (raw, unhashed) random password string. | |
static | getDB ( $db) |
Get a database connection for the bot passwords database. | |
static | getSeparator () |
Get the separator for combined user name + app ID. | |
static | invalidateAllPasswordsForCentralId ( $centralId) |
Invalidate all passwords for a user, by central ID. | |
static | invalidateAllPasswordsForUser ( $username) |
Invalidate all passwords for a user, by name. | |
static | login ( $username, $password, WebRequest $request) |
Try to log the user in. | |
static | newFromCentralId ( $centralId, $appId, $flags=self::READ_NORMAL) |
Load a BotPassword from the database. | |
static | newFromUser (UserIdentity $userIdentity, $appId, $flags=self::READ_NORMAL) |
Load a BotPassword from the database. | |
static | newUnsaved (array $data, $flags=self::READ_NORMAL) |
Create an unsaved BotPassword. | |
static | removeAllPasswordsForCentralId ( $centralId) |
Remove all passwords for a user, by central ID. | |
static | removeAllPasswordsForUser ( $username) |
Remove all passwords for a user, by name. | |
Public Attributes | |
const | APPID_MAXLENGTH = 32 |
const | GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants. | |
const | PASSWORD_MINLENGTH = 32 |
Minimum length for a bot password. | |
const | RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions. | |
Public Attributes inherited from IDBAccessObject | |
const | READ_NONE = -1 |
Constants for object loading bitfield flags (higher => higher QoS) | |
BotPassword::__construct | ( | $row, | |
$isSaved, | |||
$flags = self::READ_NORMAL ) |
stdClass | $row | bot_passwords database row |
bool | $isSaved | Whether the bot password was read from the database |
int | $flags | IDBAccessObject read flags |
Definition at line 83 of file BotPassword.php.
References isSaved().
|
static |
There are two ways to login with a bot password: "username@appId", "password" and "username", "appId@password".
Transform it so it is always in the first form. Returns [bot username, bot password]. If this cannot be a bot password login just return false.
string | $username | |
string | $password |
Definition at line 382 of file BotPassword.php.
BotPassword::delete | ( | ) |
Delete the BotPassword from the database.
Definition at line 275 of file BotPassword.php.
References isSaved().
|
static |
Returns a (raw, unhashed) random password string.
Config | $config |
Definition at line 368 of file BotPassword.php.
BotPassword::getAppId | ( | ) |
Definition at line 168 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Get a database connection for the bot passwords database.
int | $db | Index of the connection to get, e.g. DB_PRIMARY or DB_REPLICA. |
Definition at line 99 of file BotPassword.php.
BotPassword::getGrants | ( | ) |
Definition at line 189 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
BotPassword::getRestrictions | ( | ) |
Definition at line 182 of file BotPassword.php.
|
static |
Get the separator for combined user name + app ID.
Definition at line 197 of file BotPassword.php.
BotPassword::getToken | ( | ) |
Definition at line 175 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
BotPassword::getUserCentralId | ( | ) |
Get the central user ID.
Definition at line 161 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Invalidate all passwords for a user, by central ID.
int | $centralId |
Definition at line 305 of file BotPassword.php.
References DB_PRIMARY, getDB(), and wfDeprecated().
|
static |
Invalidate all passwords for a user, by name.
string | $username |
Definition at line 291 of file BotPassword.php.
BotPassword::isInvalid | ( | ) |
Whether the password is currently invalid.
Definition at line 233 of file BotPassword.php.
BotPassword::isSaved | ( | ) |
Indicate whether this is known to be saved.
Definition at line 153 of file BotPassword.php.
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 408 of file BotPassword.php.
References WebRequest\getIP(), User\newFromName(), and wfMessage().
|
static |
Load a BotPassword from the database.
int | $centralId | from CentralIdLookup |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 125 of file BotPassword.php.
|
static |
Load a BotPassword from the database.
UserIdentity | $userIdentity | |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 112 of file BotPassword.php.
|
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 143 of file BotPassword.php.
|
static |
Remove all passwords for a user, by central ID.
int | $centralId |
Definition at line 344 of file BotPassword.php.
References DB_PRIMARY, getDB(), and wfDeprecated().
|
static |
Remove all passwords for a user, by name.
string | $username |
Definition at line 330 of file BotPassword.php.
BotPassword::save | ( | $operation, | |
Password | $password = null ) |
Save the BotPassword to the database.
UnexpectedValueException |
Definition at line 244 of file BotPassword.php.
References isSaved().
const BotPassword::APPID_MAXLENGTH = 32 |
Definition at line 36 of file BotPassword.php.
const BotPassword::GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants.
Definition at line 53 of file BotPassword.php.
const BotPassword::PASSWORD_MINLENGTH = 32 |
Minimum length for a bot password.
Definition at line 41 of file BotPassword.php.
const BotPassword::RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions.
Definition at line 47 of file BotPassword.php.