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

(-)a/C4/Auth.pm (-2 / +6 lines)
Lines 1606-1612 sub check_api_auth { Link Here
1606
  ($status, $sessionId) = check_api_auth($cookie, $userflags);
1606
  ($status, $sessionId) = check_api_auth($cookie, $userflags);
1607
1607
1608
Given a CGISESSID cookie set during a previous login to Koha, determine
1608
Given a CGISESSID cookie set during a previous login to Koha, determine
1609
if the user has the privileges specified by C<$userflags>.
1609
if the user has the privileges specified by C<$userflags>. C<$userflags> 
1610
is passed unaltered into C<haspermission> and as such accepts all options
1611
avaiable to that routine with the one caveat that C<check_api_auth> will 
1612
also allow 'undef' to be passed and in such a case the permissions check
1613
will be skipped altogether.
1610
1614
1611
C<check_cookie_auth> is meant for authenticating special services
1615
C<check_cookie_auth> is meant for authenticating special services
1612
such as tools/upload-file.pl that are invoked by other pages that
1616
such as tools/upload-file.pl that are invoked by other pages that
Lines 1701-1707 sub check_cookie_auth { Link Here
1701
            return ( "expired", undef );
1705
            return ( "expired", undef );
1702
        } else {
1706
        } else {
1703
            $session->param( 'lasttime', time() );
1707
            $session->param( 'lasttime', time() );
1704
            my $flags = haspermission( $userid, $flagsrequired );
1708
            my $flags = defined($flagsrequired) ? haspermission( $userid, $flagsrequired ) : 1;
1705
            if ($flags) {
1709
            if ($flags) {
1706
                return ( "ok", $sessionID );
1710
                return ( "ok", $sessionID );
1707
            } else {
1711
            } else {
(-)a/Koha/REST/V1/Auth.pm (-2 / +1 lines)
Lines 189-195 sub authenticate_api_request { Link Here
189
        # Manually pass the remote_address to check_auth_cookie
189
        # Manually pass the remote_address to check_auth_cookie
190
        my $remote_addr = $c->tx->remote_address;
190
        my $remote_addr = $c->tx->remote_address;
191
        my ($status, $sessionID) = check_cookie_auth(
191
        my ($status, $sessionID) = check_cookie_auth(
192
                                                $cookie, '*',
192
                                                $cookie, undef,
193
                                                { remote_addr => $remote_addr });
193
                                                { remote_addr => $remote_addr });
194
        if ($status eq "ok") {
194
        if ($status eq "ok") {
195
            my $session = get_session($sessionID);
195
            my $session = get_session($sessionID);
196
- 

Return to bug 22483