[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-224-gb6b1c7b

Shawn Moore sartak at bestpractical.com
Tue Jul 27 22:19:35 EDT 2010


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

Summary of changes:
 etc/upgrade/3.9.1/content  |    6 +++---
 lib/RT/Queue_Overlay.pm    |    2 +-
 lib/RT/Template_Overlay.pm |   14 +++++++-------
 t/web/template.t           |    8 ++++----
 4 files changed, 15 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit b6b1c7b32579fd572271856aeec351094bd91039
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Jul 27 22:21:18 2010 -0400

    Rename right from FullTemplates to ModifyPerlTemplates

diff --git a/etc/upgrade/3.9.1/content b/etc/upgrade/3.9.1/content
index 93a5806..558a35a 100644
--- a/etc/upgrade/3.9.1/content
+++ b/etc/upgrade/3.9.1/content
@@ -24,7 +24,7 @@
     },
     sub {
         use strict;
-        $RT::Logger->debug('Adding FullTemplates right to principals that currently have ModifyTemplate');
+        $RT::Logger->debug('Adding ModifyPerlTemplates right to principals that currently have ModifyTemplate');
 
         my $acl = RT::ACL->new($RT::SystemUser);
         $acl->Limit(
@@ -38,12 +38,12 @@
             my $principal = $ace->PrincipalObj;
 
             my ($ok, $msg) = $principal->GrantRight(
-                Right => 'FullTemplates',
+                Right => 'ModifyPerlTemplates',
                 Object => $object,
             );
 
             if (!$ok) {
-                $RT::Logger->warn("Unable to grant FullTemplates on principal " . $principal->id . ": $msg");
+                $RT::Logger->warn("Unable to grant ModifyPerlTemplates on principal " . $principal->id . ": $msg");
             }
         }
     },
diff --git a/lib/RT/Queue_Overlay.pm b/lib/RT/Queue_Overlay.pm
index b2df91b..7a20693 100755
--- a/lib/RT/Queue_Overlay.pm
+++ b/lib/RT/Queue_Overlay.pm
@@ -94,7 +94,7 @@ our $RIGHTS = {
     AssignCustomFields  => 'Assign and remove custom fields',         # loc_pair
     ModifyTemplate      => 'Modify Scrip templates for this queue',   # loc_pair
     ShowTemplate        => 'Display Scrip templates for this queue',  # loc_pair
-    FullTemplates       => 'Modify templates with unlimited code execution', # loc_pair
+    ModifyPerlTemplates => 'Modify templates with unlimited code execution', # loc_pair
 
     ModifyScrips => 'Modify Scrips for this queue',                   # loc_pair
     ShowScrips   => 'Display Scrips for this queue',                  # loc_pair
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 57fa62c..bb4eabd 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -215,7 +215,7 @@ sub Create {
         unless ( $self->CurrentUser->HasRight(Right =>'ModifyTemplate', Object => $RT::System) ) {
             return ( undef, $self->loc('Permission Denied') );
         }
-        if ( $args{Type} eq 'Full' && !$self->CurrentUser->HasRight(Right => 'FullTemplates', Object => $RT::System) ) {
+        if ( $args{Type} eq 'Full' && !$self->CurrentUser->HasRight(Right => 'ModifyPerlTemplates', Object => $RT::System) ) {
             return ( undef, $self->loc('Permission Denied') );
         }
         $args{'Queue'} = 0;
@@ -227,7 +227,7 @@ sub Create {
         unless ( $QueueObj->CurrentUserHasRight('ModifyTemplate') ) {
             return ( undef, $self->loc('Permission Denied') );
         }
-        if ( $args{Type} eq 'Full' && !$QueueObj->CurrentUserHasRight('FullTemplates') ) {
+        if ( $args{Type} eq 'Full' && !$QueueObj->CurrentUserHasRight('ModifyPerlTemplates') ) {
             return ( undef, $self->loc('Permission Denied') );
         }
         $args{'Queue'} = $QueueObj->Id;
@@ -597,7 +597,7 @@ sub CurrentUserHasQueueRight {
 
 =head2 SetType
 
-If setting Type to Full, require the FullTemplates right on the queue.
+If setting Type to Full, require the ModifyPerlTemplates right on the queue.
 
 =cut
 
@@ -605,7 +605,7 @@ sub SetType {
     my $self    = shift;
     my $NewType = shift;
 
-    if ($NewType eq 'Full' && !$self->CurrentUserHasQueueRight('FullTemplates')) {
+    if ($NewType eq 'Full' && !$self->CurrentUserHasQueueRight('ModifyPerlTemplates')) {
         return ( undef, $self->loc('Permission Denied') );
     }
 
@@ -614,7 +614,7 @@ sub SetType {
 
 =head2 SetQueue
 
-When changing the queue, make sure the current user has FullTemplates on the
+When changing the queue, make sure the current user has ModifyPerlTemplates on the
 new queue if the type is Full.
 
 Templates can't change Queue in the UI (yet?).
@@ -628,8 +628,8 @@ sub SetQueue {
     my $NewQueueObj = RT::Queue->new( $self->CurrentUser );
     $NewQueueObj->Load($NewQueue);
 
-    if ( $self->Type eq 'Full' && !$NewQueueObj->CurrentUserHasRight('FullTemplates') ) {
-        return ( undef, $self->loc('Permission Denied. You do not have FullTemplate on the new queue.') );
+    if ( $self->Type eq 'Full' && !$NewQueueObj->CurrentUserHasRight('ModifyPerlTemplates') ) {
+        return ( undef, $self->loc('Permission Denied. You do not have ModifyPerlTemplates on the new queue.') );
     }
 
     return $self->_Set( Field => 'Queue', Value => $NewQueueObj->id );
diff --git a/t/web/template.t b/t/web/template.t
index 3efcef5..90b6eab 100644
--- a/t/web/template.t
+++ b/t/web/template.t
@@ -47,17 +47,17 @@ $m->submit;
 
 $m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
 $m->form_name('ModifyTemplate');
-is($m->value('Type'), 'Simple', 'need the FullTemplates right to update Type to Full');
+is($m->value('Type'), 'Simple', 'need the ModifyPerlTemplates right to update Type to Full');
 $m->content_contains('Permission Denied');
 
 ok( RT::Test->add_rights(
-    { Principal => $user_a, Right => [qw(FullTemplates)] },
-), 'add FullTemplates rights');
+    { Principal => $user_a, Right => [qw(ModifyPerlTemplates)] },
+), 'add ModifyPerlTemplates rights');
 
 $m->field(Type => 'Full');
 $m->submit;
 
 $m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
 $m->form_name('ModifyTemplate');
-is($m->value('Type'), 'Full', 'now that we have FullTemplates we can update Type to Full');
+is($m->value('Type'), 'Full', 'now that we have ModifyPerlTemplates we can update Type to Full');
 

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


More information about the Rt-commit mailing list