[Rt-commit] rt branch, 4.0/simple-template-permission, created. rt-4.0.5-138-g5e5a63f

Alex Vandiver alexmv at bestpractical.com
Thu Jun 21 19:41:39 EDT 2012


The branch, 4.0/simple-template-permission has been created
        at  5e5a63f3f7044e3a9e5b9ca121b21cda3850adfc (commit)

- Log -----------------------------------------------------------------
commit 3b100cffbbfa2d92e354eec6f5d71014bdc4b80e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 21 19:24:14 2012 -0400

    Allow non-ExecuteCode users to create Simple templates
    
    Previously, the type was set after creation time; but only users with
    ExecuteCode are allowed to create Perl templates, making it effectively
    impossible for non-ExecuteCode users to create new templates, even
    Simple ones.
    
    Pass the type of the template at Create time, making this into an
    operation that such users have permission to do.
    
    Submitted-by: Tim Cutts <tjrc at sanger.ac.uk>

diff --git a/share/html/Admin/Queues/Template.html b/share/html/Admin/Queues/Template.html
index 3dd99e1..c9d8abc 100755
--- a/share/html/Admin/Queues/Template.html
+++ b/share/html/Admin/Queues/Template.html
@@ -79,7 +79,7 @@ my @results;
 if ( !$Create ) {
     if ( $Template eq 'new' ) {
         my ( $val, $msg )
-            = $TemplateObj->Create( Queue => $Queue, Name => $Name );
+            = $TemplateObj->Create( Queue => $Queue, Name => $Name, Type => $Type );
         Abort( loc( "Could not create template: [_1]", $msg ) ) unless ($val);
         push @results, $msg;
     } else {
@@ -121,4 +121,5 @@ $Queue => ''
 $Template => ''
 $Create => undef
 $Name => undef
+$Type => undef
 </%ARGS>

commit 5e5a63f3f7044e3a9e5b9ca121b21cda3850adfc
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 21 19:38:36 2012 -0400

    Allow altering template type to Simple and changing Content simultaneously
    
    The order in of the array passed to AttributesRef determines the order
    in which updates are applied.  Because Content denies updates if the
    current Type is 'Perl' and the user doesn't have ExecuteCode, this means
    that it was impossible for such a user to update the Content in the same
    submission as the type was changed to Simple.  Reorder the AttributesRef
    such that Type comes before Content, thus ensuring that the ACL
    surrounding Content will be satisfied by the time we attempt to update
    it.

diff --git a/share/html/Admin/Global/Template.html b/share/html/Admin/Global/Template.html
index 70b6905..15b32c9 100755
--- a/share/html/Admin/Global/Template.html
+++ b/share/html/Admin/Global/Template.html
@@ -92,7 +92,7 @@ else {
     
 }
 if ($TemplateObj->Id()) {
-  my @attribs = qw( Description Content Queue Name Type );
+  my @attribs = qw( Name Description Queue Type Content );
   my @aresults = UpdateRecordObject( AttributesRef => \@attribs, 
 				     Object => $TemplateObj, 
 				     ARGSRef => \%ARGS);

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


More information about the Rt-commit mailing list