Check auth on flattener search calls
authorBill Erickson <berick@esilibrary.com>
Mon, 26 Mar 2012 14:25:25 +0000 (10:25 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 26 Mar 2012 14:25:25 +0000 (10:25 -0400)
Otherwise, the auth will fail at a lower level (pcrud) and result in
sending a less-than-useful error message to the caller.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Fielder.pm

index 4342479..3d9ae13 100644 (file)
@@ -158,6 +158,9 @@ sub generate_methods {
 sub register_map {
     my ($self, $conn, $auth, $hint, $map) = @_;
 
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+
     $key = 'flat_search_' . md5_hex(
         $hint .
         OpenSRF::Utils::JSON->perl2JSON( $map )
@@ -194,6 +197,9 @@ sub execute_registered_flattened_search {
     my $auth = shift;
     my $key  = shift;
 
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+
     my $blob = $cache->get_cache( $key );
 
     flattened_search( $self, $conn, $auth, $blob->{hint}, $blob->{map}, @_ )
@@ -234,6 +240,9 @@ sub flattened_search {
     # All but the last argument really are necessary.
     $slo ||= {};
 
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+
     # Process the map to normalize it, and to get all our joins and fleshing
     # structure into the jffolo.
     my $jffolo;