LP#1777677: restrict allowable hooks for test notifications
authorJeff Davis <jeff.davis@bc.libraries.coop>
Tue, 14 Apr 2020 17:41:26 +0000 (10:41 -0700)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 11 Sep 2020 19:51:31 +0000 (15:51 -0400)
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>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index 3b39d39..5d85c79 100644 (file)
@@ -4368,8 +4368,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);