2011-02-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_custom_graphs.php
	godmode/reporting/graph_builder.main.php
	godmode/reporting/graphs.php: Only administrator users can select and see 
	group All in this views.
	
	Fix: #3183419, 3183421



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3908 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-02-17 18:11:56 +00:00
parent f5343d7815
commit ede97bc174
4 changed files with 36 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2011-02-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_custom_graphs.php
godmode/reporting/graph_builder.main.php
godmode/reporting/graphs.php: Only administrator users can select and see
group All in this views.
Fix: #3183419, 3183421
2011-02-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2011-02-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* operation/agentes/estado_agente.php * operation/agentes/estado_agente.php

View File

@ -102,9 +102,14 @@ if ($edit_graph) {
} }
echo ">"; echo ">";
$group_select = get_user_groups ($config['id_user']); $own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || give_acl ($config['id_user'], 0, "PM"))
$return_all_groups = true;
else
$return_all_groups = false;
echo "<td><b>".__('Group')."</b></td><td>" . echo "<td><b>".__('Group')."</b></td><td>" .
print_select_groups($config['id_user'], "AR", true, 'graph_id_group', $id_group, '', '', '', true) . print_select_groups($config['id_user'], "AR", $return_all_groups, 'graph_id_group', $id_group, '', '', '', true) .
"</td></tr>"; "</td></tr>";
echo "<tr>"; echo "<tr>";
echo "<td class='datos2'><b>".__('Description')."</b></td>"; echo "<td class='datos2'><b>".__('Description')."</b></td>";

View File

@ -56,7 +56,13 @@ if ($delete_graph) {
} }
} }
$graphs = get_user_custom_graphs (); $own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || give_acl ($config['id_user'], 0, "PM"))
$return_all_group = true;
else
$return_all_group = false;
$graphs = get_user_custom_graphs ($config['id_user'], false, $return_all_group, "IW");
if (! empty ($graphs)) { if (! empty ($graphs)) {
$table->width = '720px'; $table->width = '720px';

View File

@ -34,31 +34,36 @@ if ($config['flash_charts']) {
* @param $id_user User id to check. * @param $id_user User id to check.
* @param $only_names Wheter to return only graphs names in an associative array * @param $only_names Wheter to return only graphs names in an associative array
* or all the values. * or all the values.
* @param $returnAllGroup Wheter to return graphs of group All or not.
* @param $privileges Privileges to check in user group
* *
* @return Custom graphs of a an user. Empty array if none. * @return Custom graphs of a an user. Empty array if none.
*/ */
function get_user_custom_graphs ($id_user = 0, $only_names = false) { function get_user_custom_graphs ($id_user = 0, $only_names = false, $returnAllGroup = true, $privileges = 'IR') {
global $config; global $config;
if (!$id_user) { if (!$id_user) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }
$groups = get_user_groups ($id_user, "AR", false); $groups = get_user_groups ($id_user, $privileges, $returnAllGroup);
$all_graphs = get_db_all_rows_in_table ('tgraph', 'name'); $all_graphs = get_db_all_rows_in_table ('tgraph', 'name');
if ($all_graphs === false) if ($all_graphs === false)
return array (); return array ();
$graphs = array (); $graphs = array ();
foreach ($all_graphs as $graph) { foreach ($all_graphs as $graph) {
if (!in_array($graph['id_group'], array_keys($groups)))
continue;
if ($graph["id_user"] != $id_user && $graph['private']) if ($graph["id_user"] != $id_user && $graph['private'])
continue; continue;
if ($graph["id_group"] > 0) if ($graph["id_group"] > 0)
if (!isset($groups[$graph["id_group"]])){ if (!isset($groups[$graph["id_group"]])){
continue; continue;
} }
if ($only_names) { if ($only_names) {
$graphs[$graph['id_graph']] = $graph['name']; $graphs[$graph['id_graph']] = $graph['name'];