[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-223-ge0135c0

Shawn Moore sartak at bestpractical.com
Tue Jul 27 21:47:58 EDT 2010


The branch, new-style-templates has been updated
       via  e0135c053daf2487fb2818b41c81beca4b341f14 (commit)
      from  a9b7c1b950ce136a576eb6f60451e79c94edbc89 (commit)

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

- Log -----------------------------------------------------------------
commit e0135c053daf2487fb2818b41c81beca4b341f14
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Jul 27 21:49:03 2010 -0400

    First cut of granting FullTemplates on upgrade to anything with ModifyTemplate
    
        In this way the status quo is maintained. If you had ModifyTemplate
        you could write full Perl code in templates, and this upgrade code
        maintains that

diff --git a/etc/upgrade/3.9.1/content b/etc/upgrade/3.9.1/content
index 3b4b418..93a5806 100644
--- a/etc/upgrade/3.9.1/content
+++ b/etc/upgrade/3.9.1/content
@@ -22,5 +22,30 @@
             }
         }
     },
+    sub {
+        use strict;
+        $RT::Logger->debug('Adding FullTemplates right to principals that currently have ModifyTemplate');
+
+        my $acl = RT::ACL->new($RT::SystemUser);
+        $acl->Limit(
+            FIELD           => 'RightName',
+            OPERATOR        => '=',
+            VALUE           => 'ModifyTemplate',
+        );
+
+        while (my $ace = $acl->Next) {
+            my $object = $ace->Object;
+            my $principal = $ace->PrincipalObj;
+
+            my ($ok, $msg) = $principal->GrantRight(
+                Right => 'FullTemplates',
+                Object => $object,
+            );
+
+            if (!$ok) {
+                $RT::Logger->warn("Unable to grant FullTemplates on principal " . $principal->id . ": $msg");
+            }
+        }
+    },
 );
 

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


More information about the Rt-commit mailing list