36 parent::__construct( $main, $action );
38 $this->authAction = $action ===
'unlinkaccount'
39 ? AuthManager::ACTION_UNLINK
40 : AuthManager::ACTION_REMOVE;
41 $this->operation = $action ===
'unlinkaccount'
43 :
'RemoveCredentials';
47 if ( !$this->
getUser()->isLoggedIn() ) {
48 $this->
dieUsage(
'Must be logged in to remove authentication data',
'notloggedin' );
52 $manager = AuthManager::singleton();
59 $blacklist = $this->authAction === AuthManager::ACTION_REMOVE
60 ? array_flip( $this->
getConfig()->
get(
'RemoveCredentialsBlacklist' ) )
63 $manager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
65 return $req->getUniqueId() ===
$params[
'request'] &&
66 !isset( $blacklist[get_class(
$req )] );
69 if ( count( $reqs ) !== 1 ) {
70 $this->
dieUsage(
'Failed to create change request',
'badrequest' );
72 $req = reset( $reqs );
75 $status = $manager->allowsAuthenticationDataChange(
$req,
true );
80 $manager->changeAuthenticationData(
$req );
103 "action={$action}&request=FooAuthenticationRequest&token=123ABC"
104 =>
"apihelp-{$path}-example-simple",
109 return 'https://www.mediawiki.org/wiki/API:Manage_authentication_data';
static getStandardParams($action, $param)
Fetch the standard parameters this helper recognizes.
static newForModule(ApiBase $module)
Static version of the constructor, for chaining.
getResult()
Get the result object.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
__construct(ApiMain $main, $action)
getModulePath()
Get the path to this module.
getConfig()
Get the Config object.
This is the main API class, used for both external and internal processing.
getModuleName()
Get the name of the module being executed by this instance.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
this hook is for auditing only $req
dieUsage($description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
This abstract class implements many basic API functions, and is the base of all API classes...
Remove authentication data from AuthManager.
dieStatus($status)
Throw a UsageException based on the errors in the Status object.
getUser()
Get the User object.