• 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.

As seen in Item2884, the EditTablePlugin broke due to a spec change in how TWiki::Func::checkAccessPermission is deciding if to look for access permissions in the supplied $text parameter or not. The TWiki:TWiki04.TWikiFuncDotPm#check_AccessPermission_type_wiki stated that $text "Topic text, optional. If empty, topic $web.$topic is consulted." (emphasis added. The EditTablePlugin had this test:

if( ! TWiki::Func::checkAccessPermission( 'change', $wikiUserName, '', $theTopic, $theWeb ) ) {

This does not work anymore. The latest code seems to require undef, which is a spec change, and which is not the documented behaviour.

For now to fix Item2884 I did a workaround by changing the empty parameter to undef, but the core code needs to be fixed.

-- PTh

I changed the spec of the internal TWiki::Access::checkAccessPermission method because it was broken for checking permissions in meta. It is unfortunate that the Func interface passed parameters on to this method without any kind of additional checking, and more unfortunate that no tests were ever provided for verifying the Func interface. Note also that the documentation was incorrect anyway. In reality, any perl false value (0, '' or undef) for $text would cause it to re-read the topic, which rather stretches the meaning of "empty". One effect of this was repeated re-reads of an empty topic.

I fixed the documentation of Func, and made it pass undef to the core call when a perl false value is passed in. I also added a unit test for the corrected spec. I would like to encourage you to add a unit test in the event you find another ambiguous API.


Merging this to Patch04x00.


Summary TWiki::Func::checkAccessPermission issue with '' vs. undef
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4
SVN Range TWiki-4.1, Sun, 08 Oct 2006, build 11688
AppliesTo Engine

Priority Urgent
CurrentState Closed

Checkins 11703 11705
TargetRelease minor
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r7 - 2006-11-14 - KennethLavrsen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback