Skip to content

Commit

Permalink
Item13897: AccessControlException now sets text attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Nov 4, 2016
1 parent 31ed244 commit 741239d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions core/lib/Foswiki/AccessControlException.pm
Expand Up @@ -118,21 +118,34 @@ Generate a summary string. This is mainly for debugging.
=cut

around stringify => sub {
my $orig = shift;
my $this = shift;
sub _accessText {
my $this = shift;

my $topic = $this->topic
|| ''; # Access checks of Web objects causes uninitialized string errors
my $web = $this->web // '*UNDEF*';

return
"AccessControlException: Access to "
. $this->mode . " "
. $web
. ".$topic for "
. $this->user
. " is denied. "
. $this->reason
. ( DEBUG ? $this->stacktrace : "" );
. $this->reason;
}

around stringify => sub {
my $orig = shift;
my $this = shift;
return $this->_accessText . ( DEBUG ? $this->stacktrace : "" );
};

around prepareText => sub {
my $orig = shift;
my $this = shift;

return $this->_accessText;
};

1;
Expand Down

0 comments on commit 741239d

Please sign in to comment.