Utility class for bot passwords.
More...
|
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 (User $user, $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.
|
|
Utility class for bot passwords.
- Since
- 1.27
Definition at line 29 of file BotPassword.php.
◆ __construct()
BotPassword::__construct |
( |
| $row, |
|
|
| $isSaved, |
|
|
| $flags = self::READ_NORMAL ) |
|
protected |
◆ canonicalizeLoginData()
static BotPassword::canonicalizeLoginData |
( |
| $username, |
|
|
| $password ) |
|
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, could be normal password?] where the last one is a flag meaning this could either be a bot password or a normal password, it cannot be decided for certain (although in such cases it almost always will be a bot password). If this cannot be a bot password login just return false.
- Parameters
-
string | $username | |
string | $password | |
- Returns
- array|false
Definition at line 463 of file BotPassword.php.
References $username, and true.
◆ delete()
◆ generatePassword()
static BotPassword::generatePassword |
( |
| $config | ) |
|
|
static |
Returns a (raw, unhashed) random password string.
- Parameters
-
- Returns
- string
Definition at line 447 of file BotPassword.php.
◆ getAppId()
BotPassword::getAppId |
( |
| ) |
|
◆ getDB()
static BotPassword::getDB |
( |
| $db | ) |
|
|
static |
◆ getGrants()
BotPassword::getGrants |
( |
| ) |
|
◆ getPassword()
BotPassword::getPassword |
( |
| ) |
|
|
protected |
◆ getRestrictions()
BotPassword::getRestrictions |
( |
| ) |
|
◆ getSeparator()
static BotPassword::getSeparator |
( |
| ) |
|
|
static |
◆ getToken()
BotPassword::getToken |
( |
| ) |
|
◆ getUserCentralId()
BotPassword::getUserCentralId |
( |
| ) |
|
◆ invalidateAllPasswordsForCentralId()
static BotPassword::invalidateAllPasswordsForCentralId |
( |
| $centralId | ) |
|
|
static |
◆ invalidateAllPasswordsForUser()
static BotPassword::invalidateAllPasswordsForUser |
( |
| $username | ) |
|
|
static |
Invalidate all passwords for a user, by name.
- Parameters
-
- Returns
- bool Whether any passwords were invalidated
Definition at line 380 of file BotPassword.php.
References $username.
◆ isInvalid()
BotPassword::isInvalid |
( |
| ) |
|
◆ isSaved()
◆ login()
static BotPassword::login |
( |
| $username, |
|
|
| $password, |
|
|
WebRequest | $request ) |
|
static |
◆ newFromCentralId()
static BotPassword::newFromCentralId |
( |
| $centralId, |
|
|
| $appId, |
|
|
| $flags = self::READ_NORMAL ) |
|
static |
◆ newFromUser()
static BotPassword::newFromUser |
( |
User | $user, |
|
|
| $appId, |
|
|
| $flags = self::READ_NORMAL ) |
|
static |
◆ newUnsaved()
static BotPassword::newUnsaved |
( |
array | $data, |
|
|
| $flags = self::READ_NORMAL ) |
|
static |
Create an unsaved BotPassword.
- Parameters
-
array | $data | Data to use to create the bot password. Keys are:
- user: (User) User object to create the password for. Overrides username and centralId.
- username: (string) Username to create the password for. Overrides centralId.
- centralId: (int) User central ID to create the password for.
- appId: (string) App ID for the password.
- restrictions: (MWRestrictions, optional) Restrictions.
- grants: (string[], optional) Grants.
|
int | $flags | IDBAccessObject read flags |
- Returns
- BotPassword|null
Definition at line 149 of file BotPassword.php.
References MWRestrictions\newDefault(), and object.
◆ removeAllPasswordsForCentralId()
static BotPassword::removeAllPasswordsForCentralId |
( |
| $centralId | ) |
|
|
static |
◆ removeAllPasswordsForUser()
static BotPassword::removeAllPasswordsForUser |
( |
| $username | ) |
|
|
static |
◆ save()
BotPassword::save |
( |
| $operation, |
|
|
Password | $password = null ) |
◆ $appId
string BotPassword::$appId |
|
private |
◆ $centralId
int BotPassword::$centralId |
|
private |
◆ $flags
int BotPassword::$flags = self::READ_NORMAL |
|
private |
◆ $grants
string [] BotPassword::$grants |
|
private |
◆ $isSaved
bool BotPassword::$isSaved |
|
private |
◆ $restrictions
◆ $token
string BotPassword::$token |
|
private |
◆ APPID_MAXLENGTH
const BotPassword::APPID_MAXLENGTH = 32 |
◆ GRANTS_MAXLENGTH
const BotPassword::GRANTS_MAXLENGTH = 65535 |
Maximum length of the json representation of grants.
- Since
- 1.31.11
Definition at line 43 of file BotPassword.php.
◆ RESTRICTIONS_MAXLENGTH
const BotPassword::RESTRICTIONS_MAXLENGTH = 65535 |
Maximum length of the json representation of restrictions.
- Since
- 1.31.11
Definition at line 37 of file BotPassword.php.
The documentation for this class was generated from the following file: