SID-00379: MailNotify not showing Form Data in Secure Web
| Status: |
Answered |
TWiki version: |
4.3.0 |
Perl version: |
5.8.8 |
| Category: |
MailerContrib |
Server OS: |
Debian / Ubuntu Server 8 |
Last update: |
17 years ago |
Our boss recently asked that some Webs on our TWiki site be restricted from TWikiGuest.
After doing this, we discovered that now mailnotify doesn't fully work on any topic on those webs.
Now it only states that there were changes in the topics in those webs, but fails to show the content/changes of those topics.
Our mailnotify template works on all topics in non-restricted Webs showing FORMFIELDS as part of the notification, but for some reason fails to do so on restricted Webs. (Searches also don't seem to work as part of the notification in any topic in these locked down webs).
It's as if there are two users being invoked to perform the Notification, the first one has access to view/know there were changes, but the one generating the email doesn't have access and therefore the searches/formfield queries are showing up empty. (Even though the actual end-user subscribed to the notification has access to this topic/web).
In other support topics I saw that there used to be a way to run mailnotify under a specific username, but I can't figure out how to do this in version 4.3.
We need a solution to this problem, either to run the script as admin without further user access checks, (since all users had to have access to the web in the first place in order to subscribe to receive notifications). Or a way to lock these Webs in a way that notiifications still work.
So the main questions are:
- Is there a way to make
MailNotify run as anything other than TWikiGuest if this is the problem?
- Is there another workaround to make either searches or displaying
FormField information in those notifications in the Secure Web?
- Maybe there's another way to "lock" the webs without using the "* Set DENYWEBVIEW =
TWikiGuest"?
Thanks in advance for any help.
--
HugoDeLaCerda - 2009-06-18
Discussion and Answer
Solved, the solution was to change MailerContrib.pm in the following way:
Under sub mailNotify,
was:
$twiki = new TWiki();
now is:
$twiki = new TWiki($TWiki::cfg{AdminUserWikiName});
example:
sub mailNotify {
my( $webs, $twiki, $noisy, $exwebs ) = @_;
$verbose = $noisy;
my $webstr;
if ( defined( $webs )) {
$webstr = join( '|', @$webs );
}
$webstr = '*' unless ( $webstr );
$webstr =~ s/\*/\.\*/g;
my $exwebstr = '';
if ( defined( $exwebs )) {
$exwebstr = join( '|', @$exwebs );
}
$exwebstr =~ s/\*/\.\*/g;
if (!defined $twiki) {
$twiki = new TWiki($TWiki::cfg{AdminUserWikiName});
}
$TWiki::Plugins::SESSION = $twiki;
my $context = TWiki::Func::getContext();
$context->{command_line} = 1;
# absolute URL context for email generation
$context->{absolute_urls} = 1;
initContrib();
my $report = '';
foreach my $web ( TWiki::Func::getListOfWebs( 'user ') ) {
if ( $web =~ /^($webstr)$/ && $web !~ /^($exwebstr)$/ ) {
$report .= _processWeb( $twiki, $web );
}
}
$context->{absolute_urls} = 0;
return $report;
}
--
HugoDeLaCerda - 2009-07-16
Thanks Hugo for reporting back a solution. I believe this is a safe change. Could you file a bug report to track this? See link in the sidebar.
--
PeterThoeny - 2009-07-17
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.