Change order of checks, and avoid warnings if args undef (i.e. anonymous login).

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Joe Atzberger 2008-06-11 16:28:44 -05:00 committed by Joshua Ferraro
parent f01eb0cd7a
commit e70e3bcd6d

View 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;
}