MediaWiki 1.41.2
|
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. | |
![]() | |
const | READ_NONE = -1 |
Constants for object loading bitfield flags (higher => higher QoS) | |
MediaWiki\User\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 99 of file BotPassword.php.
References MediaWiki\User\BotPassword\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 395 of file BotPassword.php.
References MediaWiki\User\BotPassword\getSeparator().
MediaWiki\User\BotPassword::delete | ( | ) |
Delete the BotPassword from the database.
Definition at line 290 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\User\BotPassword\isSaved().
|
static |
Returns a (raw, unhashed) random password string.
Config | $config |
Definition at line 381 of file BotPassword.php.
References MediaWiki\MainConfigNames\MinimalPasswordLength.
MediaWiki\User\BotPassword::getAppId | ( | ) |
Definition at line 184 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 115 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance().
MediaWiki\User\BotPassword::getGrants | ( | ) |
Definition at line 205 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
MediaWiki\User\BotPassword::getRestrictions | ( | ) |
Definition at line 198 of file BotPassword.php.
|
static |
Get the separator for combined user name + app ID.
Definition at line 213 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\MainConfigNames\UserrightsInterwikiDelimiter.
Referenced by MediaWiki\User\BotPassword\canonicalizeLoginData(), and MediaWiki\User\BotPassword\login().
MediaWiki\User\BotPassword::getToken | ( | ) |
Definition at line 191 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
MediaWiki\User\BotPassword::getUserCentralId | ( | ) |
Get the central user ID.
Definition at line 177 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 320 of file BotPassword.php.
References DB_PRIMARY, MediaWiki\MainConfigNames\EnableBotPasswords, getDB(), MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Invalidate all passwords for a user, by name.
string | $username |
Definition at line 306 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance().
MediaWiki\User\BotPassword::isInvalid | ( | ) |
Whether the password is currently invalid.
Definition at line 248 of file BotPassword.php.
MediaWiki\User\BotPassword::isSaved | ( | ) |
Indicate whether this is known to be saved.
Definition at line 169 of file BotPassword.php.
Referenced by MediaWiki\User\BotPassword\__construct(), MediaWiki\User\BotPassword\delete(), and MediaWiki\User\BotPassword\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 421 of file BotPassword.php.
References MediaWiki\MainConfigNames\EnableBotPasswords, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Request\WebRequest\getIP(), MediaWiki\User\BotPassword\getSeparator(), MediaWiki\User\User\newFromName(), MediaWiki\User\BotPassword\newFromUser(), MediaWiki\MainConfigNames\PasswordAttemptThrottle, and wfMessage().
|
static |
Load a BotPassword from the database.
int | $centralId | from CentralIdLookup |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 141 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance().
|
static |
Load a BotPassword from the database.
UserIdentity | $userIdentity | |
string | $appId | |
int | $flags | IDBAccessObject read flags |
Definition at line 128 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\User\BotPassword\login().
|
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 159 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance().
|
static |
Remove all passwords for a user, by central ID.
int | $centralId |
Definition at line 358 of file BotPassword.php.
References DB_PRIMARY, MediaWiki\MainConfigNames\EnableBotPasswords, getDB(), MediaWiki\MediaWikiServices\getInstance(), and wfDeprecated().
|
static |
Remove all passwords for a user, by name.
string | $username |
Definition at line 344 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance().
MediaWiki\User\BotPassword::save | ( | $operation, | |
Password | $password = null ) |
Save the BotPassword to the database.
UnexpectedValueException |
Definition at line 259 of file BotPassword.php.
References MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\User\BotPassword\isSaved().
const MediaWiki\User\BotPassword::APPID_MAXLENGTH = 32 |
Definition at line 52 of file BotPassword.php.
const MediaWiki\User\BotPassword::GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants.
Definition at line 69 of file BotPassword.php.
const MediaWiki\User\BotPassword::PASSWORD_MINLENGTH = 32 |
Minimum length for a bot password.
Definition at line 57 of file BotPassword.php.
const MediaWiki\User\BotPassword::RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions.
Definition at line 63 of file BotPassword.php.