Go to the documentation of this file.
33 use ApiBlockInfoTrait;
45 $this->
dieWithError(
'apierror-permissiondenied-unblock',
'permissiondenied' );
47 # T17810: blocked admins should have limited access here
48 $block = $user->getBlock();
55 [
'blockinfo' => $this->getBlockDetails( $block ) ]
61 if ( !is_null( $params[
'tags'] ) ) {
63 if ( !$ableToTag->isOK() ) {
68 if ( $params[
'userid'] !==
null ) {
71 if ( $username ===
false ) {
72 $this->
dieWithError( [
'apierror-nosuchuserid', $params[
'userid'] ],
'nosuchuserid' );
74 $params[
'user'] = $username;
79 'Target' => is_null( $params[
'id'] ) ? $params[
'user'] :
"#{$params['id']}",
80 'Reason' => $params[
'reason'],
81 'Tags' => $params[
'tags']
83 $block = DatabaseBlock::newFromTarget( $data[
'Target'] );
85 if ( $retval !==
true ) {
89 $target = $block->getType() == DatabaseBlock::TYPE_AUTO ?
'' : $block->getTarget();
91 'id' => $block->getId(),
92 'user' => $target instanceof
User ? $target->
getName() : $target,
93 'userid' => $target instanceof
User ? $target->
getId() : 0,
94 'reason' => $params[
'reason']
130 'action=unblock&id=105'
131 =>
'apihelp-unblock-example-id',
132 'action=unblock&user=Bob&reason=Sorry%20Bob'
133 =>
'apihelp-unblock-example-user',
138 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Block';
static processUnblock(array $data, IContextSource $context)
Process the form.
getContext()
Get the base IContextSource object.
getId()
Get the user's ID.
static checkUnblockSelf( $target, User $performer)
T17810: blocked admins should not be able to block/unblock others, and probably shouldn't be able to ...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
isWriteMode()
Indicates whether this module requires write mode.
getExamplesMessages()
Returns usage examples for this module.
This abstract class implements many basic API functions, and is the base of all API classes.
execute()
Unblocks the specified user or provides the reason the unblock failed.
API module that facilitates the unblocking of users.
getHelpUrls()
Return links to more detailed help pages about the module.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
static whoIs( $id)
Get the username corresponding to a given user ID.
getPermissionManager()
Obtain a PermissionManager instance that subclasses may use in their authorization checks.
requireOnlyOneParameter( $params, $required)
Die if none or more than one of a certain set of parameters is set and not false.
mustBePosted()
Indicates whether this module must be called with a POST request.
needsToken()
Returns the token type this module requires in order to execute.
dieStatus(StatusValue $status)
Throw an ApiUsageException based on the Status object.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getName()
Get the user name, or the IP of an anonymous user.
errorArrayToStatus(array $errors, User $user=null)
Turn an array of message keys or key+param arrays into a Status.