(bug 38082) Check read permissions in ApiFeedContribs
authorcsteipp <csteipp@wikimedia.org>
Tue, 21 Aug 2012 18:55:48 +0000 (11:55 -0700)
committerPeter Gehres <pgehres@wikimedia.org>
Tue, 23 Apr 2013 18:59:10 +0000 (11:59 -0700)
Before showing the contents of a title in the generated feed, check
that the calling user has permissions to read the specific title.

Change-Id: Iba16a5489d80cd4f0958ad6bbcf2e1a948e97f93

includes/api/ApiFeedContributions.php

index a11563b..f2a7748 100644 (file)
@@ -93,7 +93,7 @@ class ApiFeedContributions extends ApiBase {
 
        protected function feedItem( $row ) {
                $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
-               if ( $title ) {
+               if( $title && $title->userCan( 'read' ) ) {
                        $date = $row->rev_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
                        $revision = Revision::newFromRow( $row );
@@ -106,9 +106,8 @@ class ApiFeedContributions extends ApiBase {
                                $this->feedItemAuthor( $revision ),
                                $comments
                        );
-               } else {
-                       return null;
                }
+               return null;
        }
 
        /**