10use InvalidArgumentException;
36 private $blockTargetFactory;
63 $this->options = $options;
64 $this->blockTargetFactory = $blockTargetFactory;
65 $this->performer = $performer;
74 $this->target = $this->blockTargetFactory->newFromLegacyUnion( $target );
85 if ( !$this->performer->isAllowed(
'block' ) ) {
86 return 'badaccess-group0';
91 !$this->performer->isAllowed(
'hideuser' )
93 return 'unblock-hideuser';
119 $freshness = IDBAccessObject::READ_NORMAL
121 if ( $target ===
null ) {
122 if ( $this->target ) {
124 'Passing null to checkBlockPermissions() for $target is deprecated since 1.44',
126 $target = $this->target;
128 throw new InvalidArgumentException(
'A target is required' );
131 $target = $this->blockTargetFactory->newFromLegacyUnion( $target );
133 throw new InvalidArgumentException(
'Invalid block target' );
137 $block = $this->performer->getBlock( $freshness );
143 if ( !$block->isSitewide() ) {
148 $performerIdentity = $this->performer->getUser();
152 $target->getUserIdentity()->getId() === $performerIdentity->getId()
157 if ( $block->getBlocker() && $performerIdentity->equals( $block->getBlocker() ) ) {
162 if ( $this->performer->isAllowed(
'unblockself' ) ) {
165 return 'ipbnounblockself';
171 $block->getBlocker() &&
172 $target->getUserIdentity()->
equals( $block->getBlocker() )
190 $this->performer->isAllowed(
'blockemail' );
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
A class containing constants representing the names of configuration variables.
const EnableUserEmail
Name constant for the EnableUserEmail setting, for use with Config::get()