Forbid pasting content below a shortcut, to prevent loops on purge and other operations. Fixes bug #11855.

This commit is contained in:
Colin Kuskie 2010-09-13 18:47:17 -07:00
parent 1d99ee451e
commit 927b986795
4 changed files with 52 additions and 2 deletions

View file

@ -789,6 +789,19 @@ sub notLinked {
#-------------------------------------------------------------------
=head2 paste ( )
Pasting assets under a Shortcut can cause lots of problems, including infinite loops
for operations like paste, and purge.
=cut
sub paste {
return 0;
}
#-------------------------------------------------------------------
=head2 prepareView ( )
See WebGUI::Asset::prepareView() for details. Extends the base class to call prepareView

View file

@ -213,7 +213,8 @@ sub paste {
return 0 unless ($pastedAsset->canPaste()); ##Allow pasted assets to have a say about pasting.
# Don't allow a shortcut to create an endless loop
return 0 if ($pastedAsset->get("className") eq "WebGUI::Asset::Shortcut" && $pastedAsset->get("shortcutToAssetId") eq $self->getId);
##Do not paste a shortcut immediately below the original asset
return 0 if $pastedAsset->isa('WebGUI::Asset::Shortcut') && $pastedAsset->get("shortcutToAssetId") eq $self->getId;
my $i18n=WebGUI::International->new($session, 'Asset');
$outputSub->(sprintf $i18n->get('pasting %s'), $pastedAsset->getTitle) if defined $outputSub;
if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self)) {