2010-08-30 Sergio Martin <sergio.martin@artica.es>
* operation/users/user.php operation/users/user_statistics.php operation/menu.php: Deleted the users view and the user statistics from operation menu git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3191 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0d6afdf199
commit
9f59553a9b
|
@ -1,3 +1,10 @@
|
|||
2010-08-30 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* operation/users/user.php
|
||||
operation/users/user_statistics.php
|
||||
operation/menu.php: Deleted the users view and the
|
||||
user statistics from operation menu
|
||||
|
||||
2010-08-29 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* include/pchart_graph.php,
|
||||
|
|
|
@ -185,30 +185,11 @@ if (give_acl ($config['id_user'], 0, "AR")) {
|
|||
}
|
||||
|
||||
// ANY user can view itself !
|
||||
|
||||
if (give_acl ($config["id_user"], 0, "UM")) {
|
||||
|
||||
// Users
|
||||
$menu["usuarios"]["text"] = __('View users');
|
||||
$menu["usuarios"]["sec2"] = "operation/users/user";
|
||||
$menu["usuarios"]["id"] = "oper-users";
|
||||
|
||||
$sub = array ();
|
||||
$sub["operation/users/user_edit"]["text"] = __('Edit my user');
|
||||
$sub["operation/users/user_edit"]["options"]["name"] = "ver";
|
||||
$sub["operation/users/user_edit"]["options"]["value"] = $config["id_user"];
|
||||
$sub["operation/users/user_statistics"]["text"] = __('Statistics');
|
||||
$menu["usuarios"]["sub"] = $sub;
|
||||
} else {
|
||||
// Users
|
||||
$menu["usuarios"]["text"] = __('Edit my user');
|
||||
$menu["usuarios"]["sec2"] = "operation/users/user_edit";
|
||||
$menu["usuarios"]["id"] = "oper-users";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//End of Users
|
||||
|
||||
// Rest of options, all with AR privilege (or should events be with incidents?)
|
||||
|
|
|
@ -1,245 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
check_login ();
|
||||
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
|
||||
$selected = 'border: 1px solid black;';
|
||||
$selectUserIDUp = '';
|
||||
$selectUserIDDown = '';
|
||||
$selectFullnameUp = '';
|
||||
$selectFullnameDown = '';
|
||||
$selectLastConnectUp = '';
|
||||
$selectLastConnectDown = '';
|
||||
$order = null;
|
||||
|
||||
switch ($sortField) {
|
||||
case 'id_user':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectUserIDUp = $selected;
|
||||
$order = array('field' => 'id_user', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectUserIDDown = $selected;
|
||||
$order = array('field' => 'id_user', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'fullname':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectFullnameUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectFullnameDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'last_connect':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastConnectUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastConnectDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$selectUserIDUp = '';
|
||||
$selectUserIDDown = '';
|
||||
$selectFullnameUp = $selected;
|
||||
$selectFullnameDown = '';
|
||||
$selectLastConnectUp = '';
|
||||
$selectLastConnectDown = '';
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
print_page_header (__('Pandora users'), "images/group.png", false, "", false, "");
|
||||
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = 700;
|
||||
$table->class = "databox";
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->align = array ();
|
||||
|
||||
$table->head[0] = __('User ID') . ' ' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=id_user&sort=up"><img src="images/sort_up.png" style="' . $selectUserIDUp . '" /></a>' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=id_user&sort=down"><img src="images/sort_down.png" style="' . $selectUserIDDown . '" /></a>';
|
||||
$table->head[1] = __('Name') . ' ' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=fullname&sort=up"><img src="images/sort_up.png" style="' . $selectFullnameUp . '" /></a>' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=fullname&sort=down"><img src="images/sort_down.png" style="' . $selectFullnameDown . '" /></a>';
|
||||
$table->head[2] = __('Last contact') . ' ' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=last_connect&sort=up"><img src="images/sort_up.png" style="' . $selectLastConnectUp . '" /></a>' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=last_connect&sort=down"><img src="images/sort_down.png" style="' . $selectLastConnectDown . '" /></a>';
|
||||
$table->head[3] = __('Profile');
|
||||
$table->head[4] = __('Description');
|
||||
|
||||
$table->align[2] = "center";
|
||||
$table->align[3] = "center";
|
||||
|
||||
|
||||
$info = array ();
|
||||
|
||||
$info = get_users ($order,array ('offset' => (int) get_parameter ('offset'),
|
||||
'limit' => (int) $config['block_size']));
|
||||
|
||||
//Only the users from the user groups are visible
|
||||
|
||||
$user_groups = get_user_groups ($config["id_user"]);
|
||||
$user_groups_id = array_keys($user_groups);
|
||||
$users_id = array();
|
||||
|
||||
foreach ($user_groups_id as $group) {
|
||||
$user_group_users = get_group_users($group);
|
||||
foreach ($user_group_users as $user_group_user)
|
||||
array_push($users_id,get_user_id ($user_group_user));
|
||||
}
|
||||
|
||||
$users_hidden = array_diff(array_keys($info),$users_id);
|
||||
|
||||
foreach($users_hidden as $user_hidden){
|
||||
unset($info[$user_hidden]);
|
||||
}
|
||||
|
||||
// Prepare pagination
|
||||
pagination (count(get_users ()));
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if ($rowPair)
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
else
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
|
||||
if ((check_acl ($config["id_user"], get_user_groups ($user_id), "UM")) OR ($config["id_user"] == $user_id)){
|
||||
$data[0] = '<b><a href="index.php?sec=usuarios&sec2=operation/users/user_edit&id='.$user_id.'">'.$user_id.'</a></b>';
|
||||
} else {
|
||||
$data[0] = $user_id;
|
||||
}
|
||||
$data[1] = $user_info["fullname"].'<a href="#" class="tip"><span>';
|
||||
$data[1] .= __('First name').': '.$user_info["firstname"].'<br />';
|
||||
$data[1] .= __('Last name').': '.$user_info["lastname"].'<br />';
|
||||
$data[1] .= __('Phone').': '.$user_info["phone"].'<br />';
|
||||
$data[1] .= __('E-mail').': '.$user_info["email"].'<br />';
|
||||
$data[1] .= '</span></a>';
|
||||
$data[2] = print_timestamp ($user_info["last_connect"], true);
|
||||
|
||||
if ($user_info["is_admin"]) {
|
||||
$data[3] = print_image ("images/user_suit.png", true, array ("alt" => __('Admin'), "title" => __('Administrator'))).' ';
|
||||
} else {
|
||||
$data[3] = print_image ("images/user_green.png", true, array ("alt" => __('User'), "title" => __('Standard User'))).' ';
|
||||
}
|
||||
|
||||
$data[3] .= '<a href="#" class="tip"><span>';
|
||||
$result = get_db_all_rows_field_filter ("tusuario_perfil", "id_usuario", $user_id);
|
||||
if (!empty ($result)) {
|
||||
foreach ($result as $row) {
|
||||
$data[3] .= get_profile_name ($row["id_perfil"]);
|
||||
$data[3] .= " / ";
|
||||
$data[3] .= get_group_name ($row["id_grupo"]);
|
||||
$data[3] .= "<br />";
|
||||
}
|
||||
} else {
|
||||
$data[3] .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
$data[3] .= "</span></a>";
|
||||
|
||||
$data[4] = print_string_substr ($user_info["comments"], 24, true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
print_table ($table);
|
||||
unset ($table);
|
||||
|
||||
echo '<h3>'.__('Profiles defined in Pandora').'</h3>';
|
||||
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->class = 'databox';
|
||||
$table->width = 700;
|
||||
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
|
||||
$table->head[0] = __('Profiles');
|
||||
|
||||
$table->head[1] = "IR".print_help_tip (__('System incidents reading'), true);
|
||||
$table->head[2] = "IW".print_help_tip (__('System incidents writing'), true);
|
||||
$table->head[3] = "IM".print_help_tip (__('System incidents management'), true);
|
||||
$table->head[4] = "AR".print_help_tip (__('Agents reading'), true);
|
||||
$table->head[5] = "AW".print_help_tip (__('Agents management'), true);
|
||||
$table->head[6] = "LW".print_help_tip (__('Alerts editing'), true);
|
||||
$table->head[7] = "UM".print_help_tip (__('Users management'), true);
|
||||
$table->head[8] = "DM".print_help_tip (__('Database management'), true);
|
||||
$table->head[9] = "LM".print_help_tip (__('Alerts management'), true);
|
||||
$table->head[10] = "PM".print_help_tip (__('Systems management'), true);
|
||||
|
||||
$table->size[1] = 40;
|
||||
$table->size[2] = 40;
|
||||
$table->size[3] = 40;
|
||||
$table->size[4] = 40;
|
||||
$table->size[5] = 40;
|
||||
$table->size[6] = 40;
|
||||
$table->size[7] = 40;
|
||||
$table->size[8] = 40;
|
||||
$table->size[9] = 40;
|
||||
$table->size[10] = 40;
|
||||
|
||||
$profiles = get_db_all_rows_in_table ("tperfil");
|
||||
|
||||
$img = print_image ("images/ok.png", true, array ("border" => 0));
|
||||
|
||||
foreach ($profiles as $profile) {
|
||||
$data[0] = $profile["name"];
|
||||
|
||||
$data[1] = ($profile["incident_view"] ? $img : '');
|
||||
$data[2] = ($profile["incident_edit"] ? $img : '');
|
||||
$data[3] = ($profile["incident_management"] ? $img : '');
|
||||
$data[4] = ($profile["agent_view"] ? $img : '');
|
||||
$data[5] = ($profile["agent_edit"] ? $img : '');
|
||||
$data[6] = ($profile["alert_edit"] ? $img : '');
|
||||
$data[7] = ($profile["user_management"] ? $img : '');
|
||||
$data[8] = ($profile["db_management"] ? $img : '');
|
||||
$data[9] = ($profile["alert_management"] ? $img : '');
|
||||
$data[10] = ($profile["pandora_management"] ? $img : '');
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
print_table ($table);
|
||||
unset ($table);
|
||||
?>
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
|
||||
|
||||
// Load global vars
|
||||
global $config;
|
||||
require_once ("include/fgraph.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
print_page_header (__('User activity statistics'), "images/group.png", false, "", false, "");
|
||||
|
||||
if ($config['flash_charts']) {
|
||||
echo graphic_user_activity ();
|
||||
} else {
|
||||
print_image ("include/fgraph.php?tipo=user_activity", false, array ("border" => 0));
|
||||
}
|
||||
|
||||
echo '<div id="activity" style="width:700px;">';
|
||||
// Show last activity from this user
|
||||
echo "<h2>" . __('This is your last activity in Pandora FMS console') . "</h2>";
|
||||
|
||||
$table->width = 650; //Don't specify px
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
$table->size[2] = '130px';
|
||||
$table->size[4] = '200px';
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('User');
|
||||
$table->head[1] = __('Category');
|
||||
$table->head[2] = __('Date');
|
||||
$table->head[3] = __('Source IP');
|
||||
$table->head[4] = __('Comments');
|
||||
|
||||
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
|
||||
FROM tsesion
|
||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
|
||||
AND `id_usuario` = '%s' ORDER BY `fecha` DESC LIMIT 50", $config["id_user"]);
|
||||
$sessions = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($sessions === false)
|
||||
$sessions = array ();
|
||||
|
||||
foreach ($sessions as $session) {
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<strong>'.$session['id_usuario'].'</strong>';
|
||||
$data[1] = $session['accion'];
|
||||
$data[2] = $session['fecha'];
|
||||
$data[3] = $session['ip_origen'];
|
||||
$data[4] = $session['descripcion'];
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
print_table ($table);
|
||||
echo "</div>"; // activity
|
||||
|
||||
?>
|
Loading…
Reference in New Issue