Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2012-10-17 16:33:35 UTC (rev 10500)
+++ trunk/CHANGES 2012-10-17 19:02:44 UTC (rev 10501)
@@ -9,6 +9,7 @@
Search box in the main interface now also searches host descriptions
NOTICES:
FIXES:
+ Fixed HH displaying breadcrumbs for host groups that user did not have permission for
Fixed apache configuration for redundancy, specifically removing apache_proxy_ssl.conf and replacing with apache_ssl.conf
Fixed messages for set state
Fixed display of check_snmp_interfaces_cascade so that bits/s to Gbps is using division by 1000^3 rather than 1024^3
Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Graph.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Graph.pm 2012-10-17 16:33:35 UTC (rev 10500)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Graph.pm 2012-10-17 19:02:44 UTC (rev 10501)
@@ -159,16 +159,21 @@
# Set breadcrumbs
if ( $c->stash->{results}->{summary}->{hosts} == 1 ) {
my ($hostname) = keys %{ $c->stash->{results}->{hosts} };
- my $host =
- $c->model("RuntimeSchema::Hosts")->search( { name => $hostname } )
- ->first;
- my $breadcrumbs = $c->forward(
- "/status/hostgroup/breadcrumbs",
- [ $host->hostgroup ]
- );
- push @$breadcrumbs,
- $c->forward( "/status/host/breadcrumb", [$host] );
- $c->stash( breadcrumbs => $breadcrumbs );
+
+ my $oldrs = $c->stash->{rs};
+ $c->forward( "/rest/status/host/apply_restrictions" );
+ my $host = $c->stash->{rs}->find( { name => $hostname } );
+ $c->stash->{rs} = $oldrs;
+
+ if ($host) {
+ my $breadcrumbs = $c->forward(
+ "/status/hostgroup/breadcrumbs",
+ [ $host->hostgroup ]
+ );
+ push @$breadcrumbs,
+ $c->forward( "/status/host/breadcrumb", [$host] );
+ $c->stash( breadcrumbs => $breadcrumbs );
+ }
}
$c->forward("/refresh_page") if $refresh;
}
Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Status/Host.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Status/Host.pm 2012-10-17 16:33:35 UTC (rev 10500)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Status/Host.pm 2012-10-17 19:02:44 UTC (rev 10501)
@@ -36,10 +36,12 @@
if ( my $hgid = $c->req->param("hostgroupid") ) {
- # This needs to be filtered by permissions
+ # We filter the host groups for breadcrumbs
+ my $oldrs = $c->stash->{rs};
+ $c->forward( "/rest/status/hostgroup/apply_restrictions" );
my $hg =
- $c->model("RuntimeSchema::OpsviewHostgroups")
- ->search( { id => $hgid } )->first;
+ $c->stash->{rs}->search( { id => $hgid }, { distinct => 1 } )->first;
+ $c->stash->{rs} = $oldrs;
if ($hg) {
$c->stash( hostgroup => $hg );
$c->stash( breadcrumbs =>
@@ -81,7 +83,7 @@
%extra_params
},
\@params_to_delete
- )->path_query,
+ )->path_query,
};
}
Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Status/Hostgroup.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Status/Hostgroup.pm 2012-10-17 16:33:35 UTC (rev 10500)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Status/Hostgroup.pm 2012-10-17 19:02:44 UTC (rev 10501)
@@ -89,16 +89,21 @@
push @$heading_list, $c->loc( "ui.status.hostgroup.label.summary" );
if ( my $parentid = $c->req->param("parentid") ) {
- my $hg =
- $c->stash->{rs}->search( { id => $parentid }, { distinct => 1 } )
- ->first;
+ my $hg_rs =
+ $c->stash->{rs}->search( { id => $parentid }, { distinct => 1 } );
+
+ if ( $hg_rs->count == 0 ) {
+ $c->detach( "/access_denied" );
+ }
+
+ my $hg = $hg_rs->first;
if ($hg) {
if ( $hg->is_leaf ) {
$c->res->redirect(
$c->uri_for_params_status(
"/status/host", { hostgroupid => $hg->id },
["parentid"]
- )->path_query
+ )->path_query
);
$c->detach;
}
@@ -115,14 +120,6 @@
$c->forward( "/rest/status/hostgroup/hostgroup_GET" );
$c->stash( status_data => $c->stash->{rest} );
- # If totalhgs is 0, then no access is allowed for user to
- # this part of the host group tree
- if ( $c->stash->{status_data}->{summary}->{totalhgs} == 0
- && !$c->user->has_access("VIEWALL") )
- {
- $c->detach( "/access_denied" );
- }
-
$c->stash( template => "hostgroup" );
}
@@ -157,7 +154,7 @@
%extra_params
},
\@params_to_delete
- )->path_query,
+ )->path_query,
};
}
return \@matpath;
Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Status/Service.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Status/Service.pm 2012-10-17 16:33:35 UTC (rev 10500)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Status/Service.pm 2012-10-17 19:02:44 UTC (rev 10501)
@@ -57,9 +57,10 @@
$c->stash( subheading => $downtime_comment );
}
elsif ( $_ = $c->req->param("hostgroupid") ) {
- my $hg =
- $c->model("RuntimeSchema::OpsviewHostgroups")->search( { id => $_ } )
- ->first;
+ my $oldrs = $c->stash->{rs};
+ $c->forward( "/rest/status/hostgroup/apply_restrictions" );
+ my $hg = $c->stash->{rs}->search( { id => $_ } )->first;
+ $c->stash->{rs} = $oldrs;
if ($hg) {
$c->stash( hostgroup => $hg );
$c->stash( breadcrumbs =>
@@ -73,9 +74,10 @@
}
elsif ( $c->stash->{status_data}->{summary}->{host}->{total} == 1 ) {
my $hostname = $c->stash->{status_data}->{list}->[0]->{name};
- my $host =
- $c->model("RuntimeSchema::OpsviewHosts")
- ->find( { name => $hostname } );
+ my $oldrs = $c->stash->{rs};
+ $c->forward( "/rest/status/host/apply_restrictions" );
+ my $host = $c->stash->{rs}->find( { name => $hostname } );
+ $c->stash->{rs} = $oldrs;
my $breadcrumbs =
$c->forward( "/status/hostgroup/breadcrumbs", [ $host->hostgroup ] );
push @$breadcrumbs, $c->forward( "/status/host/breadcrumb", [$host] );
@@ -251,8 +253,8 @@
}
-sub set : Local : Does(ACL) : AllowedRole(ACTIONALL) : AllowedRole(ACTIONSOME) :
- ACLDetachTo(/access_denied) {
+sub set : Local : Does(ACL) : AllowedRole(ACTIONALL) : AllowedRole(ACTIONSOME)
+ : ACLDetachTo(/access_denied) {
my ( $self, $c ) = @_;
$self->sort_parameters($c);
Modified: trunk/opsview-web/t/820hh.t
===================================================================
--- trunk/opsview-web/t/820hh.t 2012-10-17 16:33:35 UTC (rev 10500)
+++ trunk/opsview-web/t/820hh.t 2012-10-17 19:02:44 UTC (rev 10501)
@@ -128,6 +128,30 @@
"User correctly has no access to this hostgroup"
);
+$somehosts->get_ok( "/status/host?hostgroupid=7" );
+$somehosts->content_lacks(
+ "singlehost",
+ "Should not show the singlehost hostgroup in breadcrumbs, as user does not have access"
+);
+
+$somehosts->get_ok( "/status/service?hostgroupid=7" );
+$somehosts->content_lacks(
+ "singlehost",
+ "Should not show the singlehost hostgroup in breadcrumbs, as user does not have access"
+);
+
+$somehosts->get_ok( "/status/host?hostgroupid=2" );
+$somehosts->content_lacks(
+ "Monitoring Servers",
+ "Should not show the Monitoring Servers hostgroup in breadcrumbs, as user does not have access"
+);
+
+$somehosts->get_ok( "/status/service?hostgroupid=2" );
+$somehosts->content_lacks(
+ "Monitoring Servers",
+ "Should not show the Monitoring Servers hostgroup in breadcrumbs, as user does not have access"
+);
+
$somehosts->get( "/status/hostgroup?asuser=admin" );
ok(
$somehosts->res->is_success,