From a4858a510999314cffd3719bee1020a3f56d572b Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 27 Dec 2011 23:35:24 +0000 Subject: [PATCH] Fix Bug 33390 - Examine page is visible for hidden log entries Fix Bug 24186 - "Examine" page is visible to users without abusefilter-log-detail right Author: Nikola Kovacs There was a more complex patch on Bug 24186, but I think he makes a good argument why his is better. Beware: I'm not set up to test AbuseFilter, but I didn't see anyone else in core MW who regularly works on it. --- AbuseFilter.i18n.php | 2 ++ Views/AbuseFilterViewExamine.php | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/AbuseFilter.i18n.php b/AbuseFilter.i18n.php index 34b560a71..cf22c295d 100644 --- a/AbuseFilter.i18n.php +++ b/AbuseFilter.i18n.php @@ -104,6 +104,7 @@ Filter description: $7 ($8)', 'abusefilter-log-linkoncontribs-text' => 'Abuse log for this user', 'abusefilter-log-hidden' => '(entry hidden)', 'abusefilter-log-hide' => 'hide or unhide', // @todo FIXME: Message unused? + 'abusefilter-log-cannot-see-details' => 'You do not have permission to see details of any entries.', 'abusefilter-log-details-hidden' => 'You cannot view the details for this entry because it is hidden from public view.', // Hiding log entries @@ -580,6 +581,7 @@ $messages['qqq'] = array( 'abusefilter-log-linkoncontribs-text' => 'Title for link added on [[Special:Contributions]] and other relevant special pages.', 'abusefilter-log-hidden' => 'Text for a hidden log entry.', 'abusefilter-log-hide' => 'This message may be unused.', + 'abusefilter-log-cannot-see-details' => 'Message show instead of the log row for users without permissions to see any details.', 'abusefilter-log-details-hidden' => 'Message shown instead of log row details when those are hidden.', 'abusefilter-log-hide-legend' => 'Legend for form to hide a log entry.', 'abusefilter-log-hide-id' => 'Field label in form to hide a log entry.', diff --git a/Views/AbuseFilterViewExamine.php b/Views/AbuseFilterViewExamine.php index 06fd1b49d..4a7d44c0c 100644 --- a/Views/AbuseFilterViewExamine.php +++ b/Views/AbuseFilterViewExamine.php @@ -106,6 +106,16 @@ class AbuseFilterViewExamine extends AbuseFilterView { self::$examineType = 'log'; self::$examineId = $logid; + if ( !SpecialAbuseLog::canSeeDetails() ) { + $this->getOutput()->addWikiMsg( 'abusefilter-log-cannot-see-details' ); + return; + } + + if ( $row->afl_deleted && !SpecialAbuseLog::canSeeHidden() ) { + $this->getOutput()->addWikiMsg( 'abusefilter-log-details-hidden' ); + return; + } + $vars = AbuseFilter::loadVarDump( $row->afl_var_dump ); $this->showExaminer( $vars );