';
- }
-
- // The '%s' will be replaced in the javascript code of the function 'show_locked_dialog'
- echo "
";
- echo '
';
-
- enterprise_hook('close_meta_frame');
-}
-
-ui_require_javascript_file('pandora_modules');
-?>
-
-
diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php
index 3b04cedd24..8e8f40339d 100644
--- a/pandora_console/include/api.php
+++ b/pandora_console/include/api.php
@@ -37,9 +37,12 @@ $api_password = get_parameter('apipass', '');
$password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
-
+$user_db = get_parameter('user_db', '');
$other = parseOtherParameter($otherSerialize, $otherMode);
-
+$group_db = get_parameter('group_db', '');
+$disable = get_parameter('disable', '');
+$id_up = get_parameter('id_up', '');
+$id_profile = get_parameter('id_profile', '');
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
$correctLogin = false;
@@ -107,7 +110,6 @@ if ($correctLogin) {
if ($op == 'set' && $id) {
switch ($op2) {
case 'update_agent':
-
case 'add_module_in_conf':
case 'update_module_in_conf':
case 'delete_module_in_conf':
@@ -149,8 +151,93 @@ if ($correctLogin) {
}
break;
- default:
+ case 'info_user_name':
+ if ($user_db === '') {
+ returnError(__('User not specified'), __('User not specified'));
+ return;
+ }
+
+ $id_os = api_set_info_user_name($returnType, $user_db);
+
+ if ($id_os != 100) {
+ return;
+ }
+
+ if ($id_os == 100) {
+ returnError('not_allowed_operation_cluster', $returnType);
+ return false;
+ }
+ break;
+
+ case 'filter_user_group':
+
+ if ($user_db === '' && ( $group_db === '' || $disable === '')) {
+ returnError(__('User, group or disabled status not specified'), __('User, group or disabled status not specified'));
+ return;
+ }
+
+ $id_os = api_set_filter_user_group($returnType, $user_db, $group_db, $disable);
+
+ if ($id_os != 100) {
+ return;
+ }
+
+ if ($id_os == false) {
+ returnError('not_allowed_operation_cluster', $returnType);
+ return false;
+ }
+ break;
+
+ case 'delete_user_profiles':
+
+ if ($user_db === '') {
+ returnError(__('User or group not specified'), __('User, group not specified'));
+ return;
+ }
+
+ $id_os = api_set_delete_user_profiles($user_db, $id_up);
+
+ if ($id_os != 100) {
+ return;
+ }
+
+ if ($id_os == false) {
+ returnError('not_allowed_operation_cluster', $returnType);
+ return false;
+ }
+ break;
+
+ case 'list_all_user':
+
+ $id_os = api_set_list_all_user($returnType);
+
+ if ($id_os === false) {
+ returnError('not_allowed_operation_cluster', $returnType);
+ return false;
+ }
+ break;
+
+ case 'add_permission_user_to_group':
+
+ if ($user_db == null || $group_db == null || $id_up == null) {
+ returnError(__('User, group or profile not specified'), __('User, group or profile status not specified'));
+ return;
+ }
+
+ $id_os = api_set_add_permission_user_to_group($returnType, $user_db, $group_db, $id_up, $id_profile);
+
+ if ($id_os != 100) {
+ return;
+ }
+
+ if ($id_os == false) {
+ returnError('not_allowed_operation_cluster', $returnType);
+ return false;
+ }
+ break;
+
+ default:
// break;
}
}
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 7903533d74..b3d76be3eb 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -559,7 +559,6 @@ $module_field_column_mampping = [
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
];
-
// module related field mappings 2/2 (output field => column for 'tagente_estado')
// module_id_agent_modulo is not in this list
$estado_fields_to_columns_mapping = [
@@ -14729,3 +14728,308 @@ function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3)
}
}
+
+
+/**
+ * Functions por get all user to new feature for Carrefour
+ * It depends of type the method will return csv or json data
+ *
+ * @param string $returnType
+ * @return
+ */
+
+
+function api_set_list_all_user($returnType)
+{
+ global $config;
+
+ if (!check_acl($config['id_user'], 0, 'AR')) {
+ returnError('forbidden', 'string');
+ return;
+ }
+
+ $sql = 'SELECT
+ tup.id_usuario AS user_id,
+ tp.id_perfil AS profile_id,
+ tp.name AS profile_name,
+ tup.id_grupo AS group_id,
+ tgp.nombre AS group_name
+ FROM tperfil tp
+ INNER JOIN tusuario_perfil tup
+ ON tp.id_perfil = tup.id_perfil
+ LEFT OUTER JOIN tgrupo tgp
+ ON tup.id_grupo = tgp.id_grupo;';
+
+ $users = db_get_all_rows_sql($sql);
+
+ $i = 0;
+
+ foreach ($users as $up) {
+ $group_name = $up['group_name'];
+ if ($up['group_name'] === null) {
+ $group_name = 'All';
+ }
+
+ $values[$i] = [
+ 'id_usuario' => $up['user_id'],
+ 'id_perfil' => $up['profile_id'],
+ 'perfil_name' => $up['profile_name'],
+ 'id_grupo' => $up['group_id'],
+ 'group_name' => $group_name,
+ ];
+ $i += 1;
+ }
+
+ if ($values === false) {
+ returnError('Error_user', __('Users could not be found.'));
+ return;
+ }
+
+ $data = [
+ 'type' => 'array',
+ 'data' => $values,
+ ];
+
+ returnData($returnType, $data, ';');
+}
+
+
+/**
+ * Funtion for get all info user to new feature for Carrefour
+ * It depends of type the method will return csv or json data
+ *
+ * @param string $returnType
+ * @param string $user_db
+ * @return
+ */
+
+
+function api_set_info_user_name($returnType, $user_db)
+{
+ global $config;
+
+ if (!check_acl($config['id_user'], 0, 'AR')) {
+ returnError('forbidden', 'string');
+ return;
+ }
+
+ $sql = sprintf(
+ 'SELECT
+ tup.id_usuario AS user_id, tp.id_perfil AS profile_id,
+ tp.name AS profile_name, tup.id_grupo AS group_id,
+ tg.nombre AS group_name
+ FROM tperfil tp
+ INNER JOIN tusuario_perfil tup
+ ON tp.id_perfil = tup.id_perfil
+ LEFT OUTER JOIN tgrupo tg
+ ON tup.id_grupo = tg.id_grupo
+ WHERE tup.id_usuario = %s',
+ io_safe_output($user_db)
+ );
+
+ $user_profile = db_get_all_rows_sql($sql);
+
+ $i = 0;
+
+ foreach ($user_profile as $up) {
+ $group_name = $up['group_name'];
+ if ($up['group_name'] === null) {
+ $group_name = 'All';
+ }
+
+ $values[$i] = [
+ 'id_usuario' => $up['user_id'],
+ 'id_perfil' => $up['profile_id'],
+ 'perfil_name' => $up['profile_name'],
+ 'id_grupo' => $up['group_id'],
+ 'group_name' => $group_name,
+ ];
+ $i += 1;
+ }
+
+ $data = [
+ 'type' => 'array',
+ 'data' => $values,
+ ];
+
+ returnData($returnType, $data, ';');
+}
+
+
+/**
+ * Function for get user from a group to new feature for Carrefour.
+ * It depends of type the method will return csv or json data.
+ *
+ * @param string $returnType
+ * @param string $user_db
+ * @param string $group_db
+ * @param integer $disable
+ * @return
+ */
+
+
+function api_set_filter_user_group($returnType, $user_db, $group_db, $disable)
+{
+ global $config;
+
+ if (!check_acl($config['id_user'], 0, 'AR')) {
+ returnError('forbidden', 'string');
+ return;
+ }
+
+ $filter_group = '';
+ if ($group_db !== null) {
+ $filter_group = 'AND tup.id_grupo = '.io_safe_output($group_db).'';
+ }
+
+ $sql_disable = '';
+ if ($disable !== null) {
+ $sql_disable = 'INNER JOIN tusuario tu
+ ON tu.disabled = '.io_safe_output($disable).'';
+ }
+
+ $sql = sprintf(
+ 'SELECT DISTINCT
+ tup.id_usuario AS user_id,
+ tp.id_perfil AS profile_id,
+ tp.name AS profile_name,
+ tup.id_grupo AS group_id,
+ tg.nombre AS group_name
+ FROM tperfil tp
+ INNER JOIN tusuario_perfil tup
+ ON tp.id_perfil = tup.id_perfil
+ LEFT OUTER JOIN tgrupo tg
+ ON tup.id_grupo = tg.id_grupo
+ '.$sql_disable.'
+ WHERE tup.id_usuario = %s '.$filter_group.'',
+ io_safe_output($user_db)
+ );
+
+ $filter_user = db_get_all_rows_sql($sql);
+
+ $i = 0;
+
+ foreach ($filter_user as $up) {
+ $group_name = $up['group_name'];
+ if ($up['group_name'] === null) {
+ $group_name = 'All';
+ }
+
+ $values[$i] = [
+ 'id_usuario' => $up['user_id'],
+ 'id_perfil' => $up['profile_id'],
+ 'perfil_name' => $up['profile_name'],
+ 'id_grupo' => $up['group_id'],
+ 'group_name' => $group_name,
+ ];
+ $i += 1;
+ }
+
+ $data = [
+ 'type' => 'array',
+ 'data' => $values,
+ ];
+
+ returnData($returnType, $data, ';');
+
+}
+
+
+/**
+ * Function for delete an user profile for Carrefour new feature
+ * The return of this function its only a message
+ *
+ * @param string $user_db
+ * @param integer $id_up
+ * @return void
+ */
+
+
+function api_set_delete_user_profiles($user_db, $id_up)
+{
+ global $config;
+
+ if (!check_acl($config['id_user'], 0, 'AW')) {
+ returnError('forbidden', 'string');
+ return;
+ }
+
+ $values = [
+ 'id_usuario' => io_safe_output($user_db),
+ 'id_up' => io_safe_output($id_up),
+ ];
+ $deleted_permission = db_process_sql_delete('tusuario_perfil', $values);
+
+ if ($deleted_permission == false) {
+ returnError('Error_delete', __('User profile could not be deleted.'));
+ return;
+ }
+
+ $data = [
+ 'type' => 'string',
+ 'data' => $deleted_permission,
+ ];
+
+ returnData('string', ['type' => 'string', 'data' => $data]);
+}
+
+
+/**
+ * Function for add permission a user to a group for Carrefour new feature
+ * It depends of type the method will return csv or json data
+ *
+ * @param string $returnType
+ * @param string $user_db
+ * @param integer $group_db
+ * @param integer $id_up
+ *
+ * @return void
+ */
+
+
+function api_set_add_permission_user_to_group($returnType, $user_db, $group_db, $id_up, $id_profile)
+{
+ global $config;
+
+ if (!check_acl($config['id_user'], 0, 'AW')) {
+ returnError('forbidden', 'string');
+ return;
+ }
+
+ $sql = 'SELECT id_up
+ FROM tusuario_perfil
+ WHERE id_up = '.$id_profile.'';
+
+ $exist_profile = db_get_value_sql($sql);
+
+ $values = [
+ 'id_usuario' => $user_db,
+ 'id_perfil' => $id_up,
+ 'id_grupo' => $group_db,
+ 'no_hierarchy' => 0,
+ 'assigned_by' => 0,
+ 'id_policy' => 0,
+ 'tags' => '',
+
+ ];
+
+ $where_id_up = ['id_up' => $id_profile];
+ if ($exist_profile == $id_profile) {
+ $sucessfull_insert = db_process_sql_update('tusuario_perfil', $values, $where_id_up);
+ } else {
+ $sucessfull_insert = db_process_sql_insert('tusuario_perfil', $values);
+ }
+
+ if ($sucessfull_insert == false) {
+ returnError('Error_insert', __('User profile could not be available.'));
+ return;
+ }
+
+ $data = [
+ 'type' => 'array',
+ 'data' => $values,
+ ];
+
+ returnData($returnType, $data, ';');
+
+}
diff --git a/pandora_console/include/languages/en_GB.po b/pandora_console/include/languages/en_GB.po
index 193705f89d..c6e833bc32 100644
--- a/pandora_console/include/languages/en_GB.po
+++ b/pandora_console/include/languages/en_GB.po
@@ -36481,8 +36481,8 @@ msgstr ""
#: ../../enterprise/load_enterprise.php:584
#, php-format
msgid ""
-"
License out of limits "
-"This node has a metaconsole license and it allows %d agents and you have %d "
+"
Out of license limits "
+"This node has a Metaconsole license that allows %d agents, and you have %d "
"agents cached."
msgstr ""
"
License expired This "
@@ -36492,20 +36492,21 @@ msgstr ""
#: ../../enterprise/load_enterprise.php:592
#, php-format
msgid ""
-"
License out of limits "
-"This license allows %d agents and you have %d agents configured."
+"
Out of license limits "
+"This node has a Metaconsole license that allows %d agents, and you have %d "
+"agents configured."
msgstr ""
"
License expired This "
-"license allows %d agents and you have %d agents configured."
+"license allows %d agents, and you have %d agents configured."
#: ../../enterprise/load_enterprise.php:597
#, php-format
msgid ""
-"
License out of limits "
+"
Out of license limits "
"This license allows %d modules and you have %d modules configured."
msgstr ""
-"
License expired This "
-"license allows %d modules and you have %d modules configured."
+"
Out of license limits This "
+"license allows %d modules, and you have %d modules configured."
#: ../../enterprise/load_enterprise.php:604
msgid ""
diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php
index 2d335ff7e7..f915a5093b 100755
--- a/pandora_console/operation/events/events.build_query.php
+++ b/pandora_console/operation/events/events.build_query.php
@@ -91,18 +91,20 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) {
$childrens_str = implode(',', $childrens_ids);
$sql_post .= " AND (id_grupo IN ($childrens_str)";
- if ($is_using_secondary_group === 1)
+ if ($is_using_secondary_group === 1) {
$sql_post .= " OR id_group IN ($childrens_str)";
+ }
- $sql_post .= ")";
+ $sql_post .= ')';
} else {
// If a group is selected and it's in the groups allowed.
$sql_post .= " AND (id_grupo = $id_group";
- if ($is_using_secondary_group === 1)
+ if ($is_using_secondary_group === 1) {
$sql_post .= " OR id_group = $id_group";
+ }
- $sql_post .= ")";
+ $sql_post .= ')';
}
} else {
if (!users_is_admin() && !users_can_manage_group_all('ER')) {
@@ -112,13 +114,12 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) {
implode(',', array_keys($groups)),
implode(',', array_keys($groups))
);
- }
- else {
+ } else {
$sql_post .= sprintf(
' AND (id_grupo IN (%s)) ',
implode(',', array_keys($groups))
);
- }
+ }
}
}