[Rt-commit] [rtir] 08/12: Minor cleanups to HasRight

Kevin Falcone falcone at bestpractical.com
Mon Apr 14 13:16:45 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/unwrap-hook-lexwrap
in repository rtir.

commit 6f3d4870c0d1bcfe99332705a86db06f05c28c28
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Mar 26 18:37:01 2014 -0400

    Minor cleanups to HasRight
    
    Be more explicit about using a PrincipalObj and not assuming that
    CurrentUser is equivalent.
    
    Declare %args in a more natural spot.
    
    Don't use a capturing regex to get what was in __Value('Name') to start.
---
 lib/RT/IR.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index fe58ca5..b9ac56c 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -761,15 +761,17 @@ if ( RT::IR->HasConstituency ) {
     # RT 4.2 removed RT::Queue's HasRight, meaning we can just stub one in
     sub HasRight {
         my $self = shift;
+        my %args = @_;
+
         return $self->SUPER::HasRight(@_) unless $self->id;
         return $self->SUPER::HasRight(@_) if $self->{'disable_constituency_right_check'};
         return $self->SUPER::HasRight(@_) if $self->{'_for_ticket'};
-        return $self->SUPER::HasRight(@_) unless $self->__Value('Name') =~
+
+        my $name = $self->__Value('Name');
+        return $self->SUPER::HasRight(@_) unless $name =~
             /^(Incidents|Incident Reports|Investigations|Blocks)$/i;
 
-        my $name = $1;
-        my %args = @_;
-        $args{'Principal'} ||= $self->CurrentUser;
+        $args{'Principal'} ||= $self->CurrentUser->PrincipalObj;
 
         my $equiv_objects;
         if ( $queue_cache->{$name} ) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list