[Rt-commit] rt branch, 4.2/dont-override-system-rights, updated. rt-4.1.8-263-g73a04a1

Alex Vandiver alexmv at bestpractical.com
Tue May 21 14:13:59 EDT 2013


The branch, 4.2/dont-override-system-rights has been updated
       via  73a04a15eb38461aeb38c196f61280164fa01a4f (commit)
      from  432fa2897aa90612dd32ae0a5c56f7d2918cba9f (commit)

Summary of changes:
 lib/RT/Lifecycle.pm        |  9 ++++-----
 lib/RT/Lifecycle/Ticket.pm | 27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 73a04a15eb38461aeb38c196f61280164fa01a4f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue May 21 04:07:00 2013 -0400

    Generic lifecycle rights should be RT::System-level, not RT::Queue-level
    
    'RT::System' is quoted in RegisterRights because RT::System->new is
    parsed as RT::System()->new, and $RT::System (and hence RT::System()) is
    still undefined when lifecycle rights are being loaded.  Quoting ensures
    that it is treated as a package name and not a function call.

diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index 7ef435c..59fc5c2 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -470,16 +470,15 @@ sub RegisterRights {
     my %rights = $self->RightsDescription;
 
     require RT::ACE;
+    require RT::System;
 
-    require RT::Queue;
-    my $RIGHTS = $RT::Queue::RIGHTS;
+    my $RIGHTS = $RT::System::RIGHTS;
 
     while ( my ($right, $description) = each %rights ) {
-        next if exists $RIGHTS->{ $right }
-            or $RT::System::RIGHTS->{ $right };
+        next if exists $RIGHTS->{ $right };
 
         $RIGHTS->{ $right } = $description;
-        RT::Queue->AddRightCategories( $right => 'Status' );
+        'RT::System'->AddRightCategories( $right => 'Status' );
         $RT::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
     }
 }
diff --git a/lib/RT/Lifecycle/Ticket.pm b/lib/RT/Lifecycle/Ticket.pm
index b864114..e8e9782 100644
--- a/lib/RT/Lifecycle/Ticket.pm
+++ b/lib/RT/Lifecycle/Ticket.pm
@@ -101,4 +101,31 @@ sub ReminderStatusOnResolve {
     return $self->DefaultStatus('reminder_on_resolve') || 'resolved';
 }
 
+=head2 RegisterRights
+
+Ticket lifecycle rights are registered (and thus grantable) at the queue
+level.
+
+=cut
+
+sub RegisterRights {
+    my $self = shift;
+
+    my %rights = $self->RightsDescription;
+
+    require RT::ACE;
+
+    require RT::Queue;
+    my $RIGHTS = $RT::Queue::RIGHTS;
+
+    while ( my ($right, $description) = each %rights ) {
+        next if exists $RIGHTS->{ $right }
+            or $RT::System::RIGHTS->{ $right };
+
+        $RIGHTS->{ $right } = $description;
+        RT::Queue->AddRightCategories( $right => 'Status' );
+        $RT::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
+    }
+}
+
 1;

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


More information about the Rt-commit mailing list