[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-287-g503eeaf

Shawn Moore sartak at bestpractical.com
Thu Aug 5 18:59:50 EDT 2010


The branch, new-style-templates has been updated
       via  503eeafb8465da8cfb821cb92e857dbc544e21bc (commit)
       via  18c534fc2e477aed98356f949eefdbe5765fe76f (commit)
       via  8a2725a1031352ee57b28e21b496ce329bb31f17 (commit)
       via  15286cbd5a708759bff1fa0b1ecada2d11bdd390 (commit)
      from  36086ce63c1bba763486b61c5d9d7ef3a9fc1e1d (commit)

Summary of changes:
 lib/RT/Record.pm                      |   27 +++++++-
 lib/RT/Template_Overlay.pm            |   24 ++++---
 share/html/Ticket/Elements/EditBasics |  118 +++++++++++++++++---------------
 share/html/Ticket/Update.html         |   64 +++++++++---------
 4 files changed, 134 insertions(+), 99 deletions(-)

- Log -----------------------------------------------------------------
commit 18c534fc2e477aed98356f949eefdbe5765fe76f
Merge: 36086ce 8a2725a
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Aug 5 18:57:30 2010 -0400

    Merge branch '3.9-trunk' into new-style-templates


commit 503eeafb8465da8cfb821cb92e857dbc544e21bc
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Aug 5 19:01:32 2010 -0400

    Really forbid updating Type to Perl and Content without ExecuteCode at once

diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index c9f6dfe..9293929 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -611,21 +611,23 @@ sub SetType {
     return $self->_Set( Field => 'Type', Value => $NewType );
 }
 
-=head2 SetContent
-
-If setting Content, require the ExecuteCode right.
-
-=cut
+sub _UpdateAttributes {
+    my $self = shift;
+    my %args = (
+        NewValues => {},
+        @_,
+    );
 
-sub SetContent {
-    my $self    = shift;
-    my $content = shift;
+    my $type = $args{NewValues}{Type} || $self->Type;
 
-    if ($self->Type eq 'Perl' && !$self->CurrentUser->HasRight(Right => 'ExecuteCode', Object => $RT::System)) {
-        return ( undef, $self->loc('Permission Denied') );
+    # forbid updating content when the (possibly new) value of Type is Perl
+    if ($type eq 'Perl' && exists $args{NewValues}{Content}) {
+        if (!$self->CurrentUser->HasRight(Right => 'ExecuteCode', Object => $RT::System)) {
+            return $self->loc('Permission Denied');
+        }
     }
 
-    return $self->_Set( Field => 'Content', Value => $content );
+    return $self->SUPER::_UpdateAttributes(%args);
 }
 
 =head2 CompileCheck

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


More information about the Rt-commit mailing list