In this case, wrong messages for attempting to undelete a page
Steps to reproduce:
1 Block an admin from editing a specific page
2 As that admin, attempt to undelete an older revision of that page (or the entire page, if deleted)
Expected result
Your username or IP address has been blocked from making changes to this page. You can still edit other pages on this wiki. (or a message like this)
Actual result
The action you have requested is limited to users in one of the groups: Administrators, Oversighters, Researchers, Check users.
This is based on SpecialUndelete.php including the following check:
protected function isAllowed( $permission, User $user = null ) { $user = $user ?: $this->getUser(); $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); if ( $this->mTargetObj !== null ) { return $permissionManager->userCan( $permission, $user, $this->mTargetObj ); } else { return $permissionManager->userHasRight( $user, $permission ); } }
which doesn't differential between users who can undelete pages in general, but not the specific page in question, and those who cannot undelete at all. Splitting this so that if $user->isAllowed( $permission ); but not $permissionManager->userCan( $permission, $user, $this->mTargetObj ); it results in a different error should solve this