MassMessage uses the UserGetRights hook to add a temporary user right. This is fragile (user rights might be cached by that point) and we now have a helper to do that, PermissionManager::addTemporaryUserRights(), so the usage should be replaced.
Description
Details
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| Use new PermissionManager::addTemporaryUserRights instead of hook | mediawiki/extensions/MassMessage | master | +9 -18 |
Related Objects
Event Timeline
I've tried to figure out how to patch it and looked at the docs but it was not clear to me how to do it so I gave up :)
Seems pretty straightforward to me:
$guard = $permissionManager->addTemporaryUserRights( $user, 'some-right' ); // do stuff that requires the rights ScopedCallback::consume( $guard );
Maybe there should be some generic documentation about the scoped callback pattern that can be linked from methods returning a scoped callback; there's a ScopedCallback wiki page but it's not super informative.
@Tgr Thanks. It's not the docs but my lack of PHP skills :-)
I guessed this also required to specify at the top:
use MediaWiki\MediaWikiServices use MediaWiki\Permissions\PermissionManager
But I'm not sure.
Change 524068 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/extensions/MassMessage@master] Use new PermissionManager::addTemporaryUserRights instead of hook
Change 524068 merged by jenkins-bot:
[mediawiki/extensions/MassMessage@master] Use new PermissionManager::addTemporaryUserRights instead of hook