EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/159632
Change subject: Require permissions against root post for post content
......................................................................
Require permissions against root post for post content
History lines for unmoderated posts within moderated topics
were being displayed in the history. Admins want to delete
just the topic and not worry about individual post.
This patch runs an additional permission check whenever the content
of a revision is requested.
Change-Id: I1918b749f8f7715181827fd5897092ab85b89e84
---
M includes/Templating.php
1 file changed, 10 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/32/159632/1
diff --git a/includes/Templating.php b/includes/Templating.php
index 3d88570..24a84d8 100644
--- a/includes/Templating.php
+++ b/includes/Templating.php
@@ -229,7 +229,16 @@
* @return string HTML if requested, otherwise plain text
*/
public function getContent( AbstractRevision $revision, $format =
'html' ) {
- if ( $this->permissions->isAllowed( $revision, 'view' ) ) {
+ $allowed = $this->permissions->isAllowed( $revision, 'view' );
+ // Post's require view access to the topic title as well
+ if ( $allowed && $revision instanceof PostRevision &&
!$revision->isTopicTitle() ) {
+ $allowed = $this->permissions->isAllowed(
+ $revision->getRootPost(),
+ 'view'
+ );
+ }
+
+ if ( $allowed ) {
// html format
if ( $format === 'html' ) {
// Parsoid doesn't render redlinks & doesn't
strip bad images
--
To view, visit https://gerrit.wikimedia.org/r/159632
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1918b749f8f7715181827fd5897092ab85b89e84
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits