Commit 1c33536b authored by Chia-liang Kao's avatar Chia-liang Kao Committed by Alex Vandiver
Browse files

refactor showtemplate permission check.

parent 66950ec3
......@@ -111,7 +111,7 @@ if the user passes an ACL check, otherwise returns undef.
sub _Value {
my $self = shift;
unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
unless ( $self->CurrentUserCanRead() ) {
return undef;
}
return $self->__Value( @_ );
......@@ -375,7 +375,7 @@ sub _ParseContent {
@_
);
unless ( $self->CurrentUserHasQueueRight('ShowTemplate') ) {
unless ( $self->CurrentUserCanRead() ) {
return (undef, $self->loc("Permission Denied"));
}
......@@ -470,4 +470,16 @@ sub CurrentUserHasQueueRight {
return ( $self->QueueObj->CurrentUserHasRight(@_) );
}
=head2 CurrentUserCanRead
=cut
sub CurrentUserCanRead {
my $self =shift;
return $self->QueueObj->Id
? $self->CurrentUserHasQueueRight('ShowTemplate')
: $self->CurrentUser->HasRight( Right =>'ShowGlobalTemplates', Object => $RT::System );
}
1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment