"Allow", 2 => "Deny"); if (!empty($_GET["id"])) { $policy = db_fetch_row("select policy_graphs,policy_trees,policy_hosts,policy_graph_templates from user_auth where id=" . $_GET["id"]); $header_label = "[edit: " . db_fetch_cell("select username from user_auth where id=" . $_GET["id"]) . "]"; } ?>
Graph policies will be evaluated in the order shown until a match is found.
Graph Permissions (By Graph)", "98%", $colors["header"], "3", "center", ""); $graphs = db_fetch_assoc("select graph_templates_graph.local_graph_id, graph_templates_graph.title_cache from graph_templates_graph left join user_auth_perms on (graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1) where graph_templates_graph.local_graph_id > 0 and user_auth_perms.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . " order by graph_templates_graph.title_cache"); ?>
"> Default Policy
The default allow/deny graph policy for this user. 0) { foreach ($graphs as $item) { $i++; print " \n"; } }else{ print ""; } ?>
$i) " . $item["title_cache"] . " Delete 
No Graphs
Add Graph:  0 order by title_cache"),"title_cache","local_graph_id","","","");?>  

Graph Permissions (By Host)", "98%", $colors["header"], "3", "center", ""); $hosts = db_fetch_assoc("select host.id, CONCAT_WS('',host.description,' (',host.hostname,')') as name from host left join user_auth_perms on (host.id=user_auth_perms.item_id and user_auth_perms.type=3) where user_auth_perms.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . " order by host.description,host.hostname"); ?> "> Default Policy
The default allow/deny graph policy for this user. 0) { foreach ($hosts as $item) { $i++; print " \n"; } }else{ print ""; } ?>
$i) " . $item["name"] . " Delete 
No Hosts
Add Host:   

Graph Permissions (By Graph Template)", "98%", $colors["header"], "3", "center", ""); $graph_templates = db_fetch_assoc("select graph_templates.id, graph_templates.name from graph_templates left join user_auth_perms on (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4) where user_auth_perms.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . " order by graph_templates.name"); ?> "> Default Policy
The default allow/deny graph policy for this user. 0) { foreach ($graph_templates as $item) { $i++; print " \n"; } }else{ print ""; } ?>
$i) " . $item["name"] . " Delete 
No Graph Templates
Add Graph Template:   

Tree Permissions", "98%", $colors["header"], "3", "center", ""); $trees = db_fetch_assoc("select graph_tree.id, graph_tree.name from graph_tree left join user_auth_perms on (graph_tree.id=user_auth_perms.item_id and user_auth_perms.type=2) where user_auth_perms.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . " order by graph_tree.name"); ?> "> Default Policy
The default allow/deny graph policy for this user. 0) { foreach ($trees as $item) { $i++; print " \n"; } }else{ print ""; } ?>
$i) " . $item["name"] . " Delete 
No Trees
Add Tree:   

Realm permissions control which sections of Cacti this user will have access to.
Realm Permissions \n \n"; ?>
0) { $old_value = "on"; }else{ $old_value = ""; } $column1 = floor((sizeof($user_auth_realms) / 2) + (sizeof($user_auth_realms) % 2)); if ($i == $column1) { print ""; } form_checkbox("section" . $realm_id, $old_value, $realm_name, "", (!empty($_GET["id"]) ? 1 : 0)); print "
"; $i++; } ?>
Graph settings control how graphs are displayed for this user.
Graph Settings", "98%", $colors["header"], "3", "center", ""); while (list($tab_short_name, $tab_fields) = each($settings_graphs)) { ?> $tab_fields[$field_name]); if ((isset($field_array["items"])) && (is_array($field_array["items"]))) { while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) { if (graph_config_value_exists($sub_field_name, $_GET["id"])) { $form_array[$field_name]["items"][$sub_field_name]["form_id"] = 1; } $form_array[$field_name]["items"][$sub_field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='$sub_field_name' and user_id=" . $_GET["id"]); } }else{ if (graph_config_value_exists($field_name, $_GET["id"])) { $form_array[$field_name]["form_id"] = 1; } $form_array[$field_name]["value"] = db_fetch_cell("select value from settings_graphs where name='$field_name' and user_id=" . $_GET["id"]); } } draw_edit_form( array( "config" => array( "no_form_tag" => true ), "fields" => $form_array ) ); } html_end_box(); form_hidden_box("save_component_graph_settings","1",""); } /* -------------------------- User Administration -------------------------- */ function user_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) { include("./include/top_header.php"); form_confirm("Are You Sure?", "Are you sure you want to delete the user '" . db_fetch_cell("select username from user_auth where id=" . $_GET["id"]) . "'?", "user_admin.php", "user_admin.php?action=user_remove&id=" . $_GET["id"]); include("./include/bottom_footer.php"); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { db_execute("delete from user_auth where id=" . $_GET["id"]); db_execute("delete from user_auth_realm where user_id=" . $_GET["id"]); db_execute("delete from user_auth_perms where user_id=" . $_GET["id"]); db_execute("delete from settings_graphs where user_id=" . $_GET["id"]); } } function user_edit() { global $colors, $fields_user_user_edit_host; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if (!empty($_GET["id"])) { $user = db_fetch_row("select * from user_auth where id=" . $_GET["id"]); $header_label = "[edit: " . $user["username"] . "]"; }else{ $header_label = "[new]"; } html_start_box("User Management $header_label", "98%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array("form_name" => "chk"), "fields" => inject_form_variables($fields_user_user_edit_host, (isset($user) ? $user : array())) )); html_end_box(); if (!empty($_GET["id"])) { /* draw user admin nav tabs */ ?>
nowrap='nowrap' width='150' align='center' class='tab'> Realm Permissions nowrap='nowrap' width='150' align='center' class='tab'> Graph Permissions nowrap='nowrap' width='130' align='center' class='tab'> Graph Settings
User Management", "98%", $colors["header"], "3", "center", "user_admin.php?action=user_edit"); $display_text = array( "username" => array("User Name", "ASC"), "full_name" => array("Full Name", "ASC"), "realm" => array("Realm", "ASC"), "policy_graphs" => array("Default Graph Policy", "ASC"), "dtime" => array("Last Login", "DESC")); html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"], 6); $user_list = db_fetch_assoc("SELECT id, user_auth.username, full_name, realm, policy_graphs, time, max(time) as dtime FROM user_auth LEFT JOIN user_log ON (user_auth.id = user_log.user_id) GROUP BY id ORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction']); $i = 0; if (sizeof($user_list) > 0) { foreach ($user_list as $user) { if (empty($user["dtime"]) || ($user["dtime"] == "12/31/1969")) { $last_login = "N/A"; }else{ $last_login = strftime("%A, %B %d, %Y %H:%M:%S ", strtotime($user["dtime"]));; } form_alternate_row_color($colors["alternate"],$colors["light"],$i); ?> "> ">Delete