r100548 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100547‎ | r100548 | r100549 >
Date:16:45, 23 October 2011
Author:johnduhart
Status:ok (Comments)
Tags:todo 
Comment:
Add check to see if the user has permission to view the log. Right now the page title and description are still set.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialLog.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialLog.php
@@ -35,6 +35,8 @@
3636 }
3737
3838 public function execute( $par ) {
 39+ global $wgLogRestrictions;
 40+
3941 $this->setHeaders();
4042 $this->outputHeader();
4143
@@ -62,7 +64,13 @@
6365 $opts->setValue( 'month', '' );
6466 }
6567
66 - if ( !LogPage::isLogType( $opts->getValue( 'type' ) ) ) {
 68+ // Reset the log type to default (nothing) if it's invalid or if the
 69+ // user does not possess the right to view it
 70+ $type = $opts->getValue( 'type' );
 71+ if ( !LogPage::isLogType( $type )
 72+ || ( isset( $wgLogRestrictions[$type] )
 73+ && !$this->getUser()->isAllowed( $wgLogRestrictions[$type] ) )
 74+ ) {
6775 $opts->setValue( 'type', '' );
6876 }
6977

Comments

#Comment by Bawolff (talk | contribs)   03:56, 20 December 2011

Personally I think from a usability perspective, an error would be nicer.

For example, suppose there was a misconfiguration, and a log gets restricted that shouldn't. If we just redirect them to public log, the steps a user goes through would look like:

  • User types in log name, gets all public logs.
  • User assumes they made a typo or something.
  • User can't figure out what they did wrong, gets frustrated, etc

vs

  • User types in log name
  • User gets "This action is restricted to so and so"
  • User bugs admin, admin fixes issue, everyone happy.

However, I suppose that's not directly applicable to this specific commit, and I do agree that the behaviour of this commit is a significant improvement over the previous behaviour of saying here is <log> and then showing all public logs instead. Thus marking ok but with tag todo

Status & tagging log