2013-03-11 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_tags.php: fixed the function
	"tags_get_acl_tags_module_condition" when the user profile is in
	the all group.
	
	* include/functions_reporting.php, include/functions_alerts.php,
	operation/agentes/estado_monitores.php: improve the code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7826 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-11 13:57:41 +00:00
parent 3bd61d3c01
commit c715ec8231
5 changed files with 55 additions and 34 deletions

View File

@ -1,3 +1,12 @@
2013-03-11 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_tags.php: fixed the function
"tags_get_acl_tags_module_condition" when the user profile is in
the all group.
* include/functions_reporting.php, include/functions_alerts.php,
operation/agentes/estado_monitores.php: improve the code style.
2013-03-11 Miguel de Dios <miguel.dedios@artica.es> 2013-03-11 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor_common.php: show only the * godmode/agentes/module_manager_editor_common.php: show only the

View File

@ -647,6 +647,7 @@ function tags_get_tags_formatted ($tags_array, $get_url = true) {
function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = 'module_condition', $query_prefix = '', $query_table = '') { function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = 'module_condition', $query_prefix = '', $query_table = '') {
global $config; global $config;
if($id_user == false) { if($id_user == false) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }
@ -782,14 +783,23 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
} }
// Group condition (The module belongs to an agent of the group X) // Group condition (The module belongs to an agent of the group X)
if (!array_key_exists(0, array_keys($acltags))) {
$group_condition = sprintf('%sid_agente IN (SELECT id_agente FROM tagente WHERE id_grupo = %d)', $modules_table, $group_id); $group_condition = sprintf('%sid_agente IN (SELECT id_agente FROM tagente WHERE id_grupo = %d)', $modules_table, $group_id);
}
else {
//Avoid the user profiles with all group access.
$group_condition = " 1 = 1 ";
}
// Tags condition (The module has at least one of the restricted tags) // Tags condition (The module has at least one of the restricted tags)
$tags_condition = sprintf('%sid_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (%s))', $modules_table, implode(',',$group_tags)); $tags_condition = sprintf('%sid_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (%s))', $modules_table, implode(',',$group_tags));
$condition .= "($group_condition AND \n$tags_condition)\n"; $condition .= "($group_condition AND \n$tags_condition)\n";
} }
if(!empty($condition)) { //Avoid the user profiles with all group access.
//if (!empty($condition)) {
if (!empty($condition) &&
!array_key_exists(0, array_keys($acltags))) {
$condition = sprintf("\n((%s) OR %sid_agente NOT IN (SELECT id_agente FROM tagente WHERE id_grupo IN (%s)))", $condition, $modules_table, implode(',',array_keys($acltags))); $condition = sprintf("\n((%s) OR %sid_agente NOT IN (SELECT id_agente FROM tagente WHERE id_grupo IN (%s)))", $condition, $modules_table, implode(',',array_keys($acltags)));
} }

View File

@ -152,7 +152,8 @@ switch ($config["dbtype"]) {
break; break;
} }
$tags_sql = tags_get_acl_tags($config['id_user'], $agent['id_grupo'], 'AR', 'module_condition', 'AND', 'tagente_modulo'); $tags_sql = tags_get_acl_tags($config['id_user'],
$agent['id_grupo'], 'AR', 'module_condition', 'AND', 'tagente_modulo');
$status_filter_monitor = (int)get_parameter('status_filter_monitor', -1); $status_filter_monitor = (int)get_parameter('status_filter_monitor', -1);
$status_text_monitor = get_parameter('status_text_monitor', ''); $status_text_monitor = get_parameter('status_text_monitor', '');
@ -565,7 +566,8 @@ foreach ($modules as $module) {
</script> </script>
<?php <?php
echo "<h4 style='padding-top:0px !important;'>".__('Full list of monitors')."</h4>"; echo "<h4 style='padding-top:0px !important;'>" .
__('Full list of monitors') . "</h4>";
print_form_filter_monitors($status_filter_monitor, $status_text_monitor); print_form_filter_monitors($status_filter_monitor, $status_text_monitor);
if (empty ($table->data)) { if (empty ($table->data)) {