LP#1347774 CStoreEditor anon pcrud default to undef authtoken
authorBill Erickson <berick@esilibrary.com>
Fri, 1 Aug 2014 19:13:38 +0000 (15:13 -0400)
committerBill Erickson <berick@esilibrary.com>
Fri, 1 Aug 2014 19:26:55 +0000 (15:26 -0400)
The presence of an authtoken ("ANONYMOUS") in the editor can be
misleading at higher levels of the code, since it implies a
presumably functional authtoken has been provided somewhow.

Apply ANONYMOUS only as needed to API calls instead.

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

index 11ed74a..87f11d0 100644 (file)
@@ -214,7 +214,6 @@ sub died {
 sub authtoken {
     my( $self, $auth ) = @_;
     $self->{authtoken} = $auth if $auth;
-    return 'ANONYMOUS' if ($self->personality eq 'open-ils.pcrud' and !defined($self->{authtoken}));
     return $self->{authtoken};
 }
 
@@ -828,8 +827,9 @@ sub runmethod {
     my $obj; 
     my $err = '';
 
-    # In pcrud mode, sub authtoken returns 'ANONYMOUS' if one is not yet set
-    unshift(@arg, $self->authtoken) if ($self->personality eq 'open-ils.pcrud');
+    # in PCRUD mode, if no authtoken is set, fall back to anonymous.
+    unshift(@arg, ($self->authtoken || 'ANONYMOUS')) 
+        if ($self->personality eq 'open-ils.pcrud');
 
     try {
         $obj = $self->request($method, @arg);