summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Scrip_Overlay.pm
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib/RT/Scrip_Overlay.pm')
-rw-r--r--rt/lib/RT/Scrip_Overlay.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/rt/lib/RT/Scrip_Overlay.pm b/rt/lib/RT/Scrip_Overlay.pm
index e91f8d64d..c5615c52b 100644
--- a/rt/lib/RT/Scrip_Overlay.pm
+++ b/rt/lib/RT/Scrip_Overlay.pm
@@ -507,12 +507,42 @@ sub Commit {
# does an acl check and then passes off the call
sub _Set {
my $self = shift;
+ my %args = (
+ Field => undef,
+ Value => undef,
+ @_,
+ );
unless ( $self->CurrentUserHasRight('ModifyScrips') ) {
$RT::Logger->debug(
"CurrentUser can't modify Scrips for " . $self->Queue . "\n" );
return ( 0, $self->loc('Permission Denied') );
}
+
+ if (exists $args{Value}) {
+ if ($args{Field} eq 'Queue') {
+ if ($args{Value}) {
+ # moving to another queue
+ my $queue = RT::Queue->new( $self->CurrentUser );
+ $queue->Load($args{Value});
+ unless ($queue->Id and $queue->CurrentUserHasRight('ModifyScrips')) {
+ return ( 0, $self->loc('Permission Denied') );
+ }
+ } else {
+ # moving to global
+ unless ($self->CurrentUser->HasRight( Object => RT->System, Right => 'ModifyScrips' )) {
+ return ( 0, $self->loc('Permission Denied') );
+ }
+ }
+ }
+ elsif ($args{Field} eq 'Template') {
+ my $template = RT::Template->new( $self->CurrentUser );
+ $template->Load($args{Value});
+ unless ($template->Id and $template->CurrentUserHasQueueRight('ShowTemplate')) {
+ return ( 0, $self->loc('Permission Denied') );
+ }
+ }
+ }
return $self->__Set(@_);
}