3 namespace MediaWiki\Api\Hook
;
5 use MediaWiki\Api\ApiBase
;
6 use MediaWiki\User\User
;
7 use Wikimedia\Message\MessageSpecifier
;
10 * This is a hook handler interface, see docs/Hooks.md.
11 * Use the hook name "ApiCheckCanExecute" to register handlers implementing this interface.
13 * @stable to implement
16 interface ApiCheckCanExecuteHook
{
18 * This hook is called during ApiMain::checkExecutePermissions. Use this hook to further
19 * authenticate and authorize API clients before executing the module.
23 * @param ApiBase $module
24 * @param User $user Current user
25 * @param MessageSpecifier|string|array &$message API message to die with.
26 * Specific values accepted depend on the MediaWiki version:
27 * * 1.43+: MessageSpecifier, string message key, or key+parameters array to
28 * pass to ApiBase::dieWithError().
29 * * 1.29+: IApiMessage, Message, string message key, or key+parameters array to
30 * pass to ApiBase::dieWithError().
31 * * 1.27+: IApiMessage, or a key or key+parameters in ApiBase::$messageMap.
32 * * Earlier: A key or key+parameters in ApiBase::$messageMap.
33 * @return bool|void True or no return value to continue, or false and set a
34 * message to cancel the request
36 * @see ApiMessage::create() for how the $message parameter is interpreted.
37 * @see ApiQueryCheckCanExecuteHook for query modules.
39 public function onApiCheckCanExecute( $module, $user, &$message );