From dfc691bfc5289d6263d55bb719ffa11ed9d0f80a Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 18 Oct 2023 11:22:21 +1100 Subject: Migrate callers of deprecated method BlockManager::getUserBlock() Bug: T345683 Depends-On: I2fff3ff961f788ca2fa84eba54293edf9145d738 Change-Id: I6d00af72cdda2a949b861dba402cf2f0c70d1b49 --- includes/user/User.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'includes/user/User.php') diff --git a/includes/user/User.php b/includes/user/User.php index 497b39b7b528..f977a39fd44f 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1431,6 +1431,12 @@ class User implements Authority, UserIdentity, UserEmailContact { $fromReplica = ( $freshness !== self::READ_LATEST ); } + if ( $disableIpBlockExemptChecking ) { + $isExempt = false; + } else { + $isExempt = $this->isAllowed( 'ipblock-exempt' ); + } + // TODO: Block checking shouldn't really be done from the User object. Block // checking can involve checking for IP blocks, cookie blocks, and/or XFF blocks, // which need more knowledge of the request context than the User should have. @@ -1439,16 +1445,15 @@ class User implements Authority, UserIdentity, UserEmailContact { // - Check if this is the user associated with the main request // - If so, pass the relevant request information to the block manager $request = null; - if ( $this->isGlobalSessionUser() ) { + if ( !$isExempt && $this->isGlobalSessionUser() ) { // This is the global user, so we need to pass the request $request = $this->getRequest(); } - return MediaWikiServices::getInstance()->getBlockManager()->getUserBlock( + return MediaWikiServices::getInstance()->getBlockManager()->getBlock( $this, $request, $fromReplica, - $disableIpBlockExemptChecking ); } -- cgit v1.2.3