MediaWiki  1.27.2
ApiAuthManagerHelper Class Reference

Helper class for AuthManager-using API modules. More...

Collaboration diagram for ApiAuthManagerHelper:

Public Member Functions

 __construct (ApiBase $module)
 
 formatAuthenticationResponse (AuthenticationResponse $res)
 Format an AuthenticationResponse for return. More...
 
 formatRequests (array $reqs)
 Format an array of AuthenticationRequests for return. More...
 
 getPreservedRequest ()
 Fetch the preserved CreateFromLoginAuthenticationRequest, if any. More...
 
 loadAuthenticationRequests ($action)
 Fetch and load the AuthenticationRequests for an action. More...
 
 securitySensitiveOperation ($operation)
 Call $manager->securitySensitiveOperationStatus() More...
 

Static Public Member Functions

static blacklistAuthenticationRequests (array $reqs, array $blacklist)
 Filter out authentication requests by class name. More...
 
static getStandardParams ($action, $param)
 Fetch the standard parameters this helper recognizes. More...
 
static newForModule (ApiBase $module)
 Static version of the constructor, for chaining. More...
 

Private Member Functions

 formatFields (array $fields)
 Clean up a field array for output. More...
 
 formatMessage (array &$res, $key, Message $message)
 Format a message for output. More...
 

Private Attributes

string $messageFormat
 Message output format. More...
 
ApiBase $module
 API module, for context and parameters. More...
 

Detailed Description

Helper class for AuthManager-using API modules.

Intended for use via composition.

Definition at line 35 of file ApiAuthManagerHelper.php.

Constructor & Destructor Documentation

ApiAuthManagerHelper::__construct ( ApiBase  $module)
Parameters
ApiBase$moduleAPI module, for context and parameters

Definition at line 46 of file ApiAuthManagerHelper.php.

References $module, $params, and ApiBase\extractRequestParams().

Member Function Documentation

static ApiAuthManagerHelper::blacklistAuthenticationRequests ( array  $reqs,
array  $blacklist 
)
static

Filter out authentication requests by class name.

Parameters
AuthenticationRequest[]$reqs Requests to filter
string[]$blacklist Class names to remove
Returns
AuthenticationRequest[]

Definition at line 123 of file ApiAuthManagerHelper.php.

References $req, and use.

Referenced by ApiChangeAuthenticationData\execute(), ApiQueryAuthManagerInfo\execute(), and ApiClientLogin\execute().

ApiAuthManagerHelper::formatAuthenticationResponse ( AuthenticationResponse  $res)

Format an AuthenticationResponse for return.

Parameters
AuthenticationResponse$res
Returns
array

Definition at line 192 of file ApiAuthManagerHelper.php.

References $params, $ret, formatMessage(), and formatRequests().

ApiAuthManagerHelper::formatFields ( array  $fields)
private

Clean up a field array for output.

Parameters
ApiBase$moduleFor context and parameters 'mergerequestfields' and 'messageformat'
array$fields
Returns
array

Definition at line 299 of file ApiAuthManagerHelper.php.

References $module, $name, $ret, as, formatMessage(), ApiResult\setArrayType(), and use.

Referenced by formatRequests().

ApiAuthManagerHelper::formatMessage ( array $res,
  $key,
Message  $message 
)
private

Format a message for output.

Parameters
array&$resResult array
string$keyResult key
Message$message

Definition at line 68 of file ApiAuthManagerHelper.php.

References $key, Message\getKey(), Message\getParams(), Message\setContext(), and Parser\stripOuterParagraph().

Referenced by formatAuthenticationResponse(), formatFields(), and formatRequests().

ApiAuthManagerHelper::formatRequests ( array  $reqs)

Format an array of AuthenticationRequests for return.

Parameters
AuthenticationRequest[]$reqs
Returns
array Will have a 'requests' key, and also 'fields' if $module's params include 'mergerequestfields'.

Definition at line 254 of file ApiAuthManagerHelper.php.

References $params, $req, $ret, array(), as, formatFields(), formatMessage(), and ApiResult\META_TYPE.

Referenced by formatAuthenticationResponse().

ApiAuthManagerHelper::getPreservedRequest ( )

Fetch the preserved CreateFromLoginAuthenticationRequest, if any.

Returns
CreateFromLoginAuthenticationRequest|null

Definition at line 243 of file ApiAuthManagerHelper.php.

References $ret.

static ApiAuthManagerHelper::getStandardParams (   $action,
  $param 
)
static
ApiAuthManagerHelper::loadAuthenticationRequests (   $action)

Fetch and load the AuthenticationRequests for an action.

Parameters
string$actionOne of the AuthManager::ACTION_* constants
Returns
AuthenticationRequest[]

Definition at line 138 of file ApiAuthManagerHelper.php.

References $params, $req, array(), as, true, and use.

static ApiAuthManagerHelper::newForModule ( ApiBase  $module)
static

Static version of the constructor, for chaining.

Parameters
ApiBase$moduleAPI module, for context and parameters
Returns
ApiAuthManagerHelper

Definition at line 58 of file ApiAuthManagerHelper.php.

References $module.

Referenced by ApiRemoveAuthenticationData\execute().

ApiAuthManagerHelper::securitySensitiveOperation (   $operation)

Call $manager->securitySensitiveOperationStatus()

Parameters
string$operationOperation being checked.
Exceptions
UsageException

Definition at line 96 of file ApiAuthManagerHelper.php.

References $status.

Member Data Documentation

string ApiAuthManagerHelper::$messageFormat
private

Message output format.

Definition at line 41 of file ApiAuthManagerHelper.php.

ApiBase ApiAuthManagerHelper::$module
private

API module, for context and parameters.

Definition at line 38 of file ApiAuthManagerHelper.php.

Referenced by __construct(), formatFields(), and newForModule().


The documentation for this class was generated from the following file: