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.
CC
Merging this to Patch04x00.
KJL