From 1a83ee9c64d9f1c2776a8e3025c77088253d97d9 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sat, 9 Mar 2019 08:13:03 +0000 Subject: [PATCH] Bug 22483: Restore exact behaviour of undef Passing undef (or nothing) as $flagsrequired to haspermission simply returned the return from fetchrow prior to this patch. Restoring that behaviour. Signed-off-by: Martin Renvoize --- C4/Auth.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 2b76accf11..c3ba5baad2 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -2084,7 +2084,6 @@ sub _dispatch { sub haspermission { my ( $userid, $flagsrequired ) = @_; - return 1 unless defined($flagsrequired); # This is horrifying but restores behaviour prior to bug 22031 #Koha::Exceptions::WrongParameter->throw('$flagsrequired should not be undef') # unless defined($flagsrequired); @@ -2094,6 +2093,7 @@ sub haspermission { my $row = $sth->fetchrow(); my $flags = getuserflags( $row, $userid ); + return $flags unless defined($flagsrequired); return $flags if $flags->{superlibrarian}; return _dispatch($flagsrequired, $flags); -- 2.20.1