Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4117317
ApiHookHandler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ApiHookHandler.php
View Options
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace
MediaWiki\Extension\CentralAuth\Hooks\Handlers
;
use
MediaWiki\Api\ApiBase
;
use
MediaWiki\Api\ApiMain
;
use
MediaWiki\Api\Hook\APIGetAllowedParamsHook
;
use
MediaWiki\Config\Config
;
use
Wikimedia\ParamValidator\ParamValidator
;
class
ApiHookHandler
implements
APIGetAllowedParamsHook
{
private
Config
$config
;
public
function
__construct
(
Config
$config
)
{
$this
->
config
=
$config
;
}
/**
* Inject the "centralauthtoken" parameter into the API
* @param ApiBase $module API module
* @param array &$params Array of parameter specifications
* @param int $flags
* @return bool
*/
public
function
onAPIGetAllowedParams
(
$module
,
&
$params
,
$flags
)
{
if
(
!
$this
->
config
->
get
(
'CentralAuthCookies'
)
)
{
return
true
;
}
if
(
$module
instanceof
ApiMain
)
{
$params
[
'centralauthtoken'
]
=
[
ParamValidator
::
PARAM_TYPE
=>
'string'
,
ParamValidator
::
PARAM_SENSITIVE
=>
true
,
];
}
return
true
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 02:07 (2 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
94/a0/58cf8e8714b91a44e7cc6b06acab
Default Alt Text
ApiHookHandler.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment