[Rt-commit] rt branch, 4.2/support-rest-v2, created. rt-4.2.3-30-g545f8a7

Alex Vandiver alexmv at bestpractical.com
Wed Mar 12 15:22:48 EDT 2014


The branch, 4.2/support-rest-v2 has been created
        at  545f8a74697a8f53bd1f0ffc5af892e78df6ec0a (commit)

- Log -----------------------------------------------------------------
commit 68930391fe3203afe1bedccc0eae677afcec59f1
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jul 24 11:43:45 2013 -0700

    Add means for plugins to wrap the PSGI app with their own arbitrary logic

diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index 79cca99..078091f 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -313,7 +313,14 @@ sub PSGIApp {
                                             $self->CleanupRequest()
                                         });
     };
-    return $self->StaticWrap($mason);
+
+    my $app = $self->StaticWrap($mason);
+    for my $plugin (RT->Config->Get("Plugins")) {
+        my $wrap = $plugin->can("PSGIWrap")
+            or next;
+        $app = $wrap->($plugin, $app);
+    }
+    return $app;
 }
 
 sub StaticWrap {

commit 545f8a74697a8f53bd1f0ffc5af892e78df6ec0a
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Aug 7 15:56:40 2013 -0700

    Bulletproofing of role resolution for Create args
    
    Single-member roles will use the first element on an array if an array
    is given and an object is checked for before calling ->id blindly on a
    value that may be undef.  These changes make it easier for programmatic
    generation of Create args.

diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index c1e03fd..c67c58a 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -519,6 +519,7 @@ sub _ResolveRoles {
         if ($self->_ROLES->{$role}{Single}) {
             # Default to nobody if unspecified
             my $value = $args{$role} || RT->Nobody;
+               $value = $value->[0] if ref $value eq 'ARRAY';
             if (Scalar::Util::blessed($value) and $value->isa("RT::User")) {
                 # Accept a user; it may not be loaded, which we catch below
                 $roles->{$role} = $value->PrincipalObj;
@@ -530,7 +531,7 @@ sub _ResolveRoles {
                 $user->LoadByEmail( $value ) unless $user->id;
                 $roles->{$role} = $user->PrincipalObj;
             }
-            unless ($roles->{$role} and $roles->{$role}->id) {
+            unless (Scalar::Util::blessed($roles->{$role}) and $roles->{$role}->id) {
                 push @errors, $self->loc("Invalid value for [_1]",$self->loc($role));
                 $roles->{$role} = RT->Nobody->PrincipalObj;
             }

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


More information about the rt-commit mailing list