24use InvalidArgumentException;
50 private $blockTargetFactory;
77 $this->options = $options;
78 $this->blockTargetFactory = $blockTargetFactory;
79 $this->performer = $performer;
88 $this->target = $this->blockTargetFactory->newFromLegacyUnion( $target );
99 if ( !$this->performer->isAllowed(
'block' ) ) {
100 return 'badaccess-group0';
105 !$this->performer->isAllowed(
'hideuser' )
107 return 'unblock-hideuser';
133 $freshness = IDBAccessObject::READ_NORMAL
135 if ( $target ===
null ) {
136 if ( $this->target ) {
138 'Passing null to checkBlockPermissions() for $target is deprecated since 1.44',
140 $target = $this->target;
142 throw new InvalidArgumentException(
'A target is required' );
145 $target = $this->blockTargetFactory->newFromLegacyUnion( $target );
147 throw new InvalidArgumentException(
'Invalid block target' );
151 $block = $this->performer->getBlock( $freshness );
157 if ( !$block->isSitewide() ) {
162 $performerIdentity = $this->performer->getUser();
166 $target->getUserIdentity()->getId() === $performerIdentity->getId()
171 if ( $block->getBlocker() && $performerIdentity->equals( $block->getBlocker() ) ) {
176 if ( $this->performer->isAllowed(
'unblockself' ) ) {
179 return 'ipbnounblockself';
185 $block->getBlocker() &&
186 $target->getUserIdentity()->
equals( $block->getBlocker() )
204 $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()