Merge branch 'ent-3750-carrefour-api-crear-modificar-y-eliminar-perfiles-de-usuarios-metaconsola' into 'develop'
Commit para revisar progreso See merge request artica/pandorafms!2289 Former-commit-id: b8924b2fc0d151274809ab625fa840b27412d493
This commit is contained in:
commit
759a533180
|
@ -1205,4 +1205,6 @@ ui_require_javascript_file('pandora_modules');
|
||||||
$('.command_macro').click(macros_click_locked_event);
|
$('.command_macro').click(macros_click_locked_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -37,13 +37,10 @@ $api_password = get_parameter('apipass', '');
|
||||||
$password = get_parameter('pass', '');
|
$password = get_parameter('pass', '');
|
||||||
$user = get_parameter('user', '');
|
$user = get_parameter('user', '');
|
||||||
$info = get_parameter('info', '');
|
$info = get_parameter('info', '');
|
||||||
|
|
||||||
$other = parseOtherParameter($otherSerialize, $otherMode);
|
$other = parseOtherParameter($otherSerialize, $otherMode);
|
||||||
|
|
||||||
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
|
$apiPassword = io_output_password(db_get_value_filter('value', 'tconfig', ['token' => 'api_password']));
|
||||||
|
|
||||||
$correctLogin = false;
|
$correctLogin = false;
|
||||||
$user_in_db = null;
|
|
||||||
$no_login_msg = '';
|
$no_login_msg = '';
|
||||||
|
|
||||||
// Clean unwanted output
|
// Clean unwanted output
|
||||||
|
@ -107,7 +104,6 @@ if ($correctLogin) {
|
||||||
if ($op == 'set' && $id) {
|
if ($op == 'set' && $id) {
|
||||||
switch ($op2) {
|
switch ($op2) {
|
||||||
case 'update_agent':
|
case 'update_agent':
|
||||||
|
|
||||||
case 'add_module_in_conf':
|
case 'add_module_in_conf':
|
||||||
case 'update_module_in_conf':
|
case 'update_module_in_conf':
|
||||||
case 'delete_module_in_conf':
|
case 'delete_module_in_conf':
|
||||||
|
@ -149,8 +145,45 @@ if ($correctLogin) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case 'delete_user_permission':
|
||||||
|
|
||||||
|
if ($user_db === '') {
|
||||||
|
returnError(__('User or group not specified'), __('User, group not specified'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id_os = api_set_delete_user_profiles($thrash1, $thrash2, $other, $returnType);
|
||||||
|
|
||||||
|
if ($id_os != 100) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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($thrash1, $thrash2, $other, $returnType);
|
||||||
|
|
||||||
|
if ($id_os != 100) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id_os == false) {
|
||||||
|
returnError('not_allowed_operation_cluster', $returnType);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,6 @@ $module_field_column_mampping = [
|
||||||
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
|
'module_critical_inverse' => 'critical_inverse as module_critical_inverse',
|
||||||
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
|
'module_warning_inverse' => 'warning_inverse as module_warning_inverse',
|
||||||
];
|
];
|
||||||
|
|
||||||
// module related field mappings 2/2 (output field => column for 'tagente_estado')
|
// module related field mappings 2/2 (output field => column for 'tagente_estado')
|
||||||
// module_id_agent_modulo is not in this list
|
// module_id_agent_modulo is not in this list
|
||||||
$estado_fields_to_columns_mapping = [
|
$estado_fields_to_columns_mapping = [
|
||||||
|
@ -14729,3 +14728,365 @@ function api_set_reset_agent_counts($id, $thrash1, $thrash2, $thrash3)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Functions por get all user to new feature for Carrefour
|
||||||
|
* It depends of returnType, the method will return csv or json data
|
||||||
|
*
|
||||||
|
* @param string $thrash1 don't use
|
||||||
|
* @param string $thrash2 don't use
|
||||||
|
* @param array $other don't use
|
||||||
|
* *@param string $returnType
|
||||||
|
* Example:
|
||||||
|
* api.php?op=get&op2=list_all_user&return_type=json&apipass=1234&user=admin&pass=pandora
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function api_get_list_all_user($thrash1, $thrash2, $other, $returnType)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'AR')) {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT
|
||||||
|
tup.id_usuario AS user_id,
|
||||||
|
tu.fullname AS fullname,
|
||||||
|
tp.id_perfil AS profile_id,
|
||||||
|
tup.id_up AS id_up,
|
||||||
|
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
|
||||||
|
LEFT OUTER JOIN tusuario tu
|
||||||
|
ON tu.id_user = tup.id_usuario';
|
||||||
|
|
||||||
|
$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'],
|
||||||
|
'fullname' => $up['fullname'],
|
||||||
|
'id_up' => $up['id_up'],
|
||||||
|
'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 returnType, the method will return csv or json data
|
||||||
|
*
|
||||||
|
* @param string $thrash1 don't use
|
||||||
|
* @param string $thrash2 don't use
|
||||||
|
* @param array $other other[0] = user database
|
||||||
|
* @param string $returnType
|
||||||
|
* Example
|
||||||
|
* api.php?op=get&op2=info_user_name&return_type=json&other=admin&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function api_get_info_user_name($thrash1, $thrash2, $other, $returnType)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'AR')) {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT tup.id_usuario AS user_id,
|
||||||
|
tu.fullname AS fullname,
|
||||||
|
tup.id_up AS id_up,
|
||||||
|
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
|
||||||
|
LEFT OUTER JOIN tusuario tu
|
||||||
|
ON tu.id_user = tup.id_usuario
|
||||||
|
WHERE tup.id_usuario = "%s"',
|
||||||
|
io_safe_output($other['data'][0])
|
||||||
|
);
|
||||||
|
|
||||||
|
$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'],
|
||||||
|
'fullname' => $up['fullname'],
|
||||||
|
'id_up' => $up['id_up'],
|
||||||
|
'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 returnType, the method will return csv or json data.
|
||||||
|
*
|
||||||
|
* @param string $thrash1 don't use
|
||||||
|
* @param string $thrash2 don't use
|
||||||
|
* @param array $other
|
||||||
|
* $other[0] = id group
|
||||||
|
* $other[1] = is disabled or not
|
||||||
|
* @param string $returnType
|
||||||
|
* Example
|
||||||
|
* api.php?op=get&op2=filter_user_group&return_type=json&other=0|0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function api_get_filter_user_group($thrash1, $thrash2, $other, $returnType)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'AR')) {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter = '';
|
||||||
|
|
||||||
|
if ($other['data'][0] !== '' && $other['data'][1] !== '') {
|
||||||
|
$filter = 'WHERE tup.id_grupo = '.$other['data'][0].' AND tu.disabled = '.$other['data'][1].'';
|
||||||
|
} else if ($other['data'][0] !== '') {
|
||||||
|
$filter = 'WHERE tup.id_grupo = '.$other['data'][0].'';
|
||||||
|
} else if ($other['data'][1] !== '') {
|
||||||
|
$filter = 'WHERE tu.disabled = '.$other['data'][1].'';
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT DISTINCT
|
||||||
|
tup.id_usuario AS user_id,
|
||||||
|
tu.fullname AS fullname,
|
||||||
|
tup.id_up AS id_up,
|
||||||
|
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
|
||||||
|
LEFT OUTER JOIN tusuario tu
|
||||||
|
ON tu.id_user = tup.id_usuario
|
||||||
|
'.$filter.''
|
||||||
|
);
|
||||||
|
|
||||||
|
$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'],
|
||||||
|
'fullname' => $up['fullname'],
|
||||||
|
'id_up' => $up['id_up'],
|
||||||
|
'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 permission for Carrefour new feature
|
||||||
|
* The return of this function its only a message
|
||||||
|
*
|
||||||
|
* @param string $thrash1 don't use
|
||||||
|
* @param string $thrash2 don't use
|
||||||
|
* @param array $other
|
||||||
|
* $other[0] = id up
|
||||||
|
* @param string $returnType
|
||||||
|
* Example
|
||||||
|
* api.php?op=set&op2=delete_user_permission&return_type=json&other=user|2&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function api_set_delete_user_permission($thrash1, $thrash2, $other, $returnType)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($other['data'][0] != '') {
|
||||||
|
$values = [
|
||||||
|
'id_up' => io_safe_output($other['data'][0]),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
returnError('Error_delete', __('User profile could not be deleted.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 returnType, the method will return csv or json data
|
||||||
|
*
|
||||||
|
* @param string $thrash1 don't use
|
||||||
|
* @param string $thrash2 don't use
|
||||||
|
* @param array $other other[0] = user database
|
||||||
|
* other[1] = id group
|
||||||
|
* other[2] = id profile
|
||||||
|
* other[3] = no_hierarchy ( 0 or 1, if empty = 0)
|
||||||
|
* other[4] = id from tusuario_perfil table (optional)
|
||||||
|
* * @param string $returnType
|
||||||
|
* Example
|
||||||
|
* api.php?op=set&op2=add_permission_user_to_group&return_type=json&other=admin|0|1|1|20&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function api_set_add_permission_user_to_group($thrash1, $thrash2, $other, $returnType)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (!check_acl($config['id_user'], 0, 'AW')) {
|
||||||
|
returnError('forbidden', 'string');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'SELECT id_up
|
||||||
|
FROM tusuario_perfil
|
||||||
|
WHERE id_up = '.$other['data'][4].'';
|
||||||
|
|
||||||
|
$exist_profile = db_get_value_sql($sql);
|
||||||
|
|
||||||
|
if ($other['data'][3] < 0 || $other['data'][3] > 1) {
|
||||||
|
returnError('Error_insert', __('User profile could not be available.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($other['data'][3] == null) {
|
||||||
|
$other['data'][3] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = [
|
||||||
|
'id_usuario' => $other['data'][0],
|
||||||
|
'id_perfil' => $other['data'][2],
|
||||||
|
'id_grupo' => $other['data'][1],
|
||||||
|
'no_hierarchy' => $other['data'][3],
|
||||||
|
'assigned_by' => $config['id_user'],
|
||||||
|
'id_policy' => 0,
|
||||||
|
'tags' => '',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$where_id_up = ['id_up' => $other['data'][4]];
|
||||||
|
if ($exist_profile === $other['data'][4] && $where_id_up !== null) {
|
||||||
|
$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, ';');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -36481,8 +36481,8 @@ msgstr ""
|
||||||
#: ../../enterprise/load_enterprise.php:584
|
#: ../../enterprise/load_enterprise.php:584
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"<strong style=\"font-size: 11pt\">License out of limits</strong> <br><br> "
|
"<strong style=\"font-size: 11pt\">Out of license limits</strong> <br><br> "
|
||||||
"This node has a metaconsole license and it allows %d agents and you have %d "
|
"This node has a Metaconsole license that allows %d agents, and you have %d "
|
||||||
"agents cached."
|
"agents cached."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"<strong style=\"font-size: 11pt\">License expired</strong> <br><br> This "
|
"<strong style=\"font-size: 11pt\">License expired</strong> <br><br> This "
|
||||||
|
@ -36492,20 +36492,21 @@ msgstr ""
|
||||||
#: ../../enterprise/load_enterprise.php:592
|
#: ../../enterprise/load_enterprise.php:592
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"<strong style=\"font-size: 11pt\">License out of limits</strong> <br><br> "
|
"<strong style=\"font-size: 11pt\">Out of license limits</strong> <br><br> "
|
||||||
"This license allows %d agents and you have %d agents configured."
|
"This node has a Metaconsole license that allows %d agents, and you have %d "
|
||||||
|
"agents configured."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"<strong style=\"font-size: 11pt\">License expired</strong> <br><br> This "
|
"<strong style=\"font-size: 11pt\">License expired</strong> <br><br> 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
|
#: ../../enterprise/load_enterprise.php:597
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"<strong style=\"font-size: 11pt\">License out of limits</strong> <br><br> "
|
"<strong style=\"font-size: 11pt\">Out of license limits</strong> <br><br> "
|
||||||
"This license allows %d modules and you have %d modules configured."
|
"This license allows %d modules and you have %d modules configured."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"<strong style=\"font-size: 11pt\">License expired</strong> <br><br> This "
|
"<strong style=\"font-size: 11pt\">Out of license limits</strong> <br><br> This "
|
||||||
"license allows %d modules and you have %d modules configured."
|
"license allows %d modules, and you have %d modules configured."
|
||||||
|
|
||||||
#: ../../enterprise/load_enterprise.php:604
|
#: ../../enterprise/load_enterprise.php:604
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
|
@ -91,18 +91,20 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) {
|
||||||
$childrens_str = implode(',', $childrens_ids);
|
$childrens_str = implode(',', $childrens_ids);
|
||||||
$sql_post .= " AND (id_grupo IN ($childrens_str)";
|
$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 .= " OR id_group IN ($childrens_str)";
|
||||||
|
}
|
||||||
|
|
||||||
$sql_post .= ")";
|
$sql_post .= ')';
|
||||||
} else {
|
} else {
|
||||||
// If a group is selected and it's in the groups allowed.
|
// If a group is selected and it's in the groups allowed.
|
||||||
$sql_post .= " AND (id_grupo = $id_group";
|
$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 .= " OR id_group = $id_group";
|
||||||
|
}
|
||||||
|
|
||||||
$sql_post .= ")";
|
$sql_post .= ')';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!users_is_admin() && !users_can_manage_group_all('ER')) {
|
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)),
|
||||||
implode(',', array_keys($groups))
|
implode(',', array_keys($groups))
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sql_post .= sprintf(
|
$sql_post .= sprintf(
|
||||||
' AND (id_grupo IN (%s)) ',
|
' AND (id_grupo IN (%s)) ',
|
||||||
implode(',', array_keys($groups))
|
implode(',', array_keys($groups))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue