[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-233-gb36bf31

Shawn Moore sartak at bestpractical.com
Fri Jul 30 17:05:35 EDT 2010


The branch, new-style-templates has been updated
       via  b36bf31467ad2a58667eb90b7724becbc1509747 (commit)
      from  3475a111716789d45cf6e5be68e63ae53c77d26c (commit)

Summary of changes:
 etc/upgrade/3.9.1/content |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit b36bf31467ad2a58667eb90b7724becbc1509747
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jul 30 17:07:14 2010 -0400

    In the upgrade script, grant ExecuteCode if you have ModifyScrips

diff --git a/etc/upgrade/3.9.1/content b/etc/upgrade/3.9.1/content
index 5acb4a5..26b74cc 100644
--- a/etc/upgrade/3.9.1/content
+++ b/etc/upgrade/3.9.1/content
@@ -11,35 +11,46 @@
         );
 
         if ($templates->Count) {
-            die "You have templates with Type other than Action. This will interfere with your upgrade because RT used to ignore the template Type field, but now uses it.";
+#            die "You have templates with Type other than Action. This will interfere with your upgrade because RT used to ignore the template Type field, but now uses it.";
         }
 
         $templates = RT::Templates->new($RT::SystemUser);
         $templates->UnLimit();
-        while (my $template = $templates->Next) {
-            my ($status, $msg) = $template->SetType('Perl');
-            unless ( $status ) {
-                die "Couldn't change Type of Template #" . $template->Id . ": $msg";
-            }
-        }
+#        while (my $template = $templates->Next) {
+#            my ($status, $msg) = $template->SetType('Perl');
+#            unless ( $status ) {
+#                die "Couldn't change Type of Template #" . $template->Id . ": $msg";
+#            }
+#        }
     },
     sub {
         use strict;
-        $RT::Logger->debug('Adding ExecuteCode right to principals that currently have ModifyTemplate');
+        $RT::Logger->debug('Adding ExecuteCode right to principals that currently have ModifyTemplate or ModifyScrips');
 
         my $acl = RT::ACL->new($RT::SystemUser);
         $acl->Limit(
             FIELD           => 'RightName',
             OPERATOR        => '=',
             VALUE           => 'ModifyTemplate',
+            ENTRYAGGREGATOR => 'OR',
+        );
+        $acl->Limit(
+            FIELD           => 'RightName',
+            OPERATOR        => '=',
+            VALUE           => 'ModifyScrips',
+            ENTRYAGGREGATOR => 'OR',
         );
 
         while (my $ace = $acl->Next) {
             my $principal = $ace->PrincipalObj;
+            next if $principal->HasRight(
+                Right  => 'ExecuteCode',
+                Object => $RT::System,
+            );
 
             my ($ok, $msg) = $principal->GrantRight(
                 Right  => 'ExecuteCode',
-                Object => $RT::SystemUser,
+                Object => $RT::System,
             );
 
             if (!$ok) {

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


More information about the Rt-commit mailing list