MediaWiki master
|
Service for temporary user creation. More...
Inherits MediaWiki\User\TempUser\TempUserConfig.
Public Member Functions | |
__construct (RealTempUserConfig $config, ObjectFactory $objectFactory, UserFactory $userFactory, AuthManager $authManager, CentralIdLookup $centralIdLookup, Throttler $tempAccountCreationThrottler, Throttler $tempAccountNameAcquisitionThrottler) | |
acquireAndStashName (Session $session) | |
Permanently acquire a username, stash it in a session, and return it. | |
create (?string $name, WebRequest $request) | |
Acquire a serial number, create the corresponding user and log in. | |
getExpireAfterDays () | |
After how many days do temporary users expire? | |
getMatchCondition (IReadableDatabase $db, string $field, string $op) | |
Get a SQL query condition that will match (or not match) temporary accounts. | |
getMatchPattern () | |
Get a Pattern indicating how temporary account can be detected. | |
getMatchPatterns () | |
Get Patterns indicating how temporary account can be detected. | |
getNotifyBeforeExpirationDays () | |
How many days before expiration should temporary users be notified? | |
getPlaceholderName () | |
Get a placeholder name which matches the reserved prefix. | |
getStashedName (Session $session) | |
Return a possible acquired and stashed username in a session. | |
isAutoCreateAction (string $action) | |
Is the action valid for user auto-creation? | |
isEnabled () | |
Is temp user creation enabled? | |
isKnown () | |
Are temporary accounts a known concept on the wiki? This should return true if any temporary accounts exist. | |
isReservedName (string $name) | |
Does the name match a configured pattern which indicates that it conflicts with temporary user names? Should manual user creation be denied? | |
isTempName (string $name) | |
Does the name match the configured pattern indicating that it is a temporary auto-created user? | |
shouldAutoCreate (Authority $authority, string $action) | |
Should/would auto-create be performed if the user attempts to perform the given action? | |
Service for temporary user creation.
For convenience this also proxies the TempUserConfig methods.
This is separate from TempUserConfig to avoid dependency loops. Special pages and actions are free to use this class, but services should take it as a constructor parameter only if necessary.
Definition at line 30 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::__construct | ( | RealTempUserConfig | $config, |
ObjectFactory | $objectFactory, | ||
UserFactory | $userFactory, | ||
AuthManager | $authManager, | ||
CentralIdLookup | $centralIdLookup, | ||
Throttler | $tempAccountCreationThrottler, | ||
Throttler | $tempAccountNameAcquisitionThrottler ) |
Definition at line 68 of file TempUserCreator.php.
References MediaWiki\User\TempUser\RealTempUserConfig\getSerialMappingConfig(), and MediaWiki\User\TempUser\RealTempUserConfig\getSerialProviderConfig().
MediaWiki\User\TempUser\TempUserCreator::acquireAndStashName | ( | Session | $session | ) |
Permanently acquire a username, stash it in a session, and return it.
Do not create the user.
If this method was called before with the same session ID, return the previously stashed username instead of acquiring a new one.
Session | $session |
Definition at line 341 of file TempUserCreator.php.
References MediaWiki\Session\Session\get(), MediaWiki\Session\Session\getRequest(), MediaWiki\Session\Session\save(), and MediaWiki\Session\Session\set().
MediaWiki\User\TempUser\TempUserCreator::create | ( | ?string | $name, |
WebRequest | $request ) |
Acquire a serial number, create the corresponding user and log in.
string | null | $name | Previously acquired name |
WebRequest | $request | Request details, used for throttling |
Definition at line 95 of file TempUserCreator.php.
References MediaWiki\Request\WebRequest\getIP(), and StatusValue\newFatal().
MediaWiki\User\TempUser\TempUserCreator::getExpireAfterDays | ( | ) |
After how many days do temporary users expire?
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 174 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::getMatchCondition | ( | IReadableDatabase | $db, |
string | $field, | ||
string | $op ) |
Get a SQL query condition that will match (or not match) temporary accounts.
IReadableDatabase | $db | |
string | $field | Database field to match against |
string | $op | Operator: IExpression::LIKE or IExpression::NOT_LIKE |
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 170 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::getMatchPattern | ( | ) |
Get a Pattern indicating how temporary account can be detected.
Used to avoid selecting a temp account via select queries.
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 162 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::getMatchPatterns | ( | ) |
Get Patterns indicating how temporary account can be detected.
Used to avoid selecting a temp account via select queries.
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 166 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::getNotifyBeforeExpirationDays | ( | ) |
How many days before expiration should temporary users be notified?
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 178 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::getPlaceholderName | ( | ) |
Get a placeholder name which matches the reserved prefix.
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 158 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::getStashedName | ( | Session | $session | ) |
Return a possible acquired and stashed username in a session.
Do not acquire or create the user.
If this method is called with the same session ID as function acquireAndStashName(), it returns the previously stashed username.
Session | $session |
Definition at line 365 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::isAutoCreateAction | ( | string | $action | ) |
Is the action valid for user auto-creation?
string | $action |
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 142 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::isEnabled | ( | ) |
Is temp user creation enabled?
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 134 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::isKnown | ( | ) |
Are temporary accounts a known concept on the wiki? This should return true if any temporary accounts exist.
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 138 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::isReservedName | ( | string | $name | ) |
Does the name match a configured pattern which indicates that it conflicts with temporary user names? Should manual user creation be denied?
string | $name |
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 154 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::isTempName | ( | string | $name | ) |
Does the name match the configured pattern indicating that it is a temporary auto-created user?
string | $name |
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 150 of file TempUserCreator.php.
MediaWiki\User\TempUser\TempUserCreator::shouldAutoCreate | ( | Authority | $authority, |
string | $action ) |
Should/would auto-create be performed if the user attempts to perform the given action?
Authority | $authority | |
string | $action |
Implements MediaWiki\User\TempUser\TempUserConfig.
Definition at line 146 of file TempUserCreator.php.