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:
parent
f5343d7815
commit
ede97bc174
|
@ -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
|
||||||
|
|
|
@ -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>";
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -34,17 +34,19 @@ 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)
|
||||||
|
@ -52,6 +54,9 @@ function get_user_custom_graphs ($id_user = 0, $only_names = false) {
|
||||||
|
|
||||||
$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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue