| AppliesTo: | Component: | Priority: | CurrentState: | WaitingFor: | TargetRelease | ReleasedIn |
|---|---|---|---|---|---|---|
| Engine | Urgent | Closed | patch | 4.2.1, 5.0.0 |
| allows | 'X' allows 'Y' is true if web/topic 'X' exists and allows access mode 'Y' for the current user. Web access rights are only checked if there is no topic called 'X'. |
Fn_IF::test_ALLOWS_and_EXISTS
%IF{"'TemporaryIFTestWebIF.NonExitantLazyFox' allows 'change'" then="1" else="0"}%: '0' at /home/sven/src/twiki/twiki/branches/TWikiRelease04x02/lib/Unit/TestCase.pm line 151
Unit::TestCase::assert_str_equals('Fn_IF=HASH(0xea31f0)', 1, 0, '%IF{"\'TemporaryIFTestWebIF.NonExitantLazyFox\' allows \'chan...') called at /home/sven/src/twiki/twiki/branches/TWikiRelease04x02/test/unit/Fn_IF.pm line 714
Fn_IF::test_ALLOWS_and_EXISTS('Fn_IF=HASH(0xea31f0)') called at /home/sven/src/twiki/twiki/branches/TWikiRelease04x02/lib/Unit/TestRunner.pm line 49
Unit::TestRunner::__ANON__() called at /home/sven/src/twiki/twiki/branches/TWikiRelease04x02/lib/CPAN/lib/Error.pm line 379
eval {...} called at /home/sven/src/twiki/twiki/branches/TWikiRelease04x02/lib/CPAN/lib/Error.pm line 371
Error::subs::try('CODE(0x175e360)', 'HASH(0x1b40cb0)') called at /home/sven/src/twiki/twiki/branches/TWikiRelease04x02/lib/Unit/TestRunner.pm line 55
Unit::TestRunner::start('Unit::TestRunner=HASH(0x604fd0)', 'Fn_IF.pm') called
and so, I'll be fuxing that for 4.2.1
-- TWiki:Main/SvenDowideit
push(@tests, {
test => "'NotAHopeInHellPal' allows 'view'",
expect => "0"
});
the fix is:
Index: lib/TWiki/If/Node.pm
===================================================================
--- lib/TWiki/If/Node.pm (revision 158)
+++ lib/TWiki/If/Node.pm (working copy)
@@ -62,13 +62,16 @@
$session->{webName}, $str);
my $ok = 0;
if ($session->{store}->topicExists($web, $topic)) {
+ #try the non-precise name as an existant topic first.
$ok = $session->security->checkAccessPermission(
uc($mode), $session->{user}, undef, undef, $topic, $web);
} elsif ($session->{store}->webExists($str)) {
$ok = $session->security->checkAccessPermission(
uc($mode), $session->{user}, undef, undef, undef, $str);
+ } elsif ($session->{store}->webExists($web)) {
+ #not an existing topic or web - assume any lone name is a topic without a web specified
+ $ok = $session->security->checkAccessPermission(
+ uc($mode), $session->{user}, undef, undef, $topic, $web);
} else {
$ok = 0;
}
return $ok ? 1 : 0;
}
Index: twikiplugins/UnitTestContrib/test/unit/Fn_IF.pm
===================================================================
--- twikiplugins/UnitTestContrib/test/unit/Fn_IF.pm (revision 16607)
+++ twikiplugins/UnitTestContrib/test/unit/Fn_IF.pm (working copy)
@@ -672,6 +672,18 @@
expect => "1"
});
push(@tests, {
+ test => '\''.$this->{test_web}.'.NonExitantLazyFox\' allows \'change\'',
+ expect => "1"
+ });
+ push(@tests, {
+ test => '\'NonExistantWeb.WebHome\' allows \'change\'',
+ expect => "0"
+ });
+ push(@tests, {
+ test => '\'NonExistantWeb.NonExitantLazyFox\' allows \'change\'',
+ expect => "0"
+ });
+ push(@tests, {
test => "istopic 'LazyFox'",
expect => "0"
});
What do you think Crawford?
-- TWiki:Main.SvenDowideit| ItemTemplate | |
|---|---|
| Summary | IF allows does not work correctly if the topic does not exist. |
| ReportedBy |
TWiki:Main.SvenDowideit |
| Codebase | 4.2.0, ~twiki4 |
| SVN Range | TWiki-5.0.0, Thu, 03 Apr 2008, build 16612 |
| AppliesTo | Engine |
| Component | |
| Priority | Urgent |
| CurrentState | Closed |
| WaitingFor | |
| Checkins |
TWikirev:16641 |
| TargetRelease | patch |
| ReleasedIn | 4.2.1, 5.0.0 |