• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6657: WebPermissions plugin 5.x compatibility problem

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension WebPermissionsPlugin Low New   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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

ItemTemplate
Summary WebPermissions plugin 5.x compatibility problem
ReportedBy TWiki:Main.SzymonSobczyk
Codebase 5.0.1
SVN Range TWiki-5.0.1, Tue, 11 Jan 2011, build 20174
AppliesTo Extension
Component WebPermissionsPlugin
Priority Low
CurrentState New
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Topic revision: r1 - 2011-03-08 - SzymonSobczyk
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback