Lines 19-27
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use CGI; |
21 |
use CGI; |
22 |
use CGI::Cookie; |
|
|
23 |
use JSON; |
22 |
use JSON; |
24 |
use C4::Auth; |
23 |
use C4::Auth qw(check_cookie_auth); |
25 |
use C4::Biblio; |
24 |
use C4::Biblio; |
26 |
use C4::Context; |
25 |
use C4::Context; |
27 |
|
26 |
|
Lines 29-38
my $input = CGI->new;
Link Here
|
29 |
print $input->header('application/json'); |
28 |
print $input->header('application/json'); |
30 |
|
29 |
|
31 |
# Check the user's permissions |
30 |
# Check the user's permissions |
32 |
my %cookies = CGI::Cookie->fetch; |
|
|
33 |
my $sessid = $cookies{'CGISESSID'}->value || $input->param('CGISESSID'); |
34 |
my ( $auth_status, $auth_sessid ) = |
31 |
my ( $auth_status, $auth_sessid ) = |
35 |
C4::Auth::check_cookie_auth( $sessid, { editauthorities => 1, editcatalogue => 1 } ); |
32 |
C4::Auth::check_cookie_auth( $input->cookie('CGISESSID'), { editauthorities => 1, editcatalogue => 1 } ); |
36 |
if ( $auth_status ne "ok" ) { |
33 |
if ( $auth_status ne "ok" ) { |
37 |
print to_json( { status => 'UNAUTHORIZED' } ); |
34 |
print to_json( { status => 'UNAUTHORIZED' } ); |
38 |
exit 0; |
35 |
exit 0; |
39 |
- |
|
|