use IContextSource;
use InvalidArgumentException;
use IP;
+use MediaWiki\MediaWikiServices;
use RequestContext;
use Title;
use User;
* reason string Reason of the block
* timestamp string The time at which the block comes into effect
* byText string Username of the blocker (for foreign users)
+ * hideName bool Hide the target user name
*/
public function __construct( array $options = [] ) {
$defaults = [
'reason' => '',
'timestamp' => '',
'byText' => '',
+ 'hideName' => false,
];
$options += $defaults;
$this->setReason( $options['reason'] );
$this->setTimestamp( wfTimestamp( TS_MW, $options['timestamp'] ) );
+ $this->setHideName( (bool)$options['hideName'] );
}
/**
if ( !$res && $blockDisablesLogin ) {
// If a block would disable login, then it should
// prevent any right that all users cannot do
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$anon = new User;
- $res = $anon->isAllowed( $right ) ? $res : true;
+ $res = $permissionManager->userHasRight( $anon, $right ) ? $res : true;
}
return $res;
if ( !$res && $blockDisablesLogin ) {
// If a block would disable login, then it should
// prevent any action that all users cannot do
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$anon = new User;
- $res = $anon->isAllowed( $action ) ? $res : true;
+ $res = $permissionManager->userHasRight( $anon, $action ) ? $res : true;
}
return $res;