From a21650b8252a03d310dd72dcc4bf4be201486446 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 4 May 2009 14:51:46 +0000 Subject: [PATCH] (bug 18677) Give proper error message when viewing &action=protect without sufficient rights. Patch by Stefano Codari --- RELEASE-NOTES | 2 ++ includes/Article.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3f91fa6433..19ced84c12 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -111,6 +111,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fixed the circular template inclusion check, was broken when the loop involved redirects. Without this, infinite recursion within the parser is possible. +* (bug 18677) Give proper error message when viewing &action=protect without + sufficient rights == API changes in 1.16 == diff --git a/includes/Article.php b/includes/Article.php index 1f30e8797f..f10eafd4b2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1962,6 +1962,16 @@ class Article { * action=protect handler */ public function protect() { + global $wgUser, $wgOut; + + # Check permissions + $permission_errors = $this->mTitle->getUserPermissionsErrors( 'protect', $wgUser ); + + if( count( $permission_errors ) > 0 ) { + $wgOut->showPermissionsErrorPage( $permission_errors ); + return; + } + $form = new ProtectionForm( $this ); $form->execute(); } -- 2.20.1