2013-06-18 Miguel de Dios <miguel.dedios@artica.es>

* operation/menu.php: showed the message entry in workspace menu for
	all users.
	
	* include/functions_groups.php: added filters into the function
	"groups_get_users" for to avoid to get user without perms.
	
	* operation/messages/message_edit.php: fixed the ACL for to
	destination users.
	
	MERGED FROM THE BRANCH PANDORA_4.0




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8347 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-06-18 11:38:54 +00:00
parent 83c36c5201
commit bec330faaf
4 changed files with 65 additions and 30 deletions

View File

@ -1,3 +1,16 @@
2013-06-18 Miguel de Dios <miguel.dedios@artica.es>
* operation/menu.php: showed the message entry in workspace menu for
all users.
* include/functions_groups.php: added filters into the function
"groups_get_users" for to avoid to get user without perms.
* operation/messages/message_edit.php: fixed the ACL for to
destination users.
MERGED FROM THE BRANCH PANDORA_4.0
2013-06-18 Ramon Novoa <rnovoa@artica.es>
* include/functions.php: Fixed a warning.

View File

@ -357,7 +357,7 @@ function groups_is_all_group($idGroups) {
break;
}
}
return $returnVar;
}
@ -603,22 +603,26 @@ function groups_get_users ($id_group, $filter = false) {
$filter['id_grupo'] = $id_group;
$resulta = array();
$resulta = db_get_all_rows_filter ("tusuario_perfil", $filter);
$result_a = array();
if (!is_array($id_group) && !empty($id_group)) {
$result_a = db_get_all_rows_filter ("tusuario_perfil", $filter);
}
// The users of the group All (0) will be also returned
$filter['id_grupo'] = 0;
$resultb = array();
$resultb = db_get_all_rows_filter ("tusuario_perfil", $filter);
$result_b = array();
if ($return_user_all) {
// The users of the group All (0) will be also returned
$filter['id_grupo'] = 0;
$result_b = db_get_all_rows_filter ("tusuario_perfil", $filter);
}
if ($resulta == false && $resultb == false)
if ($result_a == false && $result_b == false)
$result = false;
elseif ($resulta == false)
$result = $resultb;
elseif ($resultb == false)
$result = $resulta;
elseif ($result_a == false)
$result = $result_b;
elseif ($result_b == false)
$result = $result_a;
else
$result = array_merge($resulta,$resultb);
$result = array_merge($result_a, $result_b);
if ($result === false)
return array ();
@ -1353,7 +1357,7 @@ function groups_total_agents ($group_array, $disabled = false) {
return 0;
}
else if (!is_array ($group_array)){
else if (!is_array ($group_array)) {
$group_array = array($group_array);
}
@ -1393,5 +1397,4 @@ function groups_agent_disabled ($group_array) {
return db_get_sql ($sql);
}
?>

View File

@ -26,7 +26,7 @@ $menu_operation = array ();
$menu_operation['class'] = 'operation';
// Agent read, Server read
if (check_acl ($config['id_user'], 0, "AR")) {
if (check_acl ($config['id_user'], 0, "AR")) {
//View agents
$menu_operation["estado"]["text"] = __('Monitoring');
$menu_operation["estado"]["sec2"] = "operation/agentes/tactical";
@ -283,6 +283,7 @@ $sub["operation/users/user_edit"]["refr"] = 0;
$sub["operation/users/webchat"]["text"] = __('WebChat');
$sub["operation/users/webchat"]["refr"] = 0;
//Incidents
if (check_acl ($config['id_user'], 0, "IR") == 1) {
$temp_sec2 = $sec2;
@ -306,17 +307,15 @@ if (check_acl ($config['id_user'], 0, "IR") == 1) {
$sec2 = $temp_sec2;
}
if (check_acl ($config['id_user'], 0, "AR")) {
// Messages
$sub["operation/messages/message_list"]["text"] = __('Messages');
$sub["operation/messages/message_list"]["refr"] = 0;
$sub2 = array ();
$sub2["operation/messages/message_edit&amp;new_msg=1"]["text"] = __('New message');
$sub["operation/messages/message_list"]["sub2"] = $sub2;
}
// Messages
$sub["operation/messages/message_list"]["text"] = __('Messages');
$sub["operation/messages/message_list"]["refr"] = 0;
$sub2 = array ();
$sub2["operation/messages/message_edit&amp;new_msg=1"]["text"] = __('New message');
$sub["operation/messages/message_list"]["sub2"] = $sub2;
$menu_operation["workspace"]["sub"] = $sub;

View File

@ -37,11 +37,11 @@ $buttons['message_list'] = array('active' => false,
$buttons['sent_messages'] = array('active' => false,
'text' => '<a href="index.php?sec=workspace&sec2=operation/messages/message_list&amp;show_sent=1">' .
html_print_image("images/email_outbox.png", true, array ("title" => __('Sent messages'))) .'</a>');
$buttons['create_message'] = array('active' => true,
'text' => '<a href="index.php?sec=workspace&sec2=operation/messages/message_edit">' .
html_print_image("images/new_message.png", true, array ("title" => __('Create message'))) .'</a>');
// Header
ui_print_page_header (__('Messages'), "images/email_mc.png", false, "", false, $buttons);
@ -129,6 +129,7 @@ if (($new_msg) && (!empty ($dst_user)) && (!$reply)) {
if (!$user_name) {
$user_name = $dst_user;
}
ui_print_result_message ($return,
__('Message successfully sent to user %s', $user_name),
__('Error sending message to user %s', $user_name));
@ -163,12 +164,31 @@ else {
$table->data[1][0] = __('Destination');
$users_full = groups_get_users (array_keys(users_get_groups()));
$is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
if ($is_admin) {
$users_full = db_get_all_rows_filter('tusuario', array(), array('id_user', 'fullname'));
}
else {
$users_full = groups_get_users (array_keys(users_get_groups()), false, false);
}
$users = array();
foreach ($users_full as $user_id => $user_info) {
$users[$user_info['id_user']] = $user_info['fullname'];
}
//Check if the user to reply is in the list, if not add reply user
if ($reply) {
if (!array_key_exists($dst_user, $users)) {
//Add the user to reply
$user_reply = db_get_row('tusuario', 'id_user', $dst_user);
$users[$user_reply['id_user']] = $user_reply['fullname'];
}
}
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$return_all_groups = true;
else