This question about Using an extension: Needs followup in Tasks

How to set actionnotify user

I'm using ActionTrackerPlugin (2013-02-27, 2.4.10) on Foswiki 2.1.2 with PlainFile store. The actionnotify script is not sending any mails. ACTIONSEARCH is working, and listing actions. I traced the problem to Foswiki::Func::searchInWebContent not returning any matches. Tracing further, there are (correct) search results up until the permissions check $resultset = $this->addACLFilter( $resultset, $options ); in Foswiki::Store::Interfaces::QueryAlgorithm::query

That makes sense because the webs' VIEW is restricted (and ACTIONSEARCH works because I am logged in as a user with VIEW permission). If I comment out this permissions check, then actionnotify sends the emails that I expect. If I instead pass a username with the necessary permissions to new Foswiki() (e.g. my $session = new Foswiki('Main.MichaelTempest'); ) in Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::actionNotify, then it also sends out the emails (though it also complains "Use of uninitialized value in string eq at C:/wamp/foswiki2/lib/Foswiki/Users/TopicUserMapping.pm line 574.")

How should I set the wiki user that actionnotify uses?

-- MichaelTempest - 04 Jul 2017

IIRC the actionnotify script lets you pass in a username. -user. Though I confess I thought it ran as admin by default. Can admin access the topics of interest?

Line 574 of TopicUserMapping is the middle of a comment, in git. I'm guessing it's because {session}->{user} is undefined, though.

-- Main.CrawfordCurrie - 07 Jul 2017 - 09:28

AdminUser can access all topics.

-user does not seem to set the user. But maybe I just didn't have the correct incantation.

actionnotify (eventually) calls Foswiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWeb() with "internal" set to 1, which causes it to skip permission tests. However, Foswiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWeb() first calls Foswiki::Func::searchInWebContent which applies permission tests itself, and those tests fail because {session}->{user} defaults to the guest user.

{session}->{user} is indeed undefined. For reference: https://github.com/foswiki/distro/blob/FoswikiRelease02x01x02/TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm#L574

Using my $session = new Foswiki('Main.AdminUser'); in Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::actionNotify results in emails going out, and no "use of uninitialised value" warning from TopicUserMapping.

-- MichaelTempest - 10 Jul 2017

Yeah, there needs to be a way to set the user from the command-line. This is done in a number of other similar scripts but obviously never made it this far. Please raise a task (and DIY if your fingers need a bit of exercise wink )

-- Main.CrawfordCurrie - 10 Jul 2017 - 18:23

 

QuestionForm edit

Subject Using an extension
Extension ActionTrackerPlugin
Version Foswiki 2.1.2
Status Needs followup in Tasks
Related Topics
Topic revision: r4 - 10 Jul 2017, CrawfordCurrie - This page was cached on 16 Oct 2018 - 23:46.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy