[Bps-public-commit] RT-Extension-rt_cpan_org branch, rt4, updated. 7157bec65204473d468c6be90c90f1ba7bc53ddf

Thomas Sibley trs at bestpractical.com
Thu Apr 4 20:20:02 EDT 2013


The branch, rt4 has been updated
       via  7157bec65204473d468c6be90c90f1ba7bc53ddf (commit)
      from  44be38ba1734727e53510372dbbbf1bc7627bc97 (commit)

Summary of changes:
 META.yml                   |  1 -
 Makefile.PL                |  2 --
 lib/RT/Principal_Vendor.pm | 20 ++++++++++++--------
 3 files changed, 12 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit 7157bec65204473d468c6be90c90f1ba7bc53ddf
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Apr 4 17:19:11 2013 -0700

    Expunge Hook::LexWrap in a fire
    
    It completely ruins all stacktraces when it's used, even if they don't
    go through the wrapped method.  There's no need for any of it's magic
    for a simple wrap.

diff --git a/META.yml b/META.yml
index 6dc00fe..59f776f 100644
--- a/META.yml
+++ b/META.yml
@@ -24,7 +24,6 @@ requires:
   DBI: 0
   File::Remove: 0
   File::Spec: 0
-  Hook::LexWrap: 0
   IO::Compress::Gzip: 0
   perl: 5.8.3
 resources:
diff --git a/Makefile.PL b/Makefile.PL
index 403d29b..6d23abd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,8 +6,6 @@ readme_from     ('lib/RT/Extension/rt_cpan_org.pm');
 
 requires_rt('4.0.0');
 
-requires        'Hook::LexWrap';
-
 # rt-cpan-export-db
 requires 'DBI';
 requires 'DBD::SQLite';
diff --git a/lib/RT/Principal_Vendor.pm b/lib/RT/Principal_Vendor.pm
index 079ed25..5c4798d 100644
--- a/lib/RT/Principal_Vendor.pm
+++ b/lib/RT/Principal_Vendor.pm
@@ -49,6 +49,7 @@ package RT::Principal;
 
 use strict;
 use warnings;
+no warnings 'redefine';
 
 =head1 EXTENDING
 
@@ -61,17 +62,20 @@ L<RT::BugTracker::Public>'s doc.
 
 =cut
 
-use Hook::LexWrap;
-wrap 'RT::Principal::HasRight', pre => sub {
+my $HasRight = __PACKAGE__->can("HasRight")
+    or die "No HasRight in RT::Principal?!";
+
+*HasRight = sub {
     my $self = $_[0];
-    return unless defined $RT::WebPublicUser && length $RT::WebPublicUser;
-    return unless lc $self->Object->__Value('Name') eq lc $RT::WebPublicUser;
+    my %args = @_[1..$#_];
+    my $public = RT->Config->Get("WebPublicUser");
 
-    my %args = @_[1 .. (@_-2)];
-    return unless $args{'Right'} eq 'CreateTicket'
-        || $args{'Right'} eq 'ReplyToTicket';
+    if ($public and lc $self->Object->__Value('Name') eq lc $public
+        and $args{Right} =~ /^(Create|ReplyTo)Ticket$/) {
 
-    $_[-1] = 0;
+        return (undef);
+    }
+    return $HasRight->(@_);
 };
 
 1;

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



More information about the Bps-public-commit mailing list