User permissions question

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
ralf
Posts: 35
Joined: Tue Nov 04, 2008 2:54 pm

User permissions question

Post by ralf »

I need to set up a user that can see all the graphs in the graph trees, that part I have figured out.

The other piece that is giving me trouble is I would like to give them read only access to the device list. that way they can look up device IP addresses by the host name and see any notes in the notes field.

I don't see any options that would allow a user to have read access to the hosts. I am running 0.8.7g

Thanks
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: User permissions question

Post by noname »

My suggestion...

(A) Use Thold plugin

Users can see devices 'thold' -> 'Host Status' tab.
(But notes are not displayed)
example (test user)
example (test user)
thold_host-status.png (34.04 KiB) Viewed 380 times
(B) Use SuperLinks plugin and create custom page you like
example (admin)
example (admin)
superlinks_example-1.png (10.06 KiB) Viewed 380 times
example (test user)
example (test user)
superlinks_example-2.png (20.8 KiB) Viewed 380 times
Sample code: ('devices.php' used at the above)
This code is totally borrowed from 'host.php'. :)

Code: Select all

<?php

host();

function host() {
        global $colors;

        $sql_where = "";

        html_start_box("", "100%", $colors["header"], "3", "center", "");

        $sortby = "description";
        if ($sortby=="hostname") {
                $sortby = "INET_ATON(hostname)";
        }

        $host_graphs       = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as graphs FROM graph_local GROUP BY host_id"), "host_id", "graphs");
        $host_data_sources = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as data_sources FROM data_local GROUP BY host_id"), "host_id", "data_sources");

        $sql_query = "SELECT *
                FROM host
                $sql_where
                ORDER BY " . $sortby;

        $hosts = db_fetch_assoc($sql_query);

        $display_text = array(
                "Description",
                "Notes",
                "ID",
                "Graphs",
                "Data Sources",
                "Status",
                "Event Count",
                "Hostname",
                "Current (ms)",
                "Average (ms)",
                "Availability");

        html_header($display_text);

        $i = 0;
        if (sizeof($hosts) > 0) {
                foreach ($hosts as $host) {
                        $items = array();

                        form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $host["id"]); $i++;
                        array_push($items, htmlspecialchars($host["description"]));
                        array_push($items, htmlspecialchars($host["notes"]));
                        array_push($items, round(($host["id"]), 2));
                        array_push($items, (isset($host_graphs[$host["id"]]) ? $host_graphs[$host["id"]] : 0));
                        array_push($items, (isset($host_data_sources[$host["id"]]) ? $host_data_sources[$host["id"]] : 0));
                        array_push($items, get_colored_device_status(($host["disabled"] == "on" ? true : false), $host["status"]));
                        array_push($items, round(($host["status_event_count"]), 2));
                        array_push($items, htmlspecialchars($host["hostname"]));
                        array_push($items, round(($host["cur_time"]), 2));
                        array_push($items, round(($host["avg_time"]), 2));
                        array_push($items, round($host["availability"], 2));
                        print "<td>" . implode($items, "</td>\n<td>") . "</td>";
                        form_end_row();
                }
        }else{
                print "<tr><td><em>No Hosts</em></td></tr>";
        }

        html_end_box(false);
}

?>
Note:
Custom page is loaded as inline-frame within 'superlinks.php'.
It is difficult (for me) to pass parameters dynamically to custom page, so I can't implement sorting/filtering list..
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests