LP#1777677: restrict allowable hooks for test notifications user/jeffdavis/lp1777677-test-notification-method-restrict-hooks
authorJeff Davis <jeff.davis@bc.libraries.coop>
Tue, 14 Apr 2020 17:41:26 +0000 (10:41 -0700)
committerJeff Davis <jeff.davis@bc.libraries.coop>
Tue, 14 Apr 2020 17:41:26 +0000 (10:41 -0700)
The open-ils.actor.event.test_notification API call should only support
the au.email.test and au.sms_text.test hooks.

Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index 9b91b1d..be34e6d 100644 (file)
@@ -4347,8 +4347,9 @@ sub fire_test_notification {
     }
 
     my $event_hook = $$args{hook} or return $e->event;
-    my $usr = $e->retrieve_actor_user($$args{target});
+    return $e->event unless ($event_hook eq 'au.email.test' or $event_hook eq 'au.sms_text.test');
 
+    my $usr = $e->retrieve_actor_user($$args{target});
     return $e->event unless $usr;
 
     return $U->fire_object_event(undef, $event_hook, $usr, $e->requestor->ws_ou);