jenkins-bot has submitted this change and it was merged.

Change subject: If a user does not have permission to view a log type, throw a 
PermissionsError
......................................................................


If a user does not have permission to view a log type, throw a PermissionsError

Currently if you view a private log like [[Special:Log/suppress]] and do not
have the right permission, you just see [[Special:Log]]. Now it will
throw a PermissionsError which states the user does not have the right 
permission.

Bug: 17881
Change-Id: I15486a1cc227a4900ab7cd38d7f0cc7eb685195a
---
M includes/specials/SpecialLog.php
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Parent5446: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php
index 5d55a28..2ffdd89 100644
--- a/includes/specials/SpecialLog.php
+++ b/includes/specials/SpecialLog.php
@@ -74,14 +74,14 @@
                        $opts->setValue( 'month', '' );
                }
 
-               // Reset the log type to default (nothing) if it's invalid or 
if the
-               // user does not possess the right to view it
+               // If the user doesn't have the right permission to view the 
specific
+               // log type, throw a PermissionsError
+               // If the log type is invalid, just show all public logs
                $type = $opts->getValue( 'type' );
-               if ( !LogPage::isLogType( $type )
-                       || ( isset( $wgLogRestrictions[$type] )
-                               && !$this->getUser()->isAllowed( 
$wgLogRestrictions[$type] ) )
-               ) {
+               if ( !LogPage::isLogType( $type ) ) {
                        $opts->setValue( 'type', '' );
+               } elseif ( isset( $wgLogRestrictions[$type] ) && 
!$this->getUser()->isAllowed( $wgLogRestrictions[$type] ) ) {
+                       throw new PermissionsError( $wgLogRestrictions[$type] );
                }
 
                # Handle type-specific inputs

-- 
To view, visit https://gerrit.wikimedia.org/r/74580
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I15486a1cc227a4900ab7cd38d7f0cc7eb685195a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MZMcBride <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to