Author Topic: Vtiger integration login/logout  (Read 6777 times)

Offline Mel

  • Newbie
  • *
  • Posts: 3
Vtiger integration login/logout
« on: February 04, 2015, 07:51:10 AM »
Hi,

my apologies if this is the wrong forum as I am new here.

I purchased a vtiger roundcube integration from a third party provider about six months ago, but it seems they have stopped developing it or dealing with issues related to their vtiger versions, as have now integrated it in to their own software and appear to be pushing the sale of that instead. For me its not an option to move to theor new solution as have invested heavily in Vtiger. I don't mind that they are moving to their own application, but its left those of us who purchased their original roundcube integration a bit stumped (and it wasn't cheap).

My question is this. I am largely happy with the integration, but there is one massive flaw, andyone who logs in is automatically presented with the last logged in users emails. I did originally have auto login set, but thought this was the problem so switched it off. I tried extending the session from 10 to much higher numbers but this didn't make a difference.

I think the problem would be addressed if I could set it so that when a user logs out of Vtiger, they are also logged out automatically from the integrated Roundcube instance. I have asked the developer about this issue but they said they don't have a solution for vtiger (I am assuming its ok in their new system).

Being new to roundcube I am not sure where to start. Does anyone know how to address this?

Thanks in advance

Mel



Offline GO3LIN

  • Newbie
  • *
  • Posts: 8
Re: Vtiger integration login/logout
« Reply #1 on: March 26, 2015, 08:05:03 AM »
Hello,

I'm working on integrating vtiger with roundcube too, I have found the third party integration called VGS global, but their autocomplete system is just like what you said (autocomplete can fetch emails from all user not only the user who's logged in). To solve this go to the roundcube plugins folder, you'll find a plugin called vtcontacts inside its folder open the file vtcontacts_backend.php in this file

//         $result=$rcmail->db->query("SELECT accountid, accountname, email1 FROM vtiger_account
// WHERE accountname like '%$value%' OR email1 like '%$value%'
// AND email1 !=''");

as you can see the query didnt check for the current user, here's the query i'm using but I have made some web services modifications to get the current_user

   $accounts_query = "SELECT vtiger_account.accountid, vtiger_account.accountname, vtiger_account.email1 FROM vtiger_account
   inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_account.accountid
   inner join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid
   left join vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid
   WHERE vtiger_crmentity.deleted = 0
   AND vtiger_users.user_name = '$current_user_name'
   AND vtiger_account.accountname like '%$searchQuery%'
       OR vtiger_account.email1 like '%$searchQuery%'
   AND vtiger_account.email1 != ''";

Offline Mel

  • Newbie
  • *
  • Posts: 3
Re: Vtiger integration login/logout
« Reply #2 on: May 14, 2015, 08:22:58 AM »
Hi GO3LIN,

thanks for responding. I only just discovered your response.

Did you get it to work in the end? I don't actually have that plugin file in my roundcube plugins folder. I have searched the plugins downloads on here and cannot find it - maybe it is unique to VGS Global's setup?

I was wondering if it were possible to add some code to vtiger's logout, basically saying if user logs out of vtiger then it automatically ends the roundcube session. Only problem is, I wouldn't know how to add this code.

Mel

Offline GO3LIN

  • Newbie
  • *
  • Posts: 8
Re: Vtiger integration login/logout
« Reply #3 on: May 14, 2015, 10:20:16 AM »
Hello,

I have discarded using the VGS integration because it has a lot of security issues. Which version of vtiger are you using?
In /modules/Users/Logout.php file there's a line where the session is destroyed like this :
Code: [Select]
// clear out the autthenticating flag
session_destroy();

Try adding this line after before the session_destroy function :
Code: [Select]
unset($_SESSION);
Explanation : the session_destroy didn't delete session variable it just end the session, vars can be found again when the session starts the next time when the second user log in.
« Last Edit: May 15, 2015, 10:17:16 AM by GO3LIN »

Offline Mel

  • Newbie
  • *
  • Posts: 3
Re: Vtiger integration login/logout
« Reply #4 on: October 03, 2015, 12:12:07 PM »
Hi Go3lin,

It doesn't seem to work for me. I am using vtiger 6.2. The file logout.php is located in the /modules/Users/actions/logout.php folder. This contains the following short piece of code:

class Users_Logout_Action extends Vtiger_Action_Controller {

   function checkPermission(Vtiger_Request $request) {
      return true;
   }

   function process(Vtiger_Request $request) {
      session_regenerate_id(true); // to overcome session id reuse.
Vtiger_Session::destroy();
      
      //Track the logout History
      $moduleName = $request->getModule();
      $moduleModel = Users_Module_Model::getInstance($moduleName);
      $moduleModel->saveLogoutHistory();
      //End
      
      header ('Location: index.php');
   }
}

I added the code you suggested, but unfortunately it didn't have any effect. Did it work for you? I am using OSSMail but they no longer support it.