readonly user for cgis

local.coder code at novageeks.org
Thu Aug 7 04:31:57 CEST 2003


I have this change.

I should submit it. really.

In the config file I have two new options. readonly and readonly_for_all_hosts.
That's for managers who need to see but not touch.

Now my version also hides comments from read only users so the noc can be more 
free in what they type there.

I will send the diff's to the list tommorow when I am back in the office.

Derrick

Quoting Dietmar Ruzicka <dr at cubit.at>:

> 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=<user1>,<user2>,<user3>,...<usern> 
> 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("<P><DIV ALIGN=CENTER CLASS='cmdType'>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!</DIV>");
> +             return;
> +             } //case
> +           } //if strcmp
> +         } // if strstr
>    
>         printf("<P><DIV ALIGN=CENTER CLASS='cmdType'>You are requesting
> to ");
>    
> cube1:/usr/local/src/nagios-1-x-cvs#
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
> _______________________________________________
> Nagios-devel mailing list
> Nagios-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-devel
> 




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01




More information about the Developers mailing list