Symptoms and impact
The page for editing topic permissions (topicacls) allows to 'Save' or 'Cancel' changes. When the user clicks on any of those options there is an error message stating either:
cancel permissions action (for Cancel action)
permissions action saved (for Save action)
For the 'Save' action it only happens if user actually changes any permissions.
This error is just a nuisance because the action is actually performed and error is thrown afterwards (so the permissions editing works just fine).
Cause of the problem
The problem is in lib/TWiki/Plugins/WebPermissionsPlugin/Core.pm - plugin version 20623 (2011-03-06). Relevant code fragments:
239 if ($action ne 'Save') {
240 #SMELL: canceling out from, or just stoping a save seems to be quite difficult
241 TWiki::Func::redirectCgiQuery( $query, &TWiki::Func::getViewUrl( $web, $topic ) );
242 throw Error::Simple( 'cancel permissions action' );
243 }
and
278 #SMELL: canceling out from, or just stoping a save seems to be quite difficult
279 #return a redirect to view..
280 TWiki::Func::redirectCgiQuery( $query, &TWiki::Func::getViewUrl( $web, $topic ) );
281 throw Error::Simple( 'permissions action saved' );
It looks like the plugin incorrectly assumes that redirectCgiQuery() call will only return on redirection error, which is not the case.
Proposed fix
The simplest fix is to replace the throw lines (#242 and #281) with return undef;
There is not much point for error checking after redirectCgiQuery() and most plugins I've checked are simply doing return 0; or return undef; in such situations.
--
SzymonSobczyk - 2011-03-08