Moderator Message Queue not working with single sign on

Last post 06-16-2011, 6:12 AM by RafalL. 10 replies.
Sort Posts: Previous Next
  •  12-05-2007, 10:18 AM 35664

    Moderator Message Queue not working with single sign on

    I have tried implementing the membership database integration using the steps located @ http://cutesoft.net/ASP.NET+Chat/Developer-Guide/scr/DeploymentIntegration.htm .   I have tested the chat room as a moderator and here are the list of issues i noticed:
     
    • the first thing i noticed is that my friend helping me test did not see the hammer (indicating moderator) beside my name when he entered the room, yet i can see it on my screen. 
    • When i try to kick him i am getting the error: "INVALIDTARGET"
    • When I open moderate mode, the moderator message queue window opens, but when the normal user types anything in the channel it does not appear.  If I (the moderator) leave the room and come back, then i can see the messages he previously typed, but will not see any new ones until i leave and come back again.
    Here is what is currently in my global.asax:

    namespace SamplePortal4

    {

    public class Global : System.Web.HttpApplication

    {

    protected void Application_Start(object sender, EventArgs e)

    {

    CuteChat.ChatProvider.Instance = new AspNetChatProvider();

    CuteChat.ChatSystem.Start(new CuteChat.AppSystem());

    }

    protected void Application_End(object sender, EventArgs e)

    {

    }

    }

    public class AspNetChatProvider : CuteChat.ChatProvider

    {

    public override AppChatIdentity GetLogonIdentity()

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    return new AppChatIdentity(userInfo.UserName, false, Convert.ToString(userInfo.ConsumerID), HttpContext.Current.Request.UserHostAddress);

    }

    public override string FindUserLoginName(string nickName)

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    return userInfo.UserName;

    }

    public override bool IsLobbyAdmin(IChatLobby lobby, string userid)

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    if (userInfo.Roles.Contains("ChatModerator"))

    {

    return true;

    }

    return false;

    }

    public override bool GetUserInfo(string loginName, ref string nickName)

    {

    return true;

    }

    public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    nickName = userInfo.UserName;

    if (userInfo.Roles.Contains("ChatModerator"))

    {

    isAdmin = true;

    }

    else

    {

    isAdmin = false;

    }

    return isAdmin;

    }

    public override bool ValidateUser(string loginName, string pwd)

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    System.Web.Security.FormsAuthentication.SetAuthCookie(userInfo.UserName, false, "/");

    return true;

    }

    }

    }

    I have tried different approaches trying to get this to work and I think i'm finally at a dead end.  Any information would be very helpful.
     
    Thanks!
     
     
  •  12-05-2007, 1:38 PM 35674 in reply to 35664

    Re: Moderator Message Queue not working with single sign on

    1. Have you checked this article?
     
    2. Are you sure your project is using sampleportal4? sampleportal4 is the project name of Cute chat standalone. For your own project, it should have a different name.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-05-2007, 1:40 PM 35675 in reply to 35674

    Re: Moderator Message Queue not working with single sign on

    Originally i was using the test project you all provide which uses Sampleportal4, had the issue above.  Since then i have created a new project, followed your deployment document and it still gives me the same error.  The namespace changed accordingly, still the same issue.

  •  12-05-2007, 4:45 PM 35693 in reply to 35674

    Re: Moderator Message Queue not working with single sign on

    Here is what i'm finding, any time i override IsAdministrator or IsLobbyAdmin, it creates the issues i'm having above.  I'm trying to write the code that allows me to grant moderator/admin priv's to certain users based on whats in our database.
     
    Please help.
  •  12-05-2007, 4:46 PM 35694 in reply to 35693

    Re: Moderator Message Queue not working with single sign on

    solorasta,
     
    Can you try just return "true" for the above two methods?
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-05-2007, 4:58 PM 35695 in reply to 35694

    Re: Moderator Message Queue not working with single sign on

    returning true for both methods means that everyone would then become a moderator/admin.  I want to only return true if they are supposed to be an admin/moderator.  When i return true, it recognizes that i'm a moderator, but all the bugs stated above start to happen.

  •  12-05-2007, 5:13 PM 35696 in reply to 35695

    Re: Moderator Message Queue not working with single sign on

    >>When i return true, it recognizes that i'm a moderator, but all the bugs stated above start to happen.
     
    Your problems are not about those two methods implementation. That's why I let you set them to true.
     
    Please check the integration  guide:
     
     
    In the integration package, we included many integration code example. Please check ChatProvider examples folder.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-05-2007, 5:42 PM 35698 in reply to 35696

    Re: Moderator Message Queue not working with single sign on

    I modified my global asax to look like this:
     

    <%@ Application Language="C#" %>

    <%@ Import Namespace="CuteChat" %>

    <%@ Import Namespace="User.Chat" %>

    <script runat="server">

    void Application_Start(object sender, EventArgs e) {

    ChatProvider.Instance = new AspNetChatProvider();

    ChatSystem.Start(new AppSystem());

     

    }

    static private string CuteChatConnectionStringConfigName = "Personal";

     

    public string GetConnectionString(string reserved)

    {

    return System.Configuration.ConfigurationManager.ConnectionStrings[CuteChatConnectionStringConfigName].ConnectionString;

    }

     

    public class AspNetChatProvider : ChatProvider

    {

    public override string GetConnectionString()

    {

    return System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];

    }

    public override AppChatIdentity GetLogonIdentity()

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    return new AppChatIdentity(userInfo.UserName, false, Convert.ToString(userInfo.ConsumerID), HttpContext.Current.Request.UserHostAddress);

    }

     

    public override string FindUserLoginName(string nickName)

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

    return userInfo.UserName;

    }

    public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)

    {

    UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();

     

    nickName = userInfo.UserName;

     

    if(userInfo.Roles.Contains("ChatModerator"))

    {

    isAdmin = true;

    }

    return true;

    }

    public override bool ValidateUser(string username, string password)

    {

    return true;

    }

    }

     

    </script>
     
     
     
     
    It does not recognize me as an admin, even though i'm setting isAdmin = true in
    GetUserInfo, but its a no go.
  •  12-06-2007, 12:00 PM 35714 in reply to 35698

    Re: Moderator Message Queue not working with single sign on

    Whats the status on this?  Any ideas?  I have tried many different approaches and cant seem to get it to work.
  •  12-06-2007, 3:43 PM 35721 in reply to 35714

    Re: Moderator Message Queue not working with single sign on

    Hi,
     
    the integration code is wrong :
     
     
    public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)
     
     
    this function should user loginName to find the user information .
     
    Do not use the UserAuthenticationInfo userInfo = UserAuthenticationInfo.getUserInfo();
     
     
    Regards , Terry .
  •  06-16-2011, 6:12 AM 67994 in reply to 35664

    Re: Moderator Message Queue not working with single sign on

    I have got similar effect.
     
    I have MySQL - package from Kenneth - and IIS 7 with Windows Authentication now.
    In sample tables 'users' and userrole I have added proper domain logins and roles for logins - this works as a charm. (Of course, when I am an admin I can have only one browser opened.) So I can have 'Admin' role.
    Except this below.
     
    I cannot ad "Moderator" role to user.
    I Got this message
    <resource name="INVALIDTARGET">The specified user is currently offline or does not exist.</resource>
    when I am trying to set Moderator role for any user.
     
    I can set these three another roles with no problem:
    <resource name="UI_Menu_UserLevel_Silence">Silence</resource>
    <resource name="UI_Menu_UserLevel_Normal">Normal</resource>
    <resource name="UI_Menu_UserLevel_VIP">VIP</resource>
    <resource name="UI_Menu_UserLevel_Speaker">Speaker</resource>
     
    Resource INVALIDTARGET I found only in CuteChat.dll file.
     
    With this little change in SampleProvider.cs user with role "Moderators" is getting Admin rights too, but setting manually does not nork to.
     
            public override bool GetUserInfo(string loginName, ref string nickName, ref bool isAdmin)
            {
                UserData userdata=new UserData();
                if(!userdata.IsUsernameExists(loginName))
                    return false;

                nickName=loginName;

                //isAdmin=SamplePortal.Global.IsUserInRole("Admins",loginName) && SamplePortal.Global.IsUserInRole("Moderators",loginName);
     
                if (SamplePortal.Global.IsUserInRole("Admins",loginName) && SamplePortal.Global.IsUserInRole("Moderators",loginName));
                    isAdmin = true;
                
                return true;
            }
     
     
     
View as RSS news feed in XML