Lines 28-33
use Koha::ApiKeys;
Link Here
|
28 |
use Koha::Account::Lines; |
28 |
use Koha::Account::Lines; |
29 |
use Koha::Checkouts; |
29 |
use Koha::Checkouts; |
30 |
use Koha::Holds; |
30 |
use Koha::Holds; |
|
|
31 |
use Koha::Libraries; |
31 |
use Koha::OAuth; |
32 |
use Koha::OAuth; |
32 |
use Koha::OAuthAccessTokens; |
33 |
use Koha::OAuthAccessTokens; |
33 |
use Koha::Old::Checkouts; |
34 |
use Koha::Old::Checkouts; |
Lines 310-316
sub validate_query_parameters {
Link Here
|
310 |
) if @errors; |
311 |
) if @errors; |
311 |
} |
312 |
} |
312 |
|
313 |
|
313 |
|
|
|
314 |
=head3 allow_owner |
314 |
=head3 allow_owner |
315 |
|
315 |
|
316 |
Allows access to object for its owner. |
316 |
Allows access to object for its owner. |
Lines 500-518
Internal method that sets C4::Context->userenv
Link Here
|
500 |
sub _set_userenv { |
500 |
sub _set_userenv { |
501 |
my ( $c, $patron ) = @_; |
501 |
my ( $c, $patron ) = @_; |
502 |
|
502 |
|
503 |
my $library = $patron->library; |
503 |
my $passed_library_id = $c->req->headers->header('x-koha-library'); |
|
|
504 |
my $THE_library; |
505 |
|
506 |
if ( $passed_library_id ) { |
507 |
$THE_library = Koha::Libraries->find( $passed_library_id ); |
508 |
Koha::Exceptions::Authorization::Unauthorized->throw( |
509 |
"Unauthorized attempt to set library to $passed_library_id" |
510 |
) unless $THE_library and $patron->can_log_into($THE_library); |
511 |
} |
512 |
else { |
513 |
$THE_library = $patron->library; |
514 |
} |
504 |
|
515 |
|
505 |
C4::Context->_new_userenv( $patron->borrowernumber ); |
516 |
C4::Context->_new_userenv( $patron->borrowernumber ); |
506 |
C4::Context->set_userenv( |
517 |
C4::Context->set_userenv( |
507 |
$patron->borrowernumber, # number, |
518 |
$patron->borrowernumber, # number, |
508 |
$patron->userid, # userid, |
519 |
$patron->userid, # userid, |
509 |
$patron->cardnumber, # cardnumber |
520 |
$patron->cardnumber, # cardnumber |
510 |
$patron->firstname, # firstname |
521 |
$patron->firstname, # firstname |
511 |
$patron->surname, # surname |
522 |
$patron->surname, # surname |
512 |
$library->branchcode, # branch |
523 |
$THE_library->branchcode, # branch |
513 |
$library->branchname, # branchname |
524 |
$THE_library->branchname, # branchname |
514 |
$patron->flags, # flags, |
525 |
$patron->flags, # flags, |
515 |
$patron->email, # emailaddress |
526 |
$patron->email, # emailaddress |
516 |
); |
527 |
); |
517 |
|
528 |
|
518 |
return $c; |
529 |
return $c; |
519 |
- |
|
|