Patch for External Authentication and UserGraphSettigs (CP)

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
zyta2002
Posts: 2
Joined: Thu May 11, 2006 5:53 am

Patch for External Authentication and UserGraphSettigs (CP)

Post by zyta2002 »

Hi @ all,

this is a crosspost to http://forums.cacti.net/viewtopic.php?t=13467

according to the reply i received from lvm (cacti-forum-mod) I've crossposted my entry in this forum...

I hope I'll receive an answer here...

Problem:
I'm implementing Cacti into Nagios (using the following htaccess file and changing the auth mechanism to External in cacti):

Code: Select all

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
AuthGroupFile /etc/nagios/htgroup.users
require group admins

<Files ~ "graph_image.php|graph.php|graph_view.php|css|gif|js">
AuthUserFile /etc/nagios/htpasswd.users
AuthGroupFile /etc/nagios/htgroup.users
require group admins guests
</Files>
Now... everything works fine (you can login as guest and you only see the graphs, or login as admin and you see the settings, etc...).

But if you login as admin OR guest you see the graph_settings icon on top of the screen. The graph settings are for USER-Based Graph Customization. Right ?

So, if I set the external auth this Feature is blocked

graph_settings.php

Code: Select all

/* you cannot have per-user graph settings if cacti's user management is not turned on */
        if (read_config_option("global_auth") == "") {
                raise_message(6);
                display_output_messages();
                return;
        }

        /* Find out whether this user has right here */
        if($current_user["graph_settings"] == "") {
                print "<strong><font size='+1' color='#FF0000'>YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>";
                include_once("./include/bottom_footer.php");
                exit;
        }
So... probably you shouldn't see the icon on top ?
Is my solution correct to include this patch ?

Code: Select all

--- top_graph_header.php.orig   2006-05-11 12:50:14.000000000 +0200
+++ top_graph_header.php        2006-05-11 12:46:47.000000000 +0200
@@ -105,10 +105,10 @@
                                                &nbsp;<?php if ($show_console_tab == true) {?><a href="index.php"><img src="images/tab_console.gif" alt="Console" align="absmiddle" border="0"></a><?php }?><a href="graph_view.php"><img src="images/tab_graphs.gif" alt="Graphs" align="absmiddle" border="0"></a>&nbsp;
                                        </td>
                                        <td>
-                                               <img src="images/cacti_backdrop2.gif" align="absmiddle">
+                                               <!-- <img src="images/cacti_backdrop2.gif" align="absmiddle"> -->
                                        </td>
                                        <td align="right" nowrap>
-                                               <?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["graph_settings"] == "on")) { print '<a href="graph_settings.php"><img src="images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings" align="absmiddle"></a>';}?>&nbsp;&nbsp;<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="graph_view.php?action=tree"><img src="images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="graph_view.php?action=list"><img src="images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="graph_view.php?action=preview"><img src="images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?>&nbsp;<br>
+                                               <?php if ((read_config_option("global_auth") == "on") && (!isset($_SESSION["sess_user_id"]) || $current_user["graph_settings"] == "on")) { print '<a href="graph_settings.php"><img src="images/tab_settings'; if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; } print '.gif" border="0" alt="Settings" align="absmiddle"></a>';}?>&nbsp;&nbsp;<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="graph_view.php?action=tree"><img src="images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="graph_view.php?action=list"><img src="images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="graph_view.php?action=preview"><img src="images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?>&nbsp;<br>
                                        </td>
                                </tr>
                        </table>
Or did I misunderstood something ?

Do I really need the graph_settings feature ?

greetz
zyta2002
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest