Don't display rollback link if the user doesn't have all required permissions
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 27 Jan 2008 17:31:47 +0000 (17:31 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 27 Jan 2008 17:31:47 +0000 (17:31 +0000)
RELEASE-NOTES
includes/PageHistory.php
includes/SpecialContributions.php

index e1ef587..c2cc540 100644 (file)
@@ -341,7 +341,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 12790) Page protection is not logged when edit-protection is used and move-protection is not
 * (bug 12793) Fix for restricted namespaces/pages in Special:Export
 * Fix for Special:Export so it doesn't ignore the page named '0'
-
+* Don't display rollback link if the user doesn't have all required permissions
 
 == Parser changes in 1.12 ==
 
index 3c8c8a1..4202deb 100644 (file)
@@ -262,7 +262,9 @@ class PageHistory {
                $tools = array();
                
                if ( !is_null( $next ) && is_object( $next ) ) {
-                       if( $wgUser->isAllowed( 'rollback' ) && $latest ) {
+                       if( !$this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser )
+                       && !$this->mTitle->getUserPermissionsErrors( 'edit', $wgUser )
+                       && $latest ) {
                                $tools[] = '<span class="mw-rollback-link">'
                                        . $this->mSkin->buildRollbackLink( $rev )
                                        . '</span>';
index 333898b..94e381f 100644 (file)
@@ -114,9 +114,9 @@ class ContribsPager extends ReverseChronologicalPager {
         * Generates each row in the contributions list.
         *
         * Contributions which are marked "top" are currently on top of the history.
-        * For these contributions, a [rollback] link is shown for users with sysop
-        * privileges. The rollback link restores the most recent version that was not
-        * written by the target user.
+        * For these contributions, a [rollback] link is shown for users with roll-
+        * back privileges. The rollback link restores the most recent version that
+        * was not written by the target user.
         *
         * @todo This would probably look a lot nicer in a table.
         */
@@ -139,7 +139,8 @@ class ContribsPager extends ReverseChronologicalPager {
                                $difftext .= $this->messages['newarticle'];
                        }
 
-                       if( $wgUser->isAllowed( 'rollback' ) ) {
+                       if( !$page->getUserPermissionsErrors( 'rollback', $wgUser )
+                       &&  !$page->getUserPermissionsErrors( 'edit', $wgUser ) ) {
                                $topmarktext .= ' '.$sk->generateRollback( $rev );
                        }