Fix a bug where GUID style userIds were rejected by AssetExportHtml.

This commit is contained in:
Colin Kuskie 2008-09-14 02:39:32 +00:00
parent dda8b74734
commit 7d59a4d7c7
2 changed files with 17 additions and 3 deletions

View file

@ -224,7 +224,7 @@ sub exportAsHtml {
}
# we take either a numeric userId or a WebGUI::User object
if( ref $userId ne 'WebGUI::User' && !looks_like_number($userId) ) {
if( ref $userId ne 'WebGUI::User' && ! (looks_like_number($userId) || $session->id->valid($userId))) {
$returnCode = 0;
$message = "'$userId' is not a valid userId";
return ($returnCode, $message);
@ -826,7 +826,7 @@ sub www_export {
-value => "index.html"
);
$f->text(
-label => 'Export site root URL',
-label => $i18n->get("Export site root URL"),
-name => 'exportUrl',
-value => '',
);

View file

@ -42,7 +42,7 @@ my $originalExportPath = $session->config->get('exportPath');
my $testRan = 1;
if ($originalExportPath) {
plan tests => 145; # Increment this number for each test you create
plan tests => 146; # Increment this number for each test you create
}
else {
$testRan = 0;
@ -714,6 +714,13 @@ is($message, "need a userId parameter", "exportAsHtml returns correct message wh
is($success, 0, "exportAsHtml returns 0 when given a bogus (but nonetheless funny) userId");
is($message, "'<rizen> perlDreamer is a 500 lb test mandating gorilla' is not a valid userId", "exportAsHtml returns correct message when given a bogus (but nonetheless funny) userId");
# checking an autogenerated userId
my $randomUser = WebGUI::User->new($session, 'new');
($success, $message) = $home->exportAsHtml( { userId => $randomUser->userId, depth => 99} );
is($success, 1, "exportAsHtml returns 1 when given a valid userId");
$randomUser->delete;
undef $randomUser;
# checking userId works, so check extrasUploadAction next.
($success, $message) = $home->exportAsHtml( { userId => 3, depth => 99, extrasUploadAction => 'o hai' } );
is($success, 0, "exportAsHtml returns 0 when given bogus, memetic extrasUploadAction parameter");
@ -1010,5 +1017,12 @@ END {
# make sure people can view /home
$home->update( { groupIdView => 7 } ); # everyone
# delete test user
if ($randomUser and ref $randomUser eq 'WebGUI::User') {
$randomUser->delete;
}
}
}