[icinga-checkins] icinga.org: icinga-core/rbartels/cgi-current: Allow display of Network Outages for authorized hosts #1320

git at icinga.org git at icinga.org
Wed Mar 23 15:33:52 CET 2011


Module: icinga-core
Branch: rbartels/cgi-current
Commit: c7a97affd75bb8c7ac2ac080bcc63c715349c03c
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=c7a97affd75bb8c7ac2ac080bcc63c715349c03c

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Wed Mar 23 15:31:49 2011 +0100

Allow display of Network Outages for authorized hosts #1320

refs: #1320

---

 Changelog     |    1 +
 cgi/outages.c |   11 +++--------
 cgi/tac.c     |   13 +++++--------
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/Changelog b/Changelog
index 568c8f3..4ad12e6 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ ENHANCEMENTS
 * classic ui: Store cmd.cgi submissions in log #1161
 * classic ui: enforce a need for comment for action taken in cmd.cgi #610
 * classic ui: Add config option to set start of week (sunday/monday) #1269
+* classic ui: Allow display of Network Outages for authorized hosts #1320 (thx mjbrooks)
 
 FIXES
 * core: fix flexible downtime on service hard state change doesn't get triggered/activated #1128
diff --git a/cgi/outages.c b/cgi/outages.c
index 58127e5..0b1f6de 100644
--- a/cgi/outages.c
+++ b/cgi/outages.c
@@ -288,14 +288,6 @@ void display_network_outages(void){
 	char state_duration[48];
 	int total_entries=0;
 
-	/* user must be authorized for all hosts.. */
-	if(is_authorized_for_all_hosts(&current_authdata)==FALSE){
-
-		print_generic_error_message("It appears as though you do not have permission to view information you requested...","If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI and check the authorization options in your CGI configuration file.",0);
-
-		return;
-	}
-
 	/* find all hosts that are causing network outages */
 	find_hosts_causing_outages();
 
@@ -463,6 +455,9 @@ void find_hosts_causing_outages(void){
 			if(temp_host==NULL)
 				continue;
 
+			if (is_authorized_for_host(temp_host,&current_authdata)==FALSE)
+				continue;
+
 			/* if the route to this host is not blocked, it is a causing an outage */
 			if(is_route_to_host_blocked(temp_host)==FALSE)
 				add_hostoutage(temp_host);
diff --git a/cgi/tac.c b/cgi/tac.c
index cfd903f..edd66f6 100644
--- a/cgi/tac.c
+++ b/cgi/tac.c
@@ -733,10 +733,6 @@ void find_hosts_causing_outages(void){
 	hostoutage *temp_hostoutage;
 	host *temp_host;
 
-	/* user must be authorized for all hosts in order to see outages */
-	if(is_authorized_for_all_hosts(&current_authdata)==FALSE)
-		return;
-
 	/* check all hosts */
 	for(temp_hoststatus=hoststatus_list;temp_hoststatus!=NULL;temp_hoststatus=temp_hoststatus->next){
 
@@ -749,6 +745,9 @@ void find_hosts_causing_outages(void){
 			if(temp_host==NULL)
 				continue;
 
+			if (is_authorized_for_host(temp_host,&current_authdata)==FALSE)
+				continue;
+
 			/* if the route to this host is not blocked, it is a causing an outage */
 			if(is_route_to_host_blocked(temp_host)==FALSE)
 				add_hostoutage(temp_host);
@@ -981,10 +980,8 @@ void display_tac_overview(void){
 
 	printf("<tr>\n");
 	printf("<td class='outageHeader' width=125><a href='%s' class='outageHeader'>",OUTAGES_CGI);
-	if(is_authorized_for_all_hosts(&current_authdata)==FALSE)
-		printf("N/A");
-	else
-		printf("%d Outages",total_blocking_outages);
+
+	printf("%d Outages",total_blocking_outages);
 	printf("</a></td>\n");
 	printf("</tr>\n");
 





More information about the icinga-checkins mailing list