(bug 18677) Give proper error message when viewing &action=protect without sufficient...
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 4 May 2009 14:51:46 +0000 (14:51 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 4 May 2009 14:51:46 +0000 (14:51 +0000)
RELEASE-NOTES
includes/Article.php

index 3f91fa6..19ced84 100644 (file)
@@ -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 ==
index 1f30e87..f10eafd 100644 (file)
@@ -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();
        }