If the User Function Style template is cut or deleted, use the Fail Safe template instead. Fixes bug #11729
This commit is contained in:
parent
5426ea4575
commit
5bc83c4b17
3 changed files with 70 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
7.9.10
|
7.9.10
|
||||||
- fixed #11721: spamStopWords not in WebGUI.conf.original
|
- fixed #11721: spamStopWords not in WebGUI.conf.original
|
||||||
|
- fixed #11729: Trash your User Function Style, and WebGUI locks you out
|
||||||
|
|
||||||
7.9.9
|
7.9.9
|
||||||
- fixed #11693: Shopping cart does not show for visitor user
|
- fixed #11693: Shopping cart does not show for visitor user
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,24 @@ These methods are available from this class:
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 cut ( )
|
||||||
|
|
||||||
|
Extend the base method to handle cutting the User Function Style template and destroying your site.
|
||||||
|
If the current template is the User Function Style template with the Fail Safe template.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub cut {
|
||||||
|
my ( $self ) = @_;
|
||||||
|
my $returnValue = $self->SUPER::cut();
|
||||||
|
if ($returnValue && $self->getId eq $self->session->setting->get('userFunctionStyleId')) {
|
||||||
|
$self->session->setting->set('userFunctionStyleId', 'PBtmpl0000000000000060');
|
||||||
|
}
|
||||||
|
return $returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 definition ( session, definition )
|
=head2 definition ( session, definition )
|
||||||
|
|
||||||
Defines the properties of this asset.
|
Defines the properties of this asset.
|
||||||
|
|
@ -658,6 +676,24 @@ sub processRaw {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 purge ( )
|
||||||
|
|
||||||
|
Extend the base method to handle purging the User Function Style template and destroying your site.
|
||||||
|
If the current template is the User Function Style template with the Fail Safe template.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub purge {
|
||||||
|
my $self = shift;
|
||||||
|
my $returnValue = $self->SUPER::purge;
|
||||||
|
if ($returnValue && $self->getId eq $self->session->setting->get('userFunctionStyleId')) {
|
||||||
|
$self->session->setting->set('userFunctionStyleId', 'PBtmpl0000000000000060');
|
||||||
|
}
|
||||||
|
return $returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 update
|
=head2 update
|
||||||
|
|
||||||
Override update from Asset.pm to handle backwards compatibility with the old
|
Override update from Asset.pm to handle backwards compatibility with the old
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use WebGUI::Test;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Asset::Template;
|
use WebGUI::Asset::Template;
|
||||||
use Exception::Class;
|
use Exception::Class;
|
||||||
use Test::More tests => 44; # increment this value for each test you create
|
use Test::More tests => 48; # increment this value for each test you create
|
||||||
use Test::Deep;
|
use Test::Deep;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use JSON qw{ from_json };
|
use JSON qw{ from_json };
|
||||||
|
|
@ -183,3 +183,35 @@ WebGUI::Test->restoreLogging;
|
||||||
|
|
||||||
WebGUI::Test->addToCleanup(WebGUI::VersionTag->getWorking($session));
|
WebGUI::Test->addToCleanup(WebGUI::VersionTag->getWorking($session));
|
||||||
|
|
||||||
|
my $userStyleTemplate = $importNode->addChild({
|
||||||
|
className => "WebGUI::Asset::Template",
|
||||||
|
title => "user function style",
|
||||||
|
url => "ufs",
|
||||||
|
template => "user function style",
|
||||||
|
namespace => 'WebGUI Test Template',
|
||||||
|
});
|
||||||
|
|
||||||
|
my $someOtherTemplate = $importNode->addChild({
|
||||||
|
className => "WebGUI::Asset::Template",
|
||||||
|
title => "some other template",
|
||||||
|
url => "sot",
|
||||||
|
template => "some other template",
|
||||||
|
namespace => 'WebGUI Test Template',
|
||||||
|
});
|
||||||
|
|
||||||
|
$session->setting->set('userFunctionStyleId', $userStyleTemplate->getId);
|
||||||
|
|
||||||
|
my $purgeCutTag = WebGUI::VersionTag->getWorking($session);
|
||||||
|
WebGUI::Test->addToCleanup($purgeCutTag);
|
||||||
|
|
||||||
|
is($session->setting->get('userFunctionStyleId'), $userStyleTemplate->getId, 'Setup for cut tests.');
|
||||||
|
|
||||||
|
$userStyleTemplate->cut;
|
||||||
|
is($session->setting->get('userFunctionStyleId'), 'PBtmpl0000000000000060', 'cut resets the user function style template to Fail Safe');
|
||||||
|
|
||||||
|
$userStyleTemplate->publish;
|
||||||
|
$session->setting->set('userFunctionStyleId', $userStyleTemplate->getId);
|
||||||
|
is($session->setting->get('userFunctionStyleId'), $userStyleTemplate->getId, 'Reset for purge test');
|
||||||
|
|
||||||
|
$userStyleTemplate->purge;
|
||||||
|
is($session->setting->get('userFunctionStyleId'), 'PBtmpl0000000000000060', 'purge resets the user function style template to Fail Safe');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue