/// <summary> /// Cancella utente dalla stanza /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente cancellato /// False: errore interno, utente non cancellato /// </returns> public override bool UserDelete(int UserId, long RoomId) { String RoomKey = DAL.RoomGetExternaId(RoomId); WbUser User = DAL.UserGet(UserId); if (User != null) { // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); long ExternalUserID = 0; try { ExternalUserID = System.Convert.ToInt64(User.ExternalID); } catch {} if (ExternalUserID > 0) { UserService.deleteUserById(SessionID, ExternalUserID); } DAL.UserDelete(User.Id); } DAL.RoomUpdateUserNumber(RoomId); return(true); }
/// <summary> /// Aggiorna dati utente /// </summary> /// <param name="Users">Lista dati utente</param> /// <param name="RoomId">Stanza</param> /// <returns> /// True: utenti aggiornati /// False: errore aggiornamento /// </returns> public override bool UsersUpdate(IList <WbUser> Users, long RoomId) { foreach (WbUser usr in Users) { if (usr.Id > 0) { WbUser CurUsr = DAL.UserGetInRoom(usr.Id, RoomId); //UserGetInRoomByPerson(usr.PersonID, RoomId); if (CurUsr == null) { //L'utente NON trovato o non di quella stanza! CurUsr = new WbUser(); CurUsr.Mail = usr.Mail; } //CurUsr.DisplayName = usr.DisplayName; CurUsr.Name = usr.Name; CurUsr.SName = usr.SName; CurUsr.IsHost = usr.IsHost; CurUsr.IsController = usr.IsController; CurUsr.Video = usr.Video; CurUsr.Audio = usr.Audio; CurUsr.Chat = usr.Chat; DAL.UserSaveOrUpdate(CurUsr); } } DAL.RoomUpdateUserNumber(RoomId); return(true); }
/// <summary> /// Abilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente abilitato /// False: errore, utente non abilitato /// </returns> public override bool UserEnable(long UserId, long RoomId) { bool NeedMail = true; //Intanto sempre, poi qui false ed attivo in base a configurazione stanza. WbUser User = DAL.UserGet(UserId); if (User.MailChecked == false && User.Enabled == false) { NeedMail = true; } if (User != null) { User.Enabled = true; if (String.IsNullOrEmpty(User.ExternalID)) { this.UserAddToExternalSystem(ref User); } } User.MailChecked = true; DAL.UserSaveOrUpdate(User); if (!NeedMail) { WbRoom oRoom = DAL.RoomGet(RoomId); NeedMail = oRoom.NotificationEnableUsr; } return(NeedMail); }
/// <summary> /// Aggiunge un utente GIA' in COMOL al sistema esterno e restituisce il relativo ID. /// Se stringa vuota, l'utente non è stato inserito! /// </summary> /// <param name="User"></param> /// <returns></returns> public override void UserAddToExternalSystem(ref WbUser User) { if (String.IsNullOrEmpty(User.ExternalID)) { try { User.ExternalID = eWAPIConnector.CreateKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, User.ExternalRoomId, User.Mail, User.DisplayName ); eWAPIConnector.SetUserParameter( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, User.ExternalID, User.IsHost, User.IsController, User.Audio, User.Video, User.Chat ); } catch (Exception ex) { User.ExternalID = ""; } } }
/// <summary> /// Disabilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente abilitato /// False: errore interno, utente non abilitato /// </returns> /// <remarks> /// Al momento disabilitata lato eWorks, /// finchè manca l'enable key. /// </remarks> public override bool UserDisable(int UserId, long RoomId) { String RoomKey = DAL.RoomGetExternaId(RoomId); WbUser User = DAL.UserGet(UserId); if (User != null) { eWAPIConnector.DisableKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, RoomKey, User.ExternalID ); User.Enabled = false; DAL.UserSaveOrUpdate(User); } WbRoom oRoom = DAL.RoomGet(RoomId); bool NeedMail = oRoom.NotificationDisableUsr; //Intanto mando SEMPRE! POI su configurazione stanza. return(NeedMail); }
/// <summary> /// Aggiorna dati utente /// </summary> /// <param name="Users">Lista dati utente</param> /// <param name="RoomId">Stanza</param> /// <returns> /// True: utenti aggiornati /// False: errore aggiornamento /// </returns> public override bool UsersUpdate(IList <WbUser> Users, long RoomId) { foreach (WbUser usr in Users) { if (usr.Id > 0) { WbUser CurUsr = DAL.UserGetInRoom(usr.Id, RoomId); if (CurUsr == null) { // !!!! UTENTE NON NELLA STANZA O NON RICONOSCIUTO! CurUsr = new WbUser(); CurUsr.Mail = usr.Mail; } if (CurUsr != null) { //CurUsr.DisplayName = usr.DisplayName; CurUsr.Name = usr.Name; CurUsr.SName = usr.SName; CurUsr.IsHost = usr.IsHost; CurUsr.IsController = usr.IsController; CurUsr.Video = usr.Video; CurUsr.Audio = usr.Audio; CurUsr.Chat = usr.Chat; try { eWAPIConnector.SetUserParameter( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, CurUsr.ExternalID, CurUsr.IsHost, CurUsr.IsController, CurUsr.Audio, CurUsr.Video, CurUsr.Chat ); } catch { } DAL.UserSaveOrUpdate(CurUsr); } } } DAL.RoomUpdateUserNumber(RoomId); return(true); }
/// <summary> /// Abilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: Invia MAIL di prima iscrizione /// False: Non inviare mail... /// </returns> public override bool UserEnable(Int64 UserId, long RoomId) { bool NeedMail = false; String RoomKey = DAL.RoomGetExternaId(RoomId); WbUser User = DAL.UserGet(UserId); //DAL.GetUserInRoomByPerson(PersonId, RoomId); if (User.MailChecked == false && User.Enabled == false) { NeedMail = true; } if (String.IsNullOrEmpty(User.ExternalID)) { UserAddToExternalSystem(ref User); } if (User.Enabled == false) { eWAPIConnector.EnableKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, RoomKey, User.ExternalID ); } User.MailChecked = true; if (User != null) { User.Enabled = true; } DAL.UserSaveOrUpdate(User); if (!NeedMail) { WbRoom oRoom = DAL.RoomGet(RoomId); NeedMail = oRoom.NotificationEnableUsr; } return(NeedMail); }
public override void UserUpateInternal(long UserId, string Name, string SName, string Mail) { return; string DisplayName = SName + " " + Name; WbUser User = Manager.Get <WbUser>(UserId); //eWAPIConnector.SetUserInfo( // this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, // this.eWSysParameter.MainUserId, // this.eWSysParameter.MainUserPwd, // UserId, DisplayName, Mail); throw new NotImplementedException(); }
/// <summary> /// Converte l'oggetto corrente in un WbUser (utente WebConference) /// </summary> /// <param name="Enabled"></param> /// <returns></returns> public Domain.WbUser ToWbUser(Boolean Enabled) { Domain.WbUser usr = new WbUser(); //usr.DisplayName = Name + " " + SName; usr.Name = Name; usr.SName = SName; usr.LanguageCode = Langcode; usr.Mail = Mail; usr.MailChecked = false; usr.Audio = Audio; usr.Video = Video; usr.Chat = Chat; usr.IsController = Admin; usr.IsHost = Admin; usr.Enabled = Enabled; return(usr); }
/// <summary> /// Cancella utente dalla stanza /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente cancellato /// False: errore interno, utente non cancellato /// </returns> public override bool UserDelete(int UserId, long RoomId) { String RoomKey = DAL.RoomGetExternaId(RoomId); WbUser User = DAL.UserGet(UserId); if (User != null && !String.IsNullOrEmpty(User.ExternalID)) { eWAPIConnector.DeleteKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, RoomKey, User.ExternalID ); } DAL.UserDelete(User.Id); DAL.RoomUpdateUserNumber(RoomId); return(true); }
/// <summary> /// Disabilita utente /// </summary> /// <param name="UserId">Id Utente</param> /// <param name="RoomId">Id Stanza</param> /// <returns> /// True: utente abilitato /// False: errore interno, utente non abilitato /// </returns> public override bool UserDisable(int UserId, long RoomId) { WbUser User = DAL.UserGet(UserId); // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); if (User != null) { User.Enabled = false; UserService.kickUserByPublicSID(SessionID, User.ExternalID); } DAL.UserSaveOrUpdate(User); WbRoom oRoom = DAL.RoomGet(RoomId); bool NeedMail = oRoom.NotificationDisableUsr; return(NeedMail); }
/// <summary> /// Aggiunge un utente GIA' in COMOL al sistema esterno e restituisce il relativo ID. /// Se stringa vuota, l'utente non è stato inserito! /// </summary> /// <param name="User"></param> /// <returns></returns> public override void UserAddToExternalSystem(ref WbUser User) { User.ExternalID = Guid.NewGuid().ToString(); User.Enabled = true; }
/// <summary> /// Recupera l'indirizzo per l'accesso alla stanza. /// </summary> /// <param name="RoomId">Id Stanza</param> /// <param name="UserId">Id Utente stanza</param> /// <returns> /// Stringa vuota: non è possibile accesere /// URL accesso alla stanza /// </returns> /// <remarks> /// Per alcune implementazioni è necessario generare l'url di volta in volta ad ogni accesso. /// Le "vecchie" logiche sul "pubblica" sono state eliminate. /// </remarks> public override string AccessUrlExternalGet(long RoomId, long UserId) { WbUser User = DAL.UserGet(UserId); WbRoom Room = DAL.RoomGet(RoomId); if (Room != null && (Room.Public || User != null)) { oMRoomParameters Param = null; try { Param = (oMRoomParameters)Room.Parameter; } catch { return(""); } if (User == null || User.Enabled == false) { return(""); } String URL = ""; // SESSIONE DI LAVORO OMuserService.Sessiondata oResponse = UserService.getSession(); String SessionID = oResponse.session_id; OMuserService.ErrorResult oError = null; // LOGIN DI UN ADMINISTRATOR long UserID = UserService.loginUser(SessionID, this.oMSysParameter.MainUserLogin, this.oMSysParameter.MainUserPwd); //String Name = User.DisplayName.Split(' ')[0]; //String SurName = User.DisplayName.Remove(0, Name.Length + 1); int becomModerator = 0; if (User.IsController || User.IsHost) { becomModerator = 1; } int showAudioVideoTest = 1; //0 means don't show Audio/Video Test, 1 means show Audio/Video Test Application before the user is logged into the room long ExtRoomId = 0; try { ExtRoomId = System.Convert.ToInt64(Room.ExternalId); } catch { } URL = UserService.setUserObjectAndGenerateRoomHash( SessionID, User.DisplayName, User.Name, User.SName, "xx", User.Mail, User.PersonID.ToString(), "COL", ExtRoomId, becomModerator, showAudioVideoTest); //RECUPERARE LA PRIMA PARTE DELL'INDIRIZZO DA CONFIGURAZIONE!!! return(oMSysParameter.BaseUrl + "?secureHash=" + URL + "&language=1&lzproxied=solo"); // URL; } return(""); }
/// <summary> /// 保存当前用户 关注的用户 /// </summary> /// <param name="xmllist"></param> public void SaveUseridols(string xmllist) { if (!xmllist.Contains("<errcode>0</errcode>") || !xmllist.Contains("<msg>ok</msg>") || !xmllist.Contains("<ret>0</ret>")) { LogServer.WriteLog(xmllist, "TxweiboServer"); return; } string userListText = BaseSiteInfo.RegGroupsX<string>(xmllist,"<data>(?<x>.*?)</data>"); var list = BaseSiteInfo.RegGroupCollection(userListText,"<info>(?<x>.*?)</info>"); List<WbUser> tblist = new List<WbUser>(); foreach (Match match in list) { string item = match.Groups["x"].Value; WbUser tb = new WbUser(); tb.AccessToken = ""; tb.CityCodeTwb = BaseSiteInfo.RegGroupsX<string>(item, "<city_code>(?<x>.*?)</city_code>"); tb.CountryCodeTwb = BaseSiteInfo.RegGroupsX<string>(item, "<country_code>(?<x>.*?)</country_code>"); tb.FansnumTwb = BaseSiteInfo.RegGroupsX<int>(item, "<fansnum>(?<x>.*?)</fansnum>"); tb.HeadTwb = BaseSiteInfo.RegGroupsX<string>(item, "<head>(?<x>.*?)</head>"); tb.HttpsHead = BaseSiteInfo.RegGroupsX<string>(item, "<https_head>(?<x>.*?)</https_head>"); tb.IdolnumTwb = BaseSiteInfo.RegGroupsX<int>(item, "<idolnum>(?<x>.*?)</idolnum>"); tb.IsFansTwb = BaseSiteInfo.RegGroupsX<string>(item, "<isfans>(?<x>.*?)</isfans>"); tb.IsidolTwb = BaseSiteInfo.RegGroupsX<string>(item, "<isidol>(?<x>.*?)</isidol>"); tb.IsrealnameTwb = BaseSiteInfo.RegGroupsX<string>(item, "<IsrealnameTwb>(?<x>.*?)</IsrealnameTwb>"); tb.IsVip = BaseSiteInfo.RegGroupsX<string>(item, "<isvip>(?<x>.*?)</isvip>"); tb.LocationTwb = BaseSiteInfo.RegGroupsX<string>(item, "<location>(?<x>.*?)</location>"); tb.NameTwb = BaseSiteInfo.RegGroupsX<string>(item, "<name>(?<x>.*?)</name>"); tb.NickTwb = BaseSiteInfo.RegGroupsX<string>(item, "<nick>(?<x>.*?)</nick>"); tb.OpenidTwb = BaseSiteInfo.RegGroupsX<string>(item, "<openid>(?<x>.*?)</openid>"); tb.ProvinceCodeTwb = BaseSiteInfo.RegGroupsX<string>(item, "<province_code>(?<x>.*?)</province_code>"); tb.SexTwb = BaseSiteInfo.RegGroupsX<string>(item, "<sex>(?<x>.*?)</sex>"); tb.TagTwb = BaseSiteInfo.RegGroupsX<string>(item, "<tag>(?<x>.*?)</tag>"); tb.FromTwb = BaseSiteInfo.RegGroupsX<string>(item, "<from>(?<x>.*?)</from>"); tb.IdTwb ="tx_"+ BaseSiteInfo.RegGroupsX<string>(item, "<id>(?<x>.*?)</id>"); tb.TextTwb = BaseSiteInfo.RegGroupsX<string>(item, "<text>(?<x>.*?)</text>"); tb.TimestampTwb = BaseSiteInfo.RegGroupsX<string>(item, "<timestamp>(?<x>.*?)</timestamp>"); tb.IsUsed = true; tb.UpdateTime = DateTime.Now; tb.CreateDate = DateTime.Now; tb.WbType = "tengxun"; tblist.Add(tb); } TxWeiboUserDB.AddUserInfo(tblist); }
//public void UpdateRoomRecording() //{ //} #endregion #region User management /// <summary> /// Aggiunge un utente /// </summary> /// <param name="Users">Dati utente</param> /// <param name="RoomId">IdStanza</param> public override void UsersAdd(IList <WbUser> Users, long RoomId) { WbRoom oRoom = DAL.RoomGet(RoomId); String MasterKey = oRoom.ExternalId; IList <DTO.DTOuser> EWusers = eWAPIConnector.RetrieveUsers( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, MasterKey ); //IList<String> CurrentKeys = (from DTO.DTOuser usr in EWusers select usr.Key).ToList(); //IList<String> NewKeys = (from WbUser usr in Users select usr.ExternalID).ToList(); foreach (WbUser usr in Users) { Boolean usrExistEW = false; Boolean error = false; Boolean usrExistdB = false; WbUser dBUser = DAL.UserGet(RoomId, usr.Mail); if (dBUser != null) { usrExistdB = true; } usr.RoomId = oRoom.Id; usr.ExternalRoomId = oRoom.ExternalId; String EWkey = (from DTO.DTOuser ewu in EWusers where ewu.UserId == usr.Mail select ewu.Key).FirstOrDefault(); if (String.IsNullOrEmpty(EWkey)) { usrExistEW = false; } else { usrExistEW = true; } // C'è sul dB, ma non in eWorks!!! // Cancello da dB!!! if (usrExistdB & !usrExistEW) { DAL.UserDelete(oRoom.Id, usr.Mail); usrExistdB = false; usrExistEW = false; } else if (!usrExistdB & usrExistEW) { eWAPIConnector.DeleteKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, oRoom.ExternalId, EWkey ); usrExistdB = false; usrExistEW = false; } if (!usrExistdB && !usrExistEW) { //Aggiungo l'utente. //Aggiungo l'utente su eWorks try { usr.ExternalID = eWAPIConnector.CreateKey( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, MasterKey, usr.Mail, usr.DisplayName ); //Reimposto i parametri dell'utente eWAPIConnector.SetUserParameter( this.eWSysParameter.BaseUrl, this.eWSysParameter.ProxyUrl, this.eWSysParameter.MainUserId, this.eWSysParameter.MainUserPwd, usr.ExternalID, usr.IsHost, usr.IsController, usr.Audio, usr.Video, usr.Chat ); } catch (Exception Ex) { error = true; } if (String.IsNullOrEmpty(usr.ExternalID)) { error = true; } //} if (!error) { try { DAL.UserSaveOrUpdate(usr); } catch { error = true; } } if (error) { try { DAL.UserDelete(RoomId, usr.Mail); } catch { } } } } DAL.RoomUpdateUserNumber(RoomId); }