View | Details | Raw Unified | Return to bug 22483
Collapse All | Expand All

(-)a/C4/Auth.pm (-2 / +4 lines)
Lines 2084-2091 sub _dispatch { Link Here
2084
sub haspermission {
2084
sub haspermission {
2085
    my ( $userid, $flagsrequired ) = @_;
2085
    my ( $userid, $flagsrequired ) = @_;
2086
2086
2087
    Koha::Exceptions::WrongParameter->throw('$flagsrequired should not be undef')
2087
    return qw{} unless defined($flagsrequired); # This is horrifying but restores behaviour prior to bug 22031
2088
      unless defined($flagsrequired);
2088
2089
    #Koha::Exceptions::WrongParameter->throw('$flagsrequired should not be undef')
2090
    #  unless defined($flagsrequired);
2089
2091
2090
    my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?");
2092
    my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?");
2091
    $sth->execute($userid);
2093
    $sth->execute($userid);
(-)a/t/db_dependent/Auth/haspermission.t (-7 / +9 lines)
Lines 73-85 $builder->build( Link Here
73
73
74
subtest 'undef top level tests' => sub {
74
subtest 'undef top level tests' => sub {
75
75
76
    plan tests => 2;
76
    plan tests => 1;
77
77
78
    throws_ok { my $r = haspermission( $borr1->{userid} ); }
78
    my $pass = haspermission( $borr2->{userid} );
79
    'Koha::Exceptions::WrongParameter',
79
    ok($pass, "let through undef privs");
80
      'Exception thrown when missing $requiredflags';
80
81
    throws_ok { my $r = haspermission( $borr1->{userid}, undef ); }
81
    #throws_ok { my $r = haspermission( $borr1->{userid} ); }
82
    'Koha::Exceptions::WrongParameter', 'Exception thrown when explicit undef';
82
    #'Koha::Exceptions::WrongParameter',
83
    #  'Exception thrown when missing $requiredflags';
84
    #throws_ok { my $r = haspermission( $borr1->{userid}, undef ); }
85
    #'Koha::Exceptions::WrongParameter', 'Exception thrown when explicit undef';
83
};
86
};
84
87
85
subtest 'scalar top level tests' => sub {
88
subtest 'scalar top level tests' => sub {
86
- 

Return to bug 22483