Skip to content

Commit

Permalink
Item15090: mailnotify script must run as admin user
Browse files Browse the repository at this point in the history
Item15091: only notify people of topics that they have view access to
  • Loading branch information
MichaelDaum committed Apr 28, 2022
1 parent b32067a commit 7e53a47
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
10 changes: 4 additions & 6 deletions 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
<img src="%ATTACHURL%/logo.gif" class="foswikiRight" />
Expand Down Expand Up @@ -266,14 +266,13 @@ And we create a topic in the web called !WebNotifyCustomTemplate which contains

---+++ Info

Another great Foswiki extension from the <img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="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 &copy;: | 2004, Wind River Systems; 2009-2014 Foswiki Contributors |
| Copyright &copy;: | 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.<br/>\
Foswikitask:Item13350: Mailnotify appears to skip notification of some changes.<br/>\
Foswikitask:Item14446: Unwritable =work_area= results in mega-spam.<br/>\
Expand Down Expand Up @@ -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"}%
6 changes: 3 additions & 3 deletions MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
13 changes: 1 addition & 12 deletions MailerContrib/lib/Foswiki/Contrib/MailerContrib/WebNotify.pm
Expand Up @@ -263,25 +263,14 @@ 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"
if TRACE;
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) ) {
Expand Down
2 changes: 1 addition & 1 deletion MailerContrib/tools/mailnotify
Expand Up @@ -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 );

0 comments on commit 7e53a47

Please sign in to comment.