Change order of checks, and avoid warnings if args undef (i.e. anonymous login).
authorJoe Atzberger <joe.atzberger@liblime.com>
Wed, 11 Jun 2008 21:28:44 +0000 (16:28 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 12 Jun 2008 17:09:24 +0000 (12:09 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/VirtualShelves.pm

index 58430c3..fc56284 100644 (file)
@@ -381,9 +381,10 @@ sub ShelfPossibleAction {
     my $sth = $dbh->prepare($query);
     $sth->execute($shelfnumber);
     my ( $owner, $category ) = $sth->fetchrow;
-    return 1 if ($owner eq $user);
-    return 1 if ( $category >= 3);
-    return 1 if (($category >= 2) && $action eq 'view' );
+    return 1 if ( $category >= 3);                                                     # open list
+    return 1 if (($category >= 2) and
+                               defined($action) and $action eq 'view');        # public list, anybody can view
+    return 1 if (defined($user)  and $owner  eq $user );       # user owns this list.  Check last.
     return 0;
 }