Added Vtiger/ViciDial role/user_level customization on sync

git-svn-id: svn://192.168.202.10@1321 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-01-27 11:21:51 +00:00
parent 80ec7ad35d
commit 527a6cd9ef
6 changed files with 101 additions and 10 deletions
+10
View File
@@ -104,6 +104,16 @@ cp /usr/src/astguiclient/trunk/extras/Vtiger510_vicidial_001_noclose.patch ./
patch -p1 < ./Vtiger510_vicidial_001_noclose.patch patch -p1 < ./Vtiger510_vicidial_001_noclose.patch
To link specific Vtiger Roles to ViciDial user levels, you need to find the Vtiger user Role code "H5, H4, etc..." and then run these MySQL queries to set the relationship:
INSERT INTO vtiger_vicidial_roles SET user_level='1',vtiger_role='H5';
INSERT INTO vtiger_vicidial_roles SET user_level='2',vtiger_role='H5';
INSERT INTO vtiger_vicidial_roles SET user_level='3',vtiger_role='H5';
INSERT INTO vtiger_vicidial_roles SET user_level='4',vtiger_role='H5';
INSERT INTO vtiger_vicidial_roles SET user_level='5',vtiger_role='H5';
INSERT INTO vtiger_vicidial_roles SET user_level='6',vtiger_role='H5';
INSERT INTO vtiger_vicidial_roles SET user_level='7',vtiger_role='H4';
INSERT INTO vtiger_vicidial_roles SET user_level='8',vtiger_role='H3';
INSERT INTO vtiger_vicidial_roles SET user_level='9',vtiger_role='H2';
Now to explain the database side of things. Now to explain the database side of things.
@@ -1891,6 +1891,11 @@ index (user),
index (campaign_id) index (campaign_id)
); );
CREATE TABLE vtiger_vicidial_roles (
user_level TINYINT(2),
vtiger_role VARCHAR(5)
);
ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP;
@@ -2028,7 +2033,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N
CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log; CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log;
UPDATE system_settings SET db_schema_version='1195',db_schema_update_date=NOW(); UPDATE system_settings SET db_schema_version='1196',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost; GRANT RELOAD ON *.* TO cron@localhost;
+7
View File
@@ -11,3 +11,10 @@ ALTER TABLE vicidial_users ADD voicemail_id VARCHAR(10) default '';
ALTER TABLE vicidial_inbound_dids ADD record_call ENUM('Y','N','Y_QUEUESTOP') default 'N'; ALTER TABLE vicidial_inbound_dids ADD record_call ENUM('Y','N','Y_QUEUESTOP') default 'N';
UPDATE system_settings SET db_schema_version='1195',db_schema_update_date=NOW(); UPDATE system_settings SET db_schema_version='1195',db_schema_update_date=NOW();
CREATE TABLE vtiger_vicidial_roles (
user_level TINYINT(2),
vtiger_role VARCHAR(5)
);
UPDATE system_settings SET db_schema_version='1196',db_schema_update_date=NOW();
+53 -2
View File
@@ -2048,11 +2048,12 @@ else
# 100116-0718 - Added presets to script select list # 100116-0718 - Added presets to script select list
# 100122-0747 - Added NOT-LOGGED-IN-AGENTS option for User Groups # 100122-0747 - Added NOT-LOGGED-IN-AGENTS option for User Groups
# 100123-1301 - Added DID record call option # 100123-1301 - Added DID record call option
# 100127-0601 - Added Vtiger ViciDial user_level role lookup
# #
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
$admin_version = '2.4-236'; $admin_version = '2.4-237';
$build = '100123-1301'; $build = '100127-0601';
$STARTtime = date("U"); $STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s"); $SQLdate = date("Y-m-d H:i:s");
@@ -8130,6 +8131,16 @@ if ($ADD=="2")
$salt = substr($user_name, 0, 2); $salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$'; $salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt); $encrypted_password = crypt($user_password, $salt);
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
###################################### ######################################
##### BEGIN Add/Update group info in Vtiger ##### BEGIN Add/Update group info in Vtiger
@@ -8412,6 +8423,16 @@ if ($ADD=="2A")
$salt = substr($user_name, 0, 2); $salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$'; $salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt); $encrypted_password = crypt($user_password, $salt);
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
###################################### ######################################
##### BEGIN Add/Update group info in Vtiger ##### BEGIN Add/Update group info in Vtiger
@@ -10525,6 +10546,16 @@ if ($ADD=="4A")
$salt = substr($user_name, 0, 2); $salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$'; $salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt); $encrypted_password = crypt($user_password, $salt);
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
###################################### ######################################
##### BEGIN Add/Update group info in Vtiger ##### BEGIN Add/Update group info in Vtiger
@@ -10758,6 +10789,16 @@ if ($ADD=="4B")
$salt = substr($user_name, 0, 2); $salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$'; $salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt); $encrypted_password = crypt($user_password, $salt);
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
###################################### ######################################
##### BEGIN Add/Update group info in Vtiger ##### BEGIN Add/Update group info in Vtiger
@@ -10985,6 +11026,16 @@ if ($ADD==4)
$salt = substr($user_name, 0, 2); $salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$'; $salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt); $encrypted_password = crypt($user_password, $salt);
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
###################################### ######################################
##### BEGIN Add/Update group info in Vtiger ##### BEGIN Add/Update group info in Vtiger
+17 -6
View File
@@ -3,12 +3,13 @@
# vicidial_users table into the Vtiger system as well as # vicidial_users table into the Vtiger system as well as
# the groups from VICIDIAL to Vtiger # the groups from VICIDIAL to Vtiger
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# CHANGES # CHANGES
# 81231-1307 - First build # 81231-1307 - First build
# 90228-2152 - Added Groups support # 90228-2152 - Added Groups support
# 90508-0644 - Changed to PHP long tags # 90508-0644 - Changed to PHP long tags
# 100127-0616 - Added Vtiger ViciDial user_level role lookup
# #
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
@@ -183,15 +184,25 @@ while ($i < $VD_users_ct)
$roleid = 'H5'; $roleid = 'H5';
$status = 'Active'; $status = 'Active';
$groupid = '1'; $groupid = '1';
if ($user_level[$i] >= 7) {$roleid = 'H4';} if ($user_level[$i] >= 7) {$roleid = 'H4';}
if ($user_level[$i] >= 8) {$roleid = 'H3';} if ($user_level[$i] >= 8) {$roleid = 'H3';}
if ($user_level[$i] >= 9) {$roleid = 'H2';} if ($user_level[$i] >= 9) {$roleid = 'H2';}
if ($user_level[$i] >= 9) {$is_admin = 'on';} if ($user_level[$i] >= 9) {$is_admin = 'on';}
if (ereg('N',$active[$i])) {$status = 'Inactive';} if (ereg('N',$active[$i])) {$status = 'Inactive';}
$salt = substr($user_name, 0, 2); $salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$'; $salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt); $encrypted_password = crypt($user_password, $salt);
$i++; $i++;
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
$j=0; $j=0;
$all_VICIDIAL_groups_SQL=''; $all_VICIDIAL_groups_SQL='';
@@ -3,13 +3,14 @@
# #
# Used for integration with QueueMetrics of audio recordings # Used for integration with QueueMetrics of audio recordings
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2007 Lenz Emilitri <lenz.loway@gmail.com> LICENSE: ???? # Copyright (C) 2007 Lenz Emilitri <lenz.loway@gmail.com> LICENSE: ????
# #
# CHANGES # CHANGES
# 90525-1141 - First build # 90525-1141 - First build
# 90529-2041 - Added Realtime monitoring # 90529-2041 - Added Realtime monitoring
# 91012-0641 - Fixed to work with non-sequential time_ids in the queue_log # 91012-0641 - Fixed to work with non-sequential time_ids in the queue_log
# 100127-0603 - Added OpenSuSE install instructions
# #
// $Id: xmlrpc_audio_server.php,v 1.3 2007/11/12 17:53:09 lenz Exp $ // $Id: xmlrpc_audio_server.php,v 1.3 2007/11/12 17:53:09 lenz Exp $
@@ -27,6 +28,12 @@
// IMPORTANT: // IMPORTANT:
// in order to run this, you must have the XML_RPC module that comes with the PEAR library // in order to run this, you must have the XML_RPC module that comes with the PEAR library
// correctly installed on your PHP server. See http://pear.php.net // correctly installed on your PHP server. See http://pear.php.net
// on OpenSuSE:
// sudo zypper install php5-pear
// sudo zypper install php5-pear-xml_rpc
// sudo zypper install php5-pear-xml_parser
// sudo zypper install php5-pear-xml_util
// on system with basic pear already installed:
// "pear install XML_RPC-1.5.1" // "pear install XML_RPC-1.5.1"
// //