[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-283-g36086ce

Shawn Moore sartak at bestpractical.com
Thu Aug 5 17:49:15 EDT 2010


The branch, new-style-templates has been updated
       via  36086ce63c1bba763486b61c5d9d7ef3a9fc1e1d (commit)
      from  1b05f45a943f64c39efa8d2e1a8877fb148b2406 (commit)

Summary of changes:
 lib/RT/Template_Overlay.pm |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 36086ce63c1bba763486b61c5d9d7ef3a9fc1e1d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Aug 5 17:50:55 2010 -0400

    Forbid updating Content if Type is Perl

diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index bf108bd..c9f6dfe 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -611,6 +611,23 @@ sub SetType {
     return $self->_Set( Field => 'Type', Value => $NewType );
 }
 
+=head2 SetContent
+
+If setting Content, require the ExecuteCode right.
+
+=cut
+
+sub SetContent {
+    my $self    = shift;
+    my $content = shift;
+
+    if ($self->Type eq 'Perl' && !$self->CurrentUser->HasRight(Right => 'ExecuteCode', Object => $RT::System)) {
+        return ( undef, $self->loc('Permission Denied') );
+    }
+
+    return $self->_Set( Field => 'Content', Value => $content );
+}
+
 =head2 CompileCheck
 
 If the template's Type is Perl, then compile check all the codeblocks to see if

-----------------------------------------------------------------------


More information about the Rt-commit mailing list