nowrap='nowrap' width='150' align='center' class='tab'> User Configuration nowrap='nowrap' width='230' align='center' class='tab'> Individual Graph Permissions nowrap='nowrap' width='150' align='center' class='tab'> User Graph Settings
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"); } /* 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 graph_perms_edit() { global $colors; $graph_policy = "2"; if (!empty($_GET["id"])) { $graph_policy = db_fetch_cell("select graph_policy from user_auth where id=" . $_GET["id"]); if ($graph_policy == "1") { $graph_policy_text = "DENIED"; }elseif ($graph_policy == "2") { $graph_policy_text = "ALLOWED"; } $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("Graph Permissions [policy: " . (($graph_policy == "1") ? "ALLOW" : "DENY") . "]", "98%", $colors["header"], "3", "center", ""); $graphs = db_fetch_assoc("select user_auth_graph.user_id, graph_templates_graph.local_graph_id, graph_templates_graph.title_cache, graph_local.host_id from graph_templates_graph left join user_auth_graph on (graph_templates_graph.local_graph_id=user_auth_graph.local_graph_id and user_auth_graph.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . ") left join graph_local on graph_templates_graph.local_graph_id=graph_local.id where graph_templates_graph.local_graph_id > 0 order by graph_templates_graph.title_cache"); $trees = db_fetch_assoc("select user_auth_tree.user_id, graph_tree.id as tree_id, graph_tree.name from graph_tree left join user_auth_tree on (graph_tree.id=user_auth_tree.tree_id and user_auth_tree.user_id=" . (empty($_GET["id"]) ? "0" : $_GET["id"]) . ") order by graph_tree.name"); ?>
"> Default Policy
The default allow/deny graph policy for this user. "Allow", 2 => "Deny"); form_dropdown("graph_policy",$graph_policy_array,"","",$graph_policy,"",""); ?>
0) { foreach ($graphs as $graph) { if ($graph["user_id"] == "") { $old_value = ""; }else{ $old_value = "on"; } $column1 = floor((sizeof($graphs) / 2) + (sizeof($graphs) % 2)); if ($i == $column1) { print ""; } form_base_checkbox("graph" . $graph["local_graph_id"], $old_value, title_trim($graph["title_cache"], 60), "", (!empty($_GET["id"]) ? 1 : 0), true); $i++; } } ?>
"> Tree Permissions [policy: ]
0) { foreach ($trees as $tree) { if ($tree["user_id"] == "") { $old_value = ""; }else{ $old_value = "on"; } $column1 = floor((sizeof($trees) / 2) + (sizeof($trees) % 2)); if ($i == $column1) { print ""; } form_base_checkbox("tree" . $tree["tree_id"], $old_value, $tree["name"], "", (!empty($_GET["id"]) ? 1 : 0), true); $i++; } } ?>
\n"; start_box("", "98%", $colors["header"], "3", "center", ""); if (sizeof($tabs_graphs) > 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("user_id",(isset($_GET["id"]) ? $_GET["id"] : "0")); form_hidden_box("save_component_graph_config","1",""); form_save_button("user_admin.php"); } /* -------------------------- User Administration -------------------------- */ function user_remove() { 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"]) . "'?", $_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; 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++; } } ?>
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("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, graph_policy, DATE_FORMAT(max(time),'%M %e %Y %H:%i:%s') as time from user_auth left join user_log on user_auth.username = user_log.username group by user_auth.username"); $i = 0; if (sizeof($user_list) > 0) { foreach ($user_list as $user) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); ?> "> ">Delete