|
MediaWiki master
|
Utility class for bot passwords. More...
Public Member Functions | |
| __construct ( $row, $isSaved, $flags=IDBAccessObject::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 () |
| Returns a (raw, unhashed) random password string. | |
| static | getPrimaryDatabase () |
| static | getReplicaDatabase () |
| static | getSeparator () |
| Get the separator for combined username + app 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=IDBAccessObject::READ_NORMAL) |
| Load a BotPassword from the database. | |
| static | newFromUser (UserIdentity $userIdentity, $appId, $flags=IDBAccessObject::READ_NORMAL) |
| Load a BotPassword from the database. | |
| static | newUnsaved (array $data, $flags=IDBAccessObject::READ_NORMAL) |
| Create an unsaved BotPassword. | |
| 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. | |
| MediaWiki\User\BotPassword::__construct | ( | $row, | |
| $isSaved, | |||
| $flags = IDBAccessObject::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 82 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 329 of file BotPassword.php.
Referenced by MediaWiki\Api\ApiLogin\execute().
| MediaWiki\User\BotPassword::delete | ( | ) |
Delete the BotPassword from the database.
Definition at line 278 of file BotPassword.php.
|
static |
Returns a (raw, unhashed) random password string.
Definition at line 316 of file BotPassword.php.
| MediaWiki\User\BotPassword::getAppId | ( | ) |
Definition at line 168 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
| MediaWiki\User\BotPassword::getGrants | ( | ) |
Definition at line 189 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Definition at line 99 of file BotPassword.php.
|
static |
Definition at line 93 of file BotPassword.php.
| MediaWiki\User\BotPassword::getRestrictions | ( | ) |
Definition at line 182 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
|
static |
Get the separator for combined username + app ID.
Definition at line 197 of file BotPassword.php.
| MediaWiki\User\BotPassword::getToken | ( | ) |
Definition at line 175 of file BotPassword.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
| MediaWiki\User\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 name.
| string | $username |
Definition at line 294 of file BotPassword.php.
| MediaWiki\User\BotPassword::isInvalid | ( | ) |
Whether the password is currently invalid.
Definition at line 236 of file BotPassword.php.
| MediaWiki\User\BotPassword::isSaved | ( | ) |
Indicate whether this is known to be saved.
Definition at line 153 of file BotPassword.php.
Referenced by MediaWiki\User\BotPassword\__construct().
|
static |
Try to log the user in.
| string | $username | Combined username and app ID |
| string | $password | Supplied password |
| WebRequest | $request |
Definition at line 355 of file BotPassword.php.
References MediaWiki\Request\WebRequest\getIP(), MediaWiki\Request\WebRequest\getSession(), and wfMessage().
Referenced by MediaWiki\Api\ApiLogin\execute().
|
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 name.
| string | $username |
Definition at line 305 of file BotPassword.php.
| MediaWiki\User\BotPassword::save | ( | $operation, | |
| ?Password | $password = null ) |
Save the BotPassword to the database.
| string | $operation | 'update' or 'insert' |
| Password | null | $password | Password to set. |
| UnexpectedValueException |
Definition at line 247 of file BotPassword.php.
| const MediaWiki\User\BotPassword::APPID_MAXLENGTH = 32 |
Definition at line 35 of file BotPassword.php.
| const MediaWiki\User\BotPassword::GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants.
Definition at line 52 of file BotPassword.php.
| const MediaWiki\User\BotPassword::PASSWORD_MINLENGTH = 32 |
Minimum length for a bot password.
Definition at line 40 of file BotPassword.php.
| const MediaWiki\User\BotPassword::RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions.
Definition at line 46 of file BotPassword.php.