Jonathan Druart
4390b7be04
The previous patch makes check_cookie_auth return the session instead of $sessionID, so we are adjusting the different calls to prevent confusion. However they are mainly used to check the authentication status and don't care about this second variable. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
24 lines
683 B
Perl
Executable file
24 lines
683 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use Modern::Perl;
|
|
|
|
use CGI qw ( -utf8 );
|
|
use CGI::Cookie; # need to check cookies before CGI parses the POST request
|
|
use JSON qw( encode_json );
|
|
|
|
use C4::Context;
|
|
use C4::Auth qw( check_cookie_auth );
|
|
use C4::AuthoritiesMarc qw( GetTagsLabels );
|
|
|
|
my %cookies = CGI::Cookie->fetch;
|
|
my ($auth_status) = check_cookie_auth($cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' });
|
|
my $reply = CGI->new;
|
|
if ($auth_status ne "ok") {
|
|
print $reply->header(-type => 'text/html');
|
|
exit 0;
|
|
}
|
|
|
|
my $framework = $reply->param('frameworkcode');
|
|
my $tagslib = GetTagsLabels(1, $framework);
|
|
print $reply->header(-type => 'text/html');
|
|
print encode_json $tagslib;
|