Page MenuHomeWickedGov Phorge

CentralAuthHandler.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

CentralAuthHandler.php

<?php
namespace MediaWiki\CheckUser\HookHandler;
use MediaWiki\Extension\CentralAuth\Hooks\CentralAuthGlobalUserGroupMembershipChangedHook;
use MediaWiki\Extension\CentralAuth\User\CentralAuthUser;
use MediaWiki\SpecialPage\SpecialPageFactory;
use Wikimedia\ObjectCache\WANObjectCache;
class CentralAuthHandler implements CentralAuthGlobalUserGroupMembershipChangedHook {
private WANObjectCache $wanCache;
private SpecialPageFactory $specialPageFactory;
public function __construct(
WANObjectCache $wanCache,
SpecialPageFactory $specialPageFactory
) {
$this->wanCache = $wanCache;
$this->specialPageFactory = $specialPageFactory;
}
/**
* Clear user's cached known external wiki permissions on global user group change
*
* @inheritDoc
*/
public function onCentralAuthGlobalUserGroupMembershipChanged(
CentralAuthUser $centralAuthUser,
array $oldGroups,
array $newGroups
) {
// Do nothing if Special:GlobalContributions doesn't exist, as it's the sole generator of this data
if ( !$this->specialPageFactory->exists( 'GlobalContributions' ) ) {
return;
}
$checkKey = $this->wanCache->makeGlobalKey(
'globalcontributions-ext-permissions',
$centralAuthUser->getId()
);
// Clear the cache value if it exists as changing user groups may change the user's
// stored access permissions
$this->wanCache->touchCheckKey( $checkKey );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Oct 4, 01:11 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b9/9d/4ade36b03e02beb850da0c3a193d
Default Alt Text
CentralAuthHandler.php (1 KB)

Event Timeline