nowrap='nowrap' width='150' align='center' class='tab'> User Configuration nowrap='nowrap' width='160' align='center' class='tab'> Graph Permissions

0) { foreach (array_keys($settings_graphs) as $setting) { if (isset($_POST[$setting])) { db_execute("replace into settings_graphs (user_id,name,value) values (" . (!empty($user_id) ? $user_id : $_POST["user_id"]) . ",'$setting', '" . $_POST[$setting] . "')"); } } } /* reset local settings cache so the user sees the new settings */ kill_session_var("sess_graph_config_array"); } /* graph permissions */ if ((isset($_POST["save_component_graph_perms"])) && (!is_error_message())) { $add_button_clicked = false; if (isset($_POST["add_graph_y"])) { db_execute("replace into user_auth_perms (user_id,item_id,type) values (" . $_POST["user_id"] . "," . $_POST["perm_graphs"] . ",1)"); $add_button_clicked = true; }elseif (isset($_POST["add_tree_y"])) { db_execute("replace into user_auth_perms (user_id,item_id,type) values (" . $_POST["user_id"] . "," . $_POST["perm_trees"] . ",2)"); $add_button_clicked = true; }elseif (isset($_POST["add_host_y"])) { db_execute("replace into user_auth_perms (user_id,item_id,type) values (" . $_POST["user_id"] . "," . $_POST["perm_hosts"] . ",3)"); $add_button_clicked = true; }elseif (isset($_POST["add_graph_template_y"])) { db_execute("replace into user_auth_perms (user_id,item_id,type) values (" . $_POST["user_id"] . "," . $_POST["perm_graph_templates"] . ",4)"); $add_button_clicked = true; } if ($add_button_clicked == true) { header ("Location: user_admin.php?action=graph_perms_edit&id=" . $_POST["user_id"]); exit; } db_execute("update user_auth set policy_graphs='" . $_POST["policy_graphs"] . "', policy_trees='" . $_POST["policy_trees"] . "', policy_hosts='" . $_POST["policy_hosts"] . "', policy_graph_templates='" . $_POST["policy_graph_templates"] . "' where id=" . $_POST["user_id"]); } /* redirect to the appropriate page */ if (is_error_message()) { header ("Location: user_admin.php?action=user_edit&id=" . (empty($user_id) ? $_POST["id"] : $user_id)); }else{ header ("Location: user_admin.php"); } } /* -------------------------- Graph Permissions -------------------------- */ function perm_remove() { if ($_GET["type"] == "graph") { db_execute("delete from user_auth_perms where type=1 and user_id=" . $_GET["user_id"] . " and item_id=" . $_GET["id"]); }elseif ($_GET["type"] == "tree") { db_execute("delete from user_auth_perms where type=2 and user_id=" . $_GET["user_id"] . " and item_id=" . $_GET["id"]); }elseif ($_GET["type"] == "host") { db_execute("delete from user_auth_perms where type=3 and user_id=" . $_GET["user_id"] . " and item_id=" . $_GET["id"]); }elseif ($_GET["type"] == "graph_template") { db_execute("delete from user_auth_perms where type=4 and user_id=" . $_GET["user_id"] . " and item_id=" . $_GET["id"]); } header ("Location: user_admin.php?action=graph_perms_edit&id=" . $_GET["user_id"]); } function graph_perms_edit() { global $colors; $graph_policy_array = array( 1 => "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"]) . "]"; } if (read_config_option("full_view_user_admin") == "") { draw_user_form_select(); } start_box("", "98%", "aaaaaa", "3", "center", ""); ?> Graph policies will be evaluated in the order shown until a match is found. Graph Permissions", "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) { print " \n"; } }else{ print ""; } ?>
" . $item["title_cache"] . " Delete 
No Graphs
Add Graph:  0 order by title_cache"),"title_cache","local_graph_id","","","");?>  

Host Permissions", "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) { print " \n"; } }else{ print ""; } ?>
" . $item["name"] . " Delete 
No Hosts
Add Host:   

Graph Template Permissions", "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) { print " \n"; } }else{ print ""; } ?>
" . $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) { print " \n"; } }else{ print ""; } ?>
" . $item["name"] . " Delete 
No Trees
Add Tree:   

'" . db_fetch_cell("select username from user_auth where id=" . $_GET["id"]) . "'?", $_SERVER["HTTP_REFERER"], "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_hosts where user_id=" . $_GET["id"]); db_execute("delete from user_auth_graph where user_id=" . $_GET["id"]); db_execute("delete from user_auth_tree where user_id=" . $_GET["id"]); db_execute("delete from settings_graphs where user_id=" . $_GET["id"]); } } function user_edit() { global $colors, $tabs_graphs, $settings_graphs, $graph_views, $graph_tree_views; 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]"; } if (read_config_option("full_view_user_admin") == "") { draw_user_form_select(); } start_box("User Management $header_label", "98%", $colors["header"], "3", "center", ""); ?> User Name
The login name for this user. Full Name
A more descriptive name for this user, that can include spaces or special characters. Password
Enter the password for this user twice. Remember that passwords are case sensitive!
Account Options
Set any user account-specific options here. Graph Options
Set any graph-specific options here. Login Options
What to do when this user logs in. Realm Permissions \n \n"; $realms = db_fetch_assoc("select user_auth_realm.user_id, user_realm.id, user_realm.name from user_realm left join user_auth_realm on (user_realm.id=user_auth_realm.realm_id and user_auth_realm.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . ") order by user_realm.name"); ?>
0) { foreach ($realms as $realm) { if ($realm["user_id"] == "") { $old_value = ""; }else{ $old_value = "on"; } $column1 = floor((sizeof($realms) / 2) + (sizeof($realms) % 2)); if ($i == $column1) { print ""; } form_base_checkbox("section" . $realm["id"], $old_value, $realm["name"], "", (!empty($_GET["id"]) ? 1 : 0), true); $i++; } } ?>
0) { foreach (array_keys($tabs_graphs) as $tab_short_name) { ?> "> Graph Settings [] 0) { foreach (array_keys($settings_graphs) as $setting) { /* make sure to skip group members here; only parents are allowed */ if (($settings_graphs[$setting]["method"] != "internal") && ($settings_graphs[$setting]["tab"] == $tab_short_name)) { form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); /* draw the acual header and textbox on the form */ form_item_label($settings_graphs[$setting]["friendly_name"],$settings_graphs[$setting]["description"]); $current_value = db_fetch_cell("select value from settings_graphs where name='$setting' and user_id=" . (isset($_GET["id"]) ? $_GET["id"] : "0")); /* choose what kind of item this is */ switch ($settings_graphs[$setting]["method"]) { case 'textbox': form_text_box($setting,$current_value,$settings_graphs[$setting]["default"],""); break; case 'drop_sql': form_dropdown($setting,db_fetch_assoc($settings_graphs[$setting]["sql"]),"name","id",$current_value,"",$settings_graphs[$setting]["default"]); break; case 'drop_array': form_dropdown($setting,${$settings_graphs[$setting]["array_name"]},"","",$current_value,"",$settings_graphs[$setting]["default"]); break; } $i++; print "\n"; } } } } } end_box(); form_hidden_id("id",(isset($user) ? $user["id"] : "0")); form_hidden_id("_policy_graphs",(isset($user) ? $user["policy_graphs"] : "2")); form_hidden_id("_policy_trees",(isset($user) ? $user["policy_trees"] : "2")); form_hidden_id("_policy_hosts",(isset($user) ? $user["policy_hosts"] : "2")); form_hidden_id("_policy_graph_templates",(isset($user) ? $user["policy_graph_templates"] : "2")); form_hidden_box("save_component_user","1",""); if (read_config_option("full_view_user_admin") == "") { form_save_button("user_admin.php"); } if (read_config_option("full_view_user_admin") == "on") { graph_perms_edit(); graph_config_edit(); } } function user() { global $colors, $auth_realms; start_box("User Management", "98%", $colors["header"], "3", "center", "user_admin.php?action=user_edit"); print ""; DrawMatrixHeaderItem("User Name",$colors["header_text"],1); DrawMatrixHeaderItem("Full Name",$colors["header_text"],1); DrawMatrixHeaderItem("Realm",$colors["header_text"],1); DrawMatrixHeaderItem("Default Graph Policy",$colors["header_text"],1); DrawMatrixHeaderItem("Last Login",$colors["header_text"],2); print ""; $user_list = db_fetch_assoc("select id, user_auth.username, full_name, realm, policy_graphs, DATE_FORMAT(max(time),'%M %e %Y %H:%i:%s') as time from user_auth left join user_log on user_auth.id = user_log.user_id group by id"); $i = 0; if (sizeof($user_list) > 0) { foreach ($user_list as $user) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); ?> "> ">Delete