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:
parent
f01eb0cd7a
commit
e70e3bcd6d
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue