Non-admin operator not connecting

Last post 11-08-2011, 11:29 AM by GStoneJHA. 6 replies.
Sort Posts: Previous Next
  •  11-07-2011, 3:29 AM 71193

    Non-admin operator not connecting

    Hi, 
     
    I am having an issue with live support client application.  I have had no trouble in getting the system to work if I set all operators as admin users.  However, when I set an operator to non-admin, I get the following error... 
     
    Failed to connect to chat service:
      System.Exception: CONNECTION:ERROR, Require Agent
        at LiveSupport.ChatClient.Connect(Boolean now)
        at LiveSupport.MyApp.Run()
     
    I am running everything locally, i.e. the site is in development mode locally, the database is local and the client runs locally all on a MS Windows 7 machine.
     
    I have written the following provider to eliminate any problems in my original code.  The problem still exists with this provider though.
     
    public override string GetConnectionString()
    {  
          return System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
    }  
     
    public override AppChatIdentity GetLogonIdentity()
    {  
          HttpContext oContext = HttpContext.Current;  
          return new AppChatIdentity("testuser1", false, ToUserId("testuser1"), oContext.Request.UserHostAddress);
    }  
     
    public override string FindUserLoginName(string sFullName)
    {  
          return "testuser1";
    }   
     
    public override bool GetUserInfo(string sUsername, ref string sFullName, ref bool bIsAdmin)
    {
          sUsername =  "testuser1";
          sFullName =  "Test User 1";
          bIsAdmin =  false;  
          return true;
    }   
     
    public override bool ValidateUser(string sUsername, string sPassword)
    {  
          return true;
    }
    The first time I try to connect I get the error.  If I then change the line bIsAdmin = false to true, then run the operator connects and the application runs with admin privileges.  If, I then change the code back to bIsAdmin = false, and log in to the operator client again, the user can then log in as a non-admin operator.
     
    Please could anyone advise me on this?
     
    Thank you.
  •  11-07-2011, 8:22 AM 71195 in reply to 71193

    Re: Non-admin operator not connecting

    Hi GStoneJHA,
     
    # 1
    Open datatable "CuteChat4_User". If this table has the user name below(red part), it should not get this error.
     
    If isAdmin set to ture. It will not check the name, so did not get this error.
     
    public override AppChatIdentity GetLogonIdentity()
    {  
          HttpContext oContext = HttpContext.Current;  
          return new AppChatIdentity("testuser1", false, ToUserId("testuser1"), oContext.Request.UserHostAddress);
    }  
     
    # 2
     
    Do not need to set the first paratemer (red part)  in the method below
     
    public override bool GetUserInfo(string sUsername, ref string sFullName, ref bool bIsAdmin)
    {
          sUsername =  "testuser1";
          sFullName =  "Test User 1";
          bIsAdmin =  false;  
          return true;
    }  
     
    Regards,
     
    Ken
  •  11-08-2011, 3:49 AM 71215 in reply to 71195

    Re: Non-admin operator not connecting

    Hi Ken,
     
    Thanks for the reply.
     
    I tried what you have suggested by manually adding a record in to the CuteChat4_User table with the values UserId = 'User:usertest1', DisplayName='Test User 1'.  I ran the system again and tried to log in but I still got the same error.  So I removed the record that I added.
     
    I then ran a trace on the database to see what calls were going to the database and noticed that there was a read from the CuteSoft4_SupportAgent table.  So, I added a record manually in to this table with values DepartmentId=1, UserId='User:usertest1'.  I then tried to log in but still got the error.  It wasn't until I restarted the whole website that I was able to log in.  It would appear that the code seems to cache data, is this correct?
     
    Does this mean that every time I wish to add an operator, I would need to add a row to the CuteSoft4_SupportAgent table then restart the website?
     
    Also, is there anywhere in the system currently, which I am missing, that allows you to add operators and the correct data is added to the database?
     
    Your help is appreciated.
  •  11-08-2011, 8:19 AM 71226 in reply to 71215

    Re: Non-admin operator not connecting

    Hi GStoneJHA,
     
    CuteLiveSupoprt will save the data automatically. So you do not need to add it one by one manually.
     
    Regards,
     
    Ken
  •  11-08-2011, 10:20 AM 71228 in reply to 71226

    Re: Non-admin operator not connecting

    Hi Ken,
     
    Sorry, I don't understand your reply.  The system errors if a record does not exist in the CuteSoft4_SupportAgent table for a user which is non-admin.  This is read by the operator client when the user logs in. 
     
    Do you mean that there is a way of adding operators to the system if you are logged in as an admin user?  I have tried to add an operator by right-clicking the department and selecting 'Add agent to this department'.  However, when I did this, the user drop down was empty and if I typed a name in there, a blank userid was created.
     
    In my case, I have managed to produce a workaround.  Within the provider, I now insert a row to the CuteSoft4_SupportAgent table in the ValidateUser method, only if the user is valid and not an admin user (the client app inserts the record automatically for admin users).  This prevents the client from falling over and it opens correctly with the rights of a non-admin operator.  I don't like inserting in to or modifying data tables used specifically for third party components, so this is not an ideal solution.
     
    Please let me know if I am missing anything or my workaround would cause any issues.
     
    Thanks.
  •  11-08-2011, 10:56 AM 71229 in reply to 71228

    Re: Non-admin operator not connecting

    Hi GStoneJHA,
     
    1. In your case, I think you will need to integration with your own membership system.

    2. What I mean integration must finish all steps at http://www.cutesoft.net/live-support/Developer-Guide/scr/DeploymentIntegration.htm
     
    3. After the steps above, you can login the operator as administrator, then right click on the department name to add an agent into the department.
     
    4. The CuteLiveSupport will use the chat provider method below to find the user which you fill. If has this user, add into the department, if not, return fail(can't find).
     
       public override string FindUserLoginName(string nickName)
     
    5. In your chat provider, you alwoay return "testuser1". So at point 3 above, can not add any agnet into the department.
     
    Regards,
     
    Ken
  •  11-08-2011, 11:29 AM 71230 in reply to 71229

    Re: Non-admin operator not connecting

    Thank you, I am now able to add operators.
     
    I have reverted my code to my own membership system and entered the correct code required in the FindUserLoginName method.  This is what I was missing. 
     
    Thanks again.
View as RSS news feed in XML