View | Details | Raw Unified | Return to bug 13663
Collapse All | Expand All

(-)a/tools/upload-file-progress.pl (-3 / +18 lines)
Lines 25-38 use IO::File; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use CGI::Session;
26
use CGI::Session;
27
use C4::Context;
27
use C4::Context;
28
use C4::Auth qw/check_cookie_auth/;
28
use C4::Auth qw/check_cookie_auth haspermission/;
29
use C4::UploadedFile;
29
use C4::UploadedFile;
30
use CGI::Cookie; # need to check cookies before
30
use CGI::Cookie; # need to check cookies before
31
                 # having CGI parse the POST request
31
                 # having CGI parse the POST request
32
32
33
my $flags_required = [
34
		{circulate => 'circulate_remaining_permissions'},
35
		{tools => 'stage_marc_import'},
36
		{tools => 'upload_local_cover_images'}
37
];
38
33
my %cookies = fetch CGI::Cookie;
39
my %cookies = fetch CGI::Cookie;
34
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
40
35
if ($auth_status ne "ok") {
41
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value);
42
43
my $auth_failure = 1;
44
foreach my $flag_required (@{ $flags_required}) {
45
		if (my $flags = haspermission(C4::Context->config('user'), $flag_required)) {
46
				$auth_failure = 0 if $auth_status eq 'ok';
47
		}
48
}
49
50
if ($auth_failure) {
36
    my $reply = CGI->new("");
51
    my $reply = CGI->new("");
37
    print $reply->header(-type => 'text/html');
52
    print $reply->header(-type => 'text/html');
38
    print '{"progress":"0"}';
53
    print '{"progress":"0"}';
(-)a/tools/upload-file.pl (-4 / +17 lines)
Lines 25-31 use IO::File; Link Here
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use CGI::Session;
26
use CGI::Session;
27
use C4::Context;
27
use C4::Context;
28
use C4::Auth qw/check_cookie_auth/;
28
use C4::Auth qw/check_cookie_auth haspermission/;
29
use CGI::Cookie; # need to check cookies before
29
use CGI::Cookie; # need to check cookies before
30
                 # having CGI parse the POST request
30
                 # having CGI parse the POST request
31
use C4::UploadedFile;
31
use C4::UploadedFile;
Lines 38-46 use C4::UploadedFile; Link Here
38
# requires that the session cookie already
38
# requires that the session cookie already
39
# have been created.
39
# have been created.
40
40
41
my $flags_required = [
42
		{circulate => 'circulate_remaining_permissions'},
43
		{tools => 'stage_marc_import'},
44
		{tools => 'upload_local_cover_images'}
45
];
46
41
my %cookies = fetch CGI::Cookie;
47
my %cookies = fetch CGI::Cookie;
42
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { tools => '*' });
48
43
if ($auth_status ne "ok") {
49
my $auth_failure = 1;
50
my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value);
51
foreach my $flag_required (@{ $flags_required}) {
52
		if (my $flags = haspermission(C4::Context->config('user'), $flag_required)) {
53
				$auth_failure = 0 if $auth_status eq 'ok';
54
		}
55
}
56
57
if ($auth_failure) {
44
    $auth_status = 'denied' if $auth_status eq 'failed';
58
    $auth_status = 'denied' if $auth_status eq 'failed';
45
    send_reply($auth_status, "");
59
    send_reply($auth_status, "");
46
    exit 0;
60
    exit 0;
47
- 

Return to bug 13663