Hi,
we need readonly users for the webinterface. readonly means the user
(contact) should only see his hosts and services, but should not be able
to execute any commands except creating comments.
It did a very dirty quick patch to the current 1-x-cvs version. If the
contact name ends with "_ro" (for readonly) the contact is not able to
execute any commands except creating new comments.
It think a good solution would be a configuration option in the cgi.cfg
like
Format: readonly_user=,,,...
Example: readonly_user=bob,alice
Bye
Dietmar
cube1:/usr/local/src/nagios-1-x-cvs# diff -c
/home/druzicka/nagios-all/cvs/123/nagios/cgi/cmd.c cgi/cmd.c
*** /home/druzicka/nagios-all/cvs/123/nagios/cgi/cmd.c Fri May 30
21:25:55 2003
--- cgi/cmd.c Wed Aug 6 17:23:53 2003
***************
*** 556,562 ****
time_t t;
char buffer[MAX_INPUT_BUFFER];
contact *temp_contact;
!
/* get default name to use for comment author */
temp_contact=find_contact(current_authdata.username,NULL);
--- 556,562 ----
time_t t;
char buffer[MAX_INPUT_BUFFER];
contact *temp_contact;
! char *substr;
/* get default name to use for comment author */
temp_contact=find_contact(current_authdata.username,NULL);
***************
*** 565,570 ****
--- 565,585 ----
else
comment_author=current_authdata.username;
+
+ if ((substr=strstr(comment_author,"_ro"))!=NULL) {
+ if (!strcmp(substr,"_ro")) {
+ printf("You, %s are
requesting to ",comment_author);
+ switch(cmd){
+ case CMD_ADD_HOST_COMMENT:
+ case CMD_ADD_SVC_COMMENT:
+ printf("add a %s
comment",(cmd==CMD_ADD_HOST_COMMENT)?"host":"service");
+ break;
+ default:
+ printf("execute an command. This is not allowed! Sorry
you are a readonly user!");
+ return;
+ } //case
+ } //if strcmp
+ } // if strstr
printf("You are requesting
to ");
cube1:/usr/local/src/nagios-1-x-cvs#
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]