Current code:
protected function checkCanExecute( User $user ) { $right = $this->getRestriction(); if ( $right !== null ) { $errors = MediaWikiServices::getInstance()->getPermissionManager() ->getPermissionErrors( $right, $user, $this->getTitle() ); if ( count( $errors ) ) { throw new PermissionsError( $right, $errors ); } }
This should use Authority, rather than PermissionManager::getPermissionErrors. The main issue is that PermissionManager::getPermissionErrors() is called with the default rigor, i.e. self::RIGOR_SECURE. This would correspond to Authority::authorizeWrite, but I don't think it's correct: by default (FormAction, FormlessAction), this code is executed on page view, which means we'd be making master queries and possibly incrementing throttle limiters on GET requests. My proposal is to use Authority::definitelyCan instead. I'm tagging CPT to confirm whether that's correct/wanted.