--- extinfo.c.orig	Thu Jan 24 02:51:30 2008
+++ extinfo.c	Sat Apr  5 05:20:12 2008
@@ -206,7 +206,7 @@
 			snprintf(temp_buffer,sizeof(temp_buffer)-1,"Host Information");
 		else if(display_type==DISPLAY_SERVICE_INFO)
 			snprintf(temp_buffer,sizeof(temp_buffer)-1,"Service Information");
-		else if(display_type==DISPLAY_COMMENTS)
+		else if(display_type==DISPLAY_COMMENTS && is_authorized_for_read_only==FALSE)
 			snprintf(temp_buffer,sizeof(temp_buffer)-1,"All Host and Service Comments");
 		else if(display_type==DISPLAY_PERFORMANCE)
 			snprintf(temp_buffer,sizeof(temp_buffer)-1,"Performance Information");
@@ -540,7 +540,7 @@
 		show_host_info();
 	else if(display_type==DISPLAY_SERVICE_INFO)
 		show_service_info();
-	else if(display_type==DISPLAY_COMMENTS)
+	else if(display_type==DISPLAY_COMMENTS && is_authorized_for_read_only==FALSE)
 		show_all_comments();
 	else if(display_type==DISPLAY_PERFORMANCE)
 		show_performance_data();
@@ -1210,7 +1210,7 @@
 
 	printf("<TABLE BORDER='1' CELLPADDING=0 CELLSPACING=0><TR><TD>\n");
 
-	if(nagios_process_state==STATE_OK){
+	if(nagios_process_state==STATE_OK && is_authorized_for_read_only(&current_authdata)==FALSE){
 
 		printf("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 CLASS='command'>\n");
 #ifdef USE_STATUSMAP
@@ -1278,7 +1278,10 @@
 			printf("<tr CLASS='command'><td><img src='%s%s' border=0 ALT='Enable Flap Detection For This Host' TITLE='Enable Flap Detection For This Host'></td><td CLASS='command'><a href='%s?cmd_typ=%d&host=%s'>Enable flap detection for this host</a></td></tr>\n",url_images_path,ENABLED_ICON,COMMAND_CGI,CMD_ENABLE_HOST_FLAP_DETECTION,url_encode(host_name));
 
 		printf("</TABLE>\n");
-	        }
+		}
+        else if ( is_authorized_for_read_only(&current_authdata)==TRUE){
+                printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
+        }
 	else{
 		printf("<DIV ALIGN=CENTER CLASS='infoMessage'>It appears as though Nagios is not running, so commands are temporarily unavailable...<br>\n");
 		printf("Click <a href='%s?type=%d'>here</a> to view Nagios process information</DIV>\n",EXTINFO_CGI,DISPLAY_PROCESS_INFO);
@@ -1294,9 +1297,10 @@
 
 	printf("<TD COLSPAN=2 ALIGN=CENTER VALIGN=TOP CLASS='commentPanel'>\n");
 
+	if (is_authorized_for_read_only(&current_authdata)==FALSE){
 	/* display comments */
 	display_comments(HOST_COMMENT);
-
+	}
 	printf("</TD>\n");
 
 	printf("</TR>\n");
@@ -1527,7 +1531,7 @@
 	printf("<TABLE BORDER='1' CELLSPACING=0 CELLPADDING=0>\n");
 	printf("<TR><TD>\n");
 
-	if(nagios_process_state==STATE_OK){
+	if(nagios_process_state==STATE_OK &&  is_authorized_for_read_only(&current_authdata)==FALSE){
 		printf("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 CLASS='command'>\n");
 
 		if(temp_svcstatus->checks_enabled){
@@ -1616,7 +1620,10 @@
 		        }
 
 		printf("</table>\n");
-	        }
+		}
+        else if ( is_authorized_for_read_only(&current_authdata)==TRUE){
+                printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
+                }
 	else{
 		printf("<DIV CLASS='infoMessage'>It appears as though Nagios is not running, so commands are temporarily unavailable...<br>\n");
 		printf("Click <a href='%s?type=%d'>here</a> to view Nagios process information</DIV>\n",EXTINFO_CGI,DISPLAY_PROCESS_INFO);
@@ -1635,9 +1642,10 @@
 	printf("<TR>\n");
 	printf("<TD COLSPAN=2 ALIGN=CENTER VALIGN=TOP CLASS='commentPanel'>\n");
 
+	if (is_authorized_for_read_only(&current_authdata)==FALSE) {
 	/* display comments */
 	display_comments(SERVICE_COMMENT);
-
+	}
 	printf("</TD>\n");
 	printf("</TR>\n");
 
@@ -1687,7 +1695,7 @@
 
 	printf("<DIV CLASS='dataTitle'>Hostgroup Commands</DIV>\n");
 
-	if(nagios_process_state==STATE_OK){
+	if(nagios_process_state==STATE_OK && is_authorized_for_read_only(&current_authdata)==FALSE){
 
 		printf("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 CLASS='command'>\n");
 		printf("<TR><TD>\n");
@@ -1714,6 +1722,9 @@
 
 		printf("</TD></TR>\n");
 		printf("</TABLE>\n");
+		}
+        else if ( is_authorized_for_read_only(&current_authdata)==TRUE){
+                printf("<DIV ALIGN=CENTER CLASS='infoMessage'>Your account does not have permissions to execute commands.<br>\n");
 	        }
 	else{
 		printf("<DIV CLASS='infoMessage'>It appears as though Nagios is not running, so commands are temporarily unavailable...<br>\n");
