Skip to content

Commit

Permalink
fix permission issue with restricted backends on landing page (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Apr 8, 2023
1 parent 0dabc7d commit d62fc71
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -2204,6 +2204,7 @@ t/scenarios/backend_http_readonly/t/300-controller_showlog.t
t/scenarios/backend_http_readonly/t/300-controller_status.t
t/scenarios/backend_http_readonly/t/300-controller_tac.t
t/scenarios/backend_http_readonly/t/301-config-tool.t
t/scenarios/backend_http_readonly/t/301-main.t
t/scenarios/backend_http_readonly/t/301-proxy.t
t/scenarios/backend_http_readonly/t/301-status.t
t/scenarios/backend_http_readonly/t/local/lmd.t
Expand Down
4 changes: 4 additions & 0 deletions lib/Thruk/Utils/CLI.pm
Expand Up @@ -1220,6 +1220,10 @@ sub _authorize_function {
elsif($function eq 'get_comments') { return _extend_filter($c, $opt, 'filter', 'comments'); }
elsif($function eq 'get_downtimes') { return _extend_filter($c, $opt, 'filter', 'downtimes'); }
elsif($function eq 'get_commands') { return _extend_filter($c, $opt, 'filter', 'commands'); }
elsif($function eq 'get_contacts') { return _extend_filter($c, $opt, 'filter', 'contacts'); }
elsif($function eq 'get_contact_names') { return _extend_filter($c, $opt, 'filter', 'contacts'); }
elsif($function eq 'get_contactgroups') { return _extend_filter($c, $opt, 'filter', 'contactgroups'); }
elsif($function eq 'get_contactgroup_names'){ return _extend_filter($c, $opt, 'filter', 'contactgroups'); }
elsif($function eq 'get_logs' || $function eq 'get_logs_start_end') {
return _extend_filter($c, $opt, 'filter', 'log');
} elsif($function eq 'get_timeperiods' || $function eq 'get_timeperiod_names') {
Expand Down
19 changes: 19 additions & 0 deletions t/scenarios/backend_http_readonly/t/301-main.t
@@ -0,0 +1,19 @@
use warnings;
use strict;
use Cpanel::JSON::XS qw/decode_json/;
use Test::More;

die("*** ERROR: this test is meant to be run with PLACK_TEST_EXTERNALSERVER_URI set") unless defined $ENV{'PLACK_TEST_EXTERNALSERVER_URI'};

BEGIN {
plan tests => 13;

use lib('t');
require TestUtils;
import TestUtils;
}

TestUtils::test_page(
url => '/thruk/cgi-bin/main.cgi',
like => ['Hosts UP', 'Unhandled Service', 'All Hosts'],
);

0 comments on commit d62fc71

Please sign in to comment.