mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
[Secondary groups] Added secondary groups to node monitor detail
This commit is contained in:
parent
5dec329941
commit
361bd23093
@ -91,7 +91,7 @@ $user_groups = implode (',', array_keys (users_get_groups ()));
|
|||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
// Begin Build SQL sentences
|
// Begin Build SQL sentences
|
||||||
$sql_from = ' FROM ttipo_modulo,tagente, tagente_modulo, tagente_estado,tmodule ';
|
$sql_from = ' FROM ttipo_modulo,tagente LEFT JOIN tagent_secondary_group tasg ON tagente.id_agente = tasg.id_agent, tagente_modulo, tagente_estado,tmodule ';
|
||||||
|
|
||||||
$sql_conditions_base = ' WHERE tagente.id_agente = tagente_modulo.id_agente
|
$sql_conditions_base = ' WHERE tagente.id_agente = tagente_modulo.id_agente
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo AND tmodule.id_module = tagente_modulo.id_modulo';
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo AND tmodule.id_module = tagente_modulo.id_modulo';
|
||||||
@ -108,11 +108,17 @@ else {
|
|||||||
// Agent group selector
|
// Agent group selector
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
if ($ag_group > 0 && check_acl ($config['id_user'], $ag_group, 'AR')) {
|
if ($ag_group > 0 && check_acl ($config['id_user'], $ag_group, 'AR')) {
|
||||||
$sql_conditions_group = sprintf (' AND tagente.id_grupo = %d', $ag_group);
|
$sql_conditions_group = sprintf (
|
||||||
|
' AND (tagente.id_grupo = %d OR tasg.id_group = %d)',
|
||||||
|
$ag_group, $ag_group
|
||||||
|
);
|
||||||
}
|
}
|
||||||
elseif ($user_groups != '') {
|
elseif ($user_groups != '') {
|
||||||
// User has explicit permission on group 1 ?
|
// User has explicit permission on group 1 ?
|
||||||
$sql_conditions_group = ' AND tagente.id_grupo IN ('.$user_groups.')';
|
$sql_conditions_group = ' AND (
|
||||||
|
tagente.id_grupo IN ('.$user_groups.')
|
||||||
|
OR tasg.id_group IN ('.$user_groups.')
|
||||||
|
)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -254,7 +260,7 @@ $sql_conditions_acl = $sql_conditions_base . $sql_conditions_group . $sql_condit
|
|||||||
|
|
||||||
// Get count to paginate
|
// Get count to paginate
|
||||||
if (!defined('METACONSOLE'))
|
if (!defined('METACONSOLE'))
|
||||||
$count = db_get_sql ('SELECT COUNT(tagente_modulo.id_agente_modulo) ' . $sql_from . $sql_conditions_all);
|
$count = db_get_sql ('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_from . $sql_conditions_all);
|
||||||
|
|
||||||
// Get limit_sql depend of the metaconsole or standard mode
|
// Get limit_sql depend of the metaconsole or standard mode
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
@ -759,6 +765,7 @@ switch ($config['dbtype']) {
|
|||||||
tagente_modulo.unknown_instructions,
|
tagente_modulo.unknown_instructions,
|
||||||
tagente_estado.utimestamp AS utimestamp' .
|
tagente_estado.utimestamp AS utimestamp' .
|
||||||
$sql_from . $sql_conditions_all . '
|
$sql_from . $sql_conditions_all . '
|
||||||
|
GROUP BY tagente_modulo.id_agente_modulo
|
||||||
ORDER BY ' . $order['field'] . " " . $order['order'] . '
|
ORDER BY ' . $order['field'] . " " . $order['order'] . '
|
||||||
LIMIT '.$offset.",".$limit_sql;
|
LIMIT '.$offset.",".$limit_sql;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user