From 7e53a47e430e3d257cf2cbe7c572fa9d4d67317b Mon Sep 17 00:00:00 2001 From: MichaelDaum Date: Thu, 28 Apr 2022 11:23:23 +0200 Subject: [PATCH] Item15090: mailnotify script must run as admin user Item15091: only notify people of topics that they have view access to --- MailerContrib/data/System/MailerContrib.txt | 10 ++++------ MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm | 6 +++--- .../lib/Foswiki/Contrib/MailerContrib/WebNotify.pm | 13 +------------ MailerContrib/tools/mailnotify | 2 +- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/MailerContrib/data/System/MailerContrib.txt b/MailerContrib/data/System/MailerContrib.txt index 6792457cf5..016a5e1db8 100644 --- a/MailerContrib/data/System/MailerContrib.txt +++ b/MailerContrib/data/System/MailerContrib.txt @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="ProjectContributor" comment="" date="1515465502" format="1.1" version="1"}% +%META:TOPICINFO{author="ProjectContributor" comment="" date="1651137756" format="1.1" version="1"}% %META:TOPICPARENT{name="Contribs"}% ---+!! Mailer Contrib @@ -266,14 +266,13 @@ And we create a topic in the web called !WebNotifyCustomTemplate which contains ---+++ Info -Another great Foswiki extension from the WikiRing *WikiRing* - working together to improve your wiki experience! - Many thanks to the following sponsors for supporting this work: * [[http://www.windriver.com][Wind River]] * [[http://wikigardens.com][WikiGardens]] -| Copyright ©: | 2004, Wind River Systems; 2009-2014 Foswiki Contributors | +| Copyright ©: | 2004, Wind River Systems; 2009-2022 Foswiki Contributors | | Change History: | | +| 2.90 (28 Apr 2022) | Foswikitask:Item15090: mailnotify script must run as admin user %BR% Foswikitask:Item15091: only notify people of topics that they have view access to | | 2.85 (8 Jan 2018) | Foswiki 2.1.5 Foswikitask:Item14554: remove link to unused wikiring.com domain.
\ Foswikitask:Item13350: Mailnotify appears to skip notification of some changes.
\ Foswikitask:Item14446: Unwritable =work_area= results in mega-spam.
\ @@ -324,5 +323,4 @@ Many thanks to the following sponsors for supporting this work: %META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/%25$ROOTMODULE%25"}% %META:FIELD{name="Version" title="Version" value="%25$VERSION%25"}% %META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/distro"}% -%META:FILEATTACHMENT{name="logo.gif" attr="h" comment="" date="1515465502" size="11437" user="ProjectContributor" version="1"}% -%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" comment="" date="1515465502" size="1343" user="ProjectContributor" version="1"}% +%META:FILEATTACHMENT{name="logo.gif" attr="h" comment="" date="1651137756" size="11437" user="ProjectContributor" version="1"}% diff --git a/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm b/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm index 5ed95ac279..ffb3f64ad2 100644 --- a/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm +++ b/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm @@ -29,8 +29,8 @@ use Foswiki::Contrib::MailerContrib::Change (); use Foswiki::Contrib::MailerContrib::UpData (); # Also change Version/Release in Plugins/MailerContrib.pm -our $VERSION = '2.85'; -our $RELEASE = '8 Jan 2018'; +our $VERSION = '2.90'; +our $RELEASE = '28 Apr 2022'; our $SHORTDESCRIPTION = 'Supports email notification of changes'; # PROTECTED STATIC ensure the contrib is internally initialised @@ -711,7 +711,7 @@ sub _UTF8print { __END__ Module of Foswiki - The Free and Open Source Wiki, http://foswiki.org/ -Copyright (C) 2008-2016 Foswiki Contributors. All Rights Reserved. +Copyright (C) 2008-2022 Foswiki Contributors. All Rights Reserved. Foswiki Contributors are listed in the AUTHORS file in the root of this distribution. NOTE: Please extend that file, not this notice. diff --git a/MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm b/MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm index be46b69dc7..e31ad14e89 100644 --- a/MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm +++ b/MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm @@ -263,8 +263,7 @@ sub processChange { # Check access is allowed to the most recent revision my $to = - Foswiki::Meta->load( $Foswiki::Plugins::SESSION, $web, $topic, - $change->{CURR_REV} ); + Foswiki::Meta->load( $Foswiki::Plugins::SESSION, $web, $topic ); unless ( $to->haveAccess( 'VIEW', $cuid ) ) { print STDERR "$name has no permission to view r$change->{CURR_REV} of $web.$topic\n" @@ -272,16 +271,6 @@ sub processChange { next; } - $to = - Foswiki::Meta->load( $Foswiki::Plugins::SESSION, $web, $topic, - $change->{BASE_REV} ); - unless ( $to->haveAccess( 'VIEW', $cuid ) ) { - print STDERR -"$name has no permission to view r$change->{BASE_REV} of $web.$topic\n" - if TRACE; - next; - } - print "$name will be notified of changes to $topic\n" if TRACE; my $emails = $subscriber->getEmailAddresses(); if ( $emails && scalar(@$emails) ) { diff --git a/MailerContrib/tools/mailnotify b/MailerContrib/tools/mailnotify index 44d5e13bc7..bb022e2a2e 100755 --- a/MailerContrib/tools/mailnotify +++ b/MailerContrib/tools/mailnotify @@ -75,6 +75,6 @@ foreach my $arg (@ARGV) { use Foswiki(); use Foswiki::Contrib::MailerContrib (); -new Foswiki(); +new Foswiki('admin'); Foswiki::Contrib::MailerContrib::mailNotify( \@webs, \@exwebs, %options );