|
Lines 249-256
sub authenticate_api_request {
Link Here
|
| 249 |
C4::Context->interface('api'); |
249 |
C4::Context->interface('api'); |
| 250 |
|
250 |
|
| 251 |
if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that |
251 |
if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that |
| 252 |
C4::Context->_new_userenv( $user->borrowernumber ); |
252 |
$c->_set_userenv( $user ); |
| 253 |
C4::Context->set_userenv( $user->borrowernumber ); |
|
|
| 254 |
} |
253 |
} |
| 255 |
|
254 |
|
| 256 |
if ( !$authorization and |
255 |
if ( !$authorization and |
|
Lines 490-493
sub _basic_auth {
Link Here
|
| 490 |
return Koha::Patrons->find({ userid => $user_id }); |
489 |
return Koha::Patrons->find({ userid => $user_id }); |
| 491 |
} |
490 |
} |
| 492 |
|
491 |
|
|
|
492 |
=head3 _set_userenv |
| 493 |
|
| 494 |
$c->_set_userenv( $patron ); |
| 495 |
|
| 496 |
Internal method that sets C4::Context->userenv |
| 497 |
|
| 498 |
=cut |
| 499 |
|
| 500 |
sub _set_userenv { |
| 501 |
my ( $c, $patron ) = @_; |
| 502 |
|
| 503 |
my $library = $patron->library; |
| 504 |
|
| 505 |
C4::Context->_new_userenv( $patron->borrowernumber ); |
| 506 |
C4::Context->set_userenv( |
| 507 |
$patron->borrowernumber, # number, |
| 508 |
$patron->userid, # userid, |
| 509 |
$patron->cardnumber, # cardnumber |
| 510 |
$patron->firstname, # firstname |
| 511 |
$patron->surname, # surname |
| 512 |
$library->branchcode, # branch |
| 513 |
$library->branchname, # branchname |
| 514 |
$patron->flags, # flags, |
| 515 |
$patron->email, # emailaddress |
| 516 |
); |
| 517 |
|
| 518 |
return $c; |
| 519 |
} |
| 520 |
|
| 493 |
1; |
521 |
1; |
| 494 |
- |
|
|