@@ -, +, @@ =?UTF-8?q?te=5Fand=5Fuser=20can=20not=20have=20an=20empty=20template=5Fna?= =?UTF-8?q?me=20(quote*=5Fajax.pl)?= --- tools/quotes/quotes-upload_ajax.pl | 16 ++++++---------- tools/quotes/quotes_ajax.pl | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) --- a/tools/quotes/quotes-upload_ajax.pl +++ a/tools/quotes/quotes-upload_ajax.pl @@ -32,16 +32,12 @@ use C4::Output; my $cgi = new CGI; my $dbh = C4::Context->dbh; -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "", - query => $cgi, - type => "intranet", - authnotrequired => 0, - flagsrequired => { tools => 'edit_quotes' }, - debug => 1, - } -); +my ( $status, $cookie, $sessionID ) = C4::Auth::check_api_auth( $cgi, { tools => 'edit_quotes' } ); +unless ($status eq "ok") { + print $cgi->header(-type => 'application/json', -status => '403 Forbidden'); + print to_json({ auth_status => $status }); + exit 0; +} my $success = 'true'; --- a/tools/quotes/quotes_ajax.pl +++ a/tools/quotes/quotes_ajax.pl @@ -31,16 +31,12 @@ my $cgi = CGI->new; my $dbh = C4::Context->dbh; my $sort_columns = ["id", "source", "text", "timestamp"]; -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "", - query => $cgi, - type => "intranet", - authnotrequired => 0, - flagsrequired => { tools => 'edit_quotes' }, - debug => 1, - } -); +my ( $status, $cookie, $sessionID ) = C4::Auth::check_api_auth( $cgi, { tools => 'edit_quotes' } ); +unless ($status eq "ok") { + print $cgi->header(-type => 'application/json', -status => '403 Forbidden'); + print to_json({ auth_status => $status }); + exit 0; +} # NOTE: This is a collection of ajax functions for use with tools/quotes.pl --