This commit is contained in:
Vanessa Gil 2015-03-10 17:09:31 +01:00
parent db6e59c9bb
commit 041e9c00bc
4 changed files with 32 additions and 24 deletions

View File

@ -51,6 +51,8 @@ $idItem = get_parameter('id_item', 0);
$pure = get_parameter('pure',0);
$schedule_report = get_parameter('schbutton', '');
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
if ($schedule_report != '') {
$id_user_task = 1;
@ -375,7 +377,7 @@ switch ($action) {
$table_aux->colspan[0][0] = 4;
$table_aux->data[0][0] = "<b>". __("Group") . "</b>";
$table_aux->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px');
$table_aux->data[0][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', false, 'width:150px', false, false, 'id_grupo', $strict_user);
$table_aux->data[0][2] = "<b>". __("Free text for search: ") . "</b>";
$table_aux->data[0][3] = html_print_input_text ("search", $search, '', 30, '', true);

View File

@ -381,26 +381,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR",
$returnAllGroup, true, $id_group, $keys_field);
if ($strict_user) {
foreach ($fields as $id => $group_name) {
$sql = "SELECT tags FROM tusuario_perfil WHERE id_usuario = '$id_user' AND id_grupo = $id";
$group_has_tag = db_get_value_sql ($sql);
if (!$group_has_tag) {
$sql_parent = "SELECT parent FROM tgrupo WHERE id_grupo = $id AND propagate = 1";
$id_parent = db_get_value_sql($sql_parent);
if ($id_parent) {
$sql_parent_aux = "SELECT tags FROM tusuario_perfil WHERE id_usuario = '$id_user' AND id_grupo = $id_parent";
$parent_has_tag = db_get_value_sql ($sql_parent_aux);
if ($parent_has_tag) {
unset($fields[$id]);
}
}
} else {
unset($fields[$id]);
}
}
$fields = users_get_strict_mode_groups($config['id_user'], $returnAllGroup);
}
$output = html_print_select ($fields, $name, $selected, $script,

View File

@ -875,4 +875,26 @@ function users_get_user_users($id_user = false, $privilege = "AR",
return $user_users;
}
function users_get_strict_mode_groups($id_user, $return_group_all) {
global $config;
$sql = "SELECT * FROM tusuario_perfil WHERE id_usuario = '".$id_user."' AND tags = ''";
$user_groups = db_get_all_rows_sql ($sql);
if ($user_groups == false) {
$user_groups = array();
}
$return_user_groups = array();
if ($return_group_all) {
$return_user_groups[0] = __('All');
}
foreach ($user_groups as $group) {
$return_user_groups[$group['id_grupo']] = groups_get_name ($group['id_grupo']);
}
return $return_user_groups;
}
?>

View File

@ -122,6 +122,8 @@ if (is_ajax()) {
return;
}
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
// Get the tags where the user have permissions in Events reading tasks
$tags = tags_get_user_tags($config['id_user'], 'ER');
@ -409,7 +411,6 @@ $table_advanced->rowclass[] = '';
$data = array();
$data[0] = __('User ack.') . $jump;
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
if ($strict_user) {
$user_users = array($config['id_user']=>$config['id_user']);
} else {
@ -511,8 +512,10 @@ $table->data = array();
$data = array();
$data[0] = __('Group') . '<br>';
$data[0] .= html_print_select_groups($config["id_user"], "ER", true,
'id_group', $id_group, '', '', 0, true, false, false, 'w130') . '<br>';
$data[0] .= html_print_select_groups($config["id_user"], "ER", true,
'id_group', $id_group, '', '', 0, true, false, false, 'w130', false, false, false, false, 'id_grupo', $strict_user). '<br>';
//**********************************************************************
// TODO
// This code is disabled for to enabled in Pandora 5.1