Fix for user group permissions in Uer Logins Report

Fix for loading internal chat while agent screen is still loading

git-svn-id: svn://192.168.202.10@3643 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2022-09-22 14:36:46 +00:00
parent eb5f22761d
commit c62422ce75
4 changed files with 47 additions and 17 deletions
@@ -19,10 +19,11 @@
# 210616-2056 - Added optional CORS support, see options.php for details # 210616-2056 - Added optional CORS support, see options.php for details
# 220220-0855 - Added allow_web_debug system setting # 220220-0855 - Added allow_web_debug system setting
# 220518-2210 - Small fix for encrypted auth # 220518-2210 - Small fix for encrypted auth
# 220922-1027 - Added BLANK action for first agent screen page load
# #
$admin_version = '2.14-12'; $admin_version = '2.14-13';
$build = '220220-0855'; $build = '220922-1027';
$php_script = 'agc_agent_manager_chat_interface.php'; $php_script = 'agc_agent_manager_chat_interface.php';
$sh="managerchats"; $sh="managerchats";
@@ -94,6 +95,12 @@ if (file_exists('options.php'))
require_once('options.php'); require_once('options.php');
} }
if ($action == 'BLANK')
{
header ("Content-type: text/html; charset=utf-8");
exit;
}
$auth=0; $auth=0;
$auth_message = user_authorization($user,$pass,'',0,1,0,0,'chat'); $auth_message = user_authorization($user,$pass,'',0,1,0,0,'chat');
if ($auth_message == 'GOOD') if ($auth_message == 'GOOD')
+4 -4
View File
@@ -139,7 +139,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur
if ($failed_login_count < $LOCK_trigger_attempts) if ($failed_login_count < $LOCK_trigger_attempts)
{ {
$stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_ip_today='$ip',failed_last_type_today='cBAD' where user='$user';"; $stmt="UPDATE vicidial_users set failed_login_count=(failed_login_count+1),failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_ip_today='$ip',failed_last_type_today='01cBAD' where user='$user';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05011',$user,$server_ip,$session_name,$one_mysql_log);} if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05011',$user,$server_ip,$session_name,$one_mysql_log);}
} }
@@ -147,14 +147,14 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur
{ {
if ($LOCK_over > $last_login_date) if ($LOCK_over > $last_login_date)
{ {
$stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,failed_last_ip_today='$ip',failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_type_today='cBAD' where user='$user';"; $stmt="UPDATE vicidial_users set last_login_date=NOW(),failed_login_count=1,failed_last_ip_today='$ip',failed_login_attempts_today=(failed_login_attempts_today+1),failed_login_count_today=(failed_login_count_today+1),failed_last_type_today='02cBAD' where user='$user';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05012',$user,$server_ip,$session_name,$one_mysql_log);} if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05012',$user,$server_ip,$session_name,$one_mysql_log);}
} }
else else
{ {
$auth_key='LOCK'; $auth_key='LOCK';
$stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='cLOCK' where user='$user';"; $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='03cLOCK' where user='$user';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05027',$user,$server_ip,$session_name,$one_mysql_log);} if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05027',$user,$server_ip,$session_name,$one_mysql_log);}
} }
@@ -330,7 +330,7 @@ function user_authorization($user,$pass,$user_option,$user_update,$bcrypt,$retur
} }
else else
{ {
$stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='c$auth_key' where user='$user';"; $stmt="UPDATE vicidial_users set failed_login_attempts_today=(failed_login_attempts_today+1),failed_last_type_today='04c$auth_key' where user='$user';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05028',$user,$server_ip,$session_name,$one_mysql_log);} if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05028',$user,$server_ip,$session_name,$one_mysql_log);}
} }
+7 -3
View File
@@ -700,10 +700,11 @@
# 220901-1330 - Fix for issues with manager validation where manager has a long password # 220901-1330 - Fix for issues with manager validation where manager has a long password
# 220908-0819 - Small change for user_group_script override # 220908-0819 - Small change for user_group_script override
# 220916-0906 - Added INSERT_before_body_close options.php setting, Issue #1375 # 220916-0906 - Added INSERT_before_body_close options.php setting, Issue #1375
# 220922-1032 - Fix for loading internal chat while agent screen is still loading
# #
$version = '2.14-668c'; $version = '2.14-669c';
$build = '220916-0906'; $build = '220922-1032';
$php_script = 'vicidial.php'; $php_script = 'vicidial.php';
$mel=1; # Mysql Error Log enabled = 1 $mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=98; $mysql_log_count=98;
@@ -20919,11 +20920,14 @@ function phone_number_format(formatphone) {
divref = document.getElementById(divvar).style; divref = document.getElementById(divvar).style;
divref.visibility = 'hidden'; divref.visibility = 'hidden';
if (divvar == 'InternalChatPanel') // Clear the manager chat panel to prevent incoming messages from immediately being marked as read if (divvar == 'InternalChatPanel') // Clear the manager chat panel to prevent incoming messages from immediately being marked as read
{
if (check_n > 3)
{ {
document.getElementById('InternalChatIFrame').src='./agc_agent_manager_chat_interface.php?user='+user+'&pass='+pass; document.getElementById('InternalChatIFrame').src='./agc_agent_manager_chat_interface.php?user='+user+'&pass='+pass;
} }
} }
} }
}
function clearDiv(divvar) function clearDiv(divvar)
{ {
if (document.getElementById(divvar)) if (document.getElementById(divvar))
@@ -22290,7 +22294,7 @@ if ($agent_display_dialable_leads > 0)
if ($webphone_location == 'bar') if ($webphone_location == 'bar')
{echo "<img src=\"./images/"._QXZ("pixel.gif")."\" width=\"1px\" height=\"".$webphone_height."px\" /><br />\n";} {echo "<img src=\"./images/"._QXZ("pixel.gif")."\" width=\"1px\" height=\"".$webphone_height."px\" /><br />\n";}
?> ?>
<table border="0" bgcolor="<?php echo $SCRIPT_COLOR ?>" width="<?php echo $SSwidth ?>px" height="<?php echo $SSheight ?>px"><tr><td align="left" valign="top"><font class="sb_text"><div class="noscroll_form" id="InternalChatContents"><iframe src="./agc_agent_manager_chat_interface.php?user=<?php echo $VD_login; ?>&pass=<?php echo $VD_pass; ?>" style="background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="InternalChatIFrame" name="InternalChatIFrame" width="<?php echo $SDwidth ?>px" height="<?php echo $SSheight ?>px" STYLE="z-index:<?php $zi++; echo $zi ?>"> </iframe></div></font></td></tr></table> <table border="0" bgcolor="<?php echo $SCRIPT_COLOR ?>" width="<?php echo $SSwidth ?>px" height="<?php echo $SSheight ?>px"><tr><td align="left" valign="top"><font class="sb_text"><div class="noscroll_form" id="InternalChatContents"><iframe src="./agc_agent_manager_chat_interface.php?action=BLANK" style="background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="InternalChatIFrame" name="InternalChatIFrame" width="<?php echo $SDwidth ?>px" height="<?php echo $SSheight ?>px" STYLE="z-index:<?php $zi++; echo $zi ?>"> </iframe></div></font></td></tr></table>
</span> </span>
@@ -4,7 +4,8 @@
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# CHANGES # CHANGES
# 110514-1231 - First build # 220921-2203 - First build
# 220922-1031 - Fix for user group permissions
# #
$startMS = microtime(); $startMS = microtime();
@@ -173,6 +174,24 @@ if ( (!preg_match('/\-ALL/i', $LOGallowed_campaigns)) )
} }
$regexLOGallowed_campaigns = " $LOGallowed_campaigns "; $regexLOGallowed_campaigns = " $LOGallowed_campaigns ";
$admin_viewable_groupsALL=0;
$LOGadmin_viewable_groupsSQL='';
$whereLOGadmin_viewable_groupsSQL='';
$valLOGadmin_viewable_groupsSQL='';
$vmLOGadmin_viewable_groupsSQL='';
if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) )
{
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
$valLOGadmin_viewable_groupsSQL = "and val.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
$vmLOGadmin_viewable_groupsSQL = "and vm.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
}
else
{$admin_viewable_groupsALL=1;}
$regexLOGadmin_viewable_groups = " $LOGadmin_viewable_groups ";
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{ {
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
@@ -237,7 +256,7 @@ if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_
$MAIN.="<!-- Using slave server $slave_db_server $db_source -->\n"; $MAIN.="<!-- Using slave server $slave_db_server $db_source -->\n";
} }
$stmt="select user,full_name from vicidial_users order by user;"; $stmt="select user,full_name from vicidial_users $whereLOGadmin_viewable_groupsSQL order by user;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysqli_num_rows($rslt); $campaigns_to_print = mysqli_num_rows($rslt);
@@ -269,7 +288,7 @@ $NWE = "')\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP>";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n"; echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"vicidial_stylesheet.php\">\n"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"vicidial_stylesheet.php\">\n";
echo "<script language=\"JavaScript\" src=\"help.js\"></script>\n"; echo "<script language=\"JavaScript\" src=\"help.js\"></script>\n";
echo "<TITLE>"._QXZ("Campaign Debug")."</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n"; echo "<TITLE>"._QXZ("$report_name")."</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<div id='HelpDisplayDiv' class='help_info' style='display:none;'></div>"; echo "<div id='HelpDisplayDiv' class='help_info' style='display:none;'></div>";
$short_header=1; $short_header=1;
@@ -312,16 +331,16 @@ if (!$user)
else else
{ {
$multi_user=0; $multi_user=0;
$stmt="select user,login_day,last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_user_logins_daily where user='" . mysqli_real_escape_string($link, $user) . "' order by login_day desc limit 1000;"; $stmt="select vuld.user,vuld.login_day,vuld.last_login_date,vuld.last_ip,vuld.failed_login_attempts_today,vuld.failed_login_count_today,vuld.failed_last_ip_today,vuld.failed_last_type_today from vicidial_user_logins_daily vuld, vicidial_users vm where vuld.user='" . mysqli_real_escape_string($link, $user) . "' and vm.user=vuld.user $vmLOGadmin_viewable_groupsSQL order by login_day desc limit 1000;";
if ($user == '--MOST-RECENT-ACTIVE-ARCHIVE--') if ($user == '--MOST-RECENT-ACTIVE-ARCHIVE--')
{ {
$multi_user=1; $multi_user=1;
$stmt="select user,login_day,last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_user_logins_daily order by login_day desc, last_login_date desc limit 1000;"; $stmt="select vuld.user,vuld.login_day,vuld.last_login_date,vuld.last_ip,vuld.failed_login_attempts_today,vuld.failed_login_count_today,vuld.failed_last_ip_today,vuld.failed_last_type_today from vicidial_user_logins_daily vuld, vicidial_users vm where vm.user=vuld.user $vmLOGadmin_viewable_groupsSQL order by login_day desc, last_login_date desc limit 1000;";
} }
if ($user == '--MOST-RECENT-ACTIVE-TODAY--') if ($user == '--MOST-RECENT-ACTIVE-TODAY--')
{ {
$multi_user=1; $multi_user=1;
$stmt="select user,'TODAY',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where last_login_date >= \"$last_midnight\" order by last_login_date desc limit 1000;"; $stmt="select user,'TODAY',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where last_login_date >= \"$last_midnight\" $LOGadmin_viewable_groupsSQL order by last_login_date desc limit 1000;";
} }
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
@@ -350,7 +369,7 @@ else
} }
if ($multi_user < 1) if ($multi_user < 1)
{ {
$stmt="select user,'TODAY',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where user='" . mysqli_real_escape_string($link, $user) . "' and last_login_date >= \"$last_midnight\" order by last_login_date desc limit 1000;"; $stmt="select user,'TODAY',last_login_date,last_ip,failed_login_attempts_today,failed_login_count_today,failed_last_ip_today,failed_last_type_today from vicidial_users where user='" . mysqli_real_escape_string($link, $user) . "' and last_login_date >= \"$last_midnight\" $LOGadmin_viewable_groupsSQL order by last_login_date desc limit 1000;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$shortages_to_print = mysqli_num_rows($rslt); $shortages_to_print = mysqli_num_rows($rslt);