Z39.50 service filter repairs
authorBill Erickson <berick@esilibrary.com>
Wed, 26 Oct 2011 18:56:01 +0000 (14:56 -0400)
committerJason Etheridge <jason@esilibrary.com>
Thu, 27 Oct 2011 16:04:42 +0000 (12:04 -0400)
Do not attempt to filter out Z39.50 services by permission when
retrieveing the services in a non-authenticate manner (i.e. from within
the Z39.50 code).  Otherwise, the code will die on $e->requestor->id,
because there is no requestor.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm

index 6a09529..978b106 100644 (file)
@@ -157,16 +157,18 @@ sub fetch_service_defs {
     };
 
     # then filter out any services which the requestor lacks the perm for
-    foreach my $s (keys %{ $hash }) {
-        if ($$hash{$s}{use_perm}) {
-            if ($U->check_perms(
-                $e->requestor->id,
-                $e->requestor->ws_ou,
-                $$hash{$s}{use_perm}
-            )) {
-                delete $$hash{$s};
-            }
-        };
+    if ($editor_with_authtoken) {
+        foreach my $s (keys %{ $hash }) {
+            if ($$hash{$s}{use_perm}) {
+                if ($U->check_perms(
+                    $e->requestor->id,
+                    $e->requestor->ws_ou,
+                    $$hash{$s}{use_perm}
+                )) {
+                    delete $$hash{$s};
+                }
+            };
+        }
     }
 
     %services = %$hash; # cache these internally so we can actually use the db-configured sources