public LSL_Key llRequestDisplayName(LSL_Key uuid) { UUID userID = UUID.Zero; if (!UUID.TryParse(uuid, out userID)) { // => complain loudly, as specified by the LSL docs Error("llRequestDisplayName", "Failed to parse uuid for avatar."); return(UUID.Zero.ToString()); } DataserverPlugin dataserverPlugin = (DataserverPlugin)m_ScriptEngine.GetScriptPlugin("Dataserver"); UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID, m_itemID, uuid.ToString()); Util.FireAndForget(delegate { string name = ""; IProfileConnector connector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(); if (connector != null) { IUserProfileInfo info = connector.GetUserProfile(userID); if (info != null) { name = info.DisplayName; } } dataserverPlugin.AddReply(uuid.ToString(), name, 100); }); PScriptSleep(m_sleepMsOnRequestUserName); return(tid.ToString()); }
public void RegisterCaps(IRegionClientCapsService service) { m_service = service; m_profileConnector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> (); m_service.AddStreamHandler("MeshUploadFlag", new GenericStreamHandler("GET", m_service.CreateCAPS("MeshUploadFlag", ""), MeshUploadFlagCAP)); }
public void RegisterCaps(IRegionClientCapsService service) { IConfig displayNamesConfig = service.ClientCaps.Registry.RequestModuleInterface<ISimulationBase>().ConfigSource.Configs["DisplayNamesModule"]; if (displayNamesConfig != null) { if (!displayNamesConfig.GetBoolean ("Enabled", true)) return; string bannedNamesString = displayNamesConfig.GetString ("BannedUserNames", ""); if (bannedNamesString != "") bannedNames = new List<string> (bannedNamesString.Split (',')); } m_service = service; m_profileConnector = Aurora.DataManager.DataManager.RequestPlugin<IProfileConnector> (); m_eventQueue = service.Registry.RequestModuleInterface<IEventQueueService> (); m_userService = service.Registry.RequestModuleInterface<IUserAccountService> (); string post = CapsUtil.CreateCAPS ("SetDisplayName", ""); service.AddCAPS ("SetDisplayName", post); service.AddStreamHandler ("SetDisplayName", new RestHTTPHandler ("POST", post, ProcessSetDisplayName)); post = CapsUtil.CreateCAPS ("GetDisplayNames", ""); service.AddCAPS ("GetDisplayNames", post); service.AddStreamHandler ("GetDisplayNames", new StreamHandler ("GET", post, ProcessGetDisplayName)); }
public void RegisterCaps (IRegionClientCapsService service) { m_service = service; m_profileConnector = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> (); m_service.AddStreamHandler ("MeshUploadFlag", new GenericStreamHandler ("GET", m_service.CreateCAPS ("MeshUploadFlag", ""), MeshUploadFlagCAP)); }
public void RegisterCaps (IRegionClientCapsService service) { var cfgservice = service.ClientCaps.Registry.RequestModuleInterface<ISimulationBase> (); var displayNamesConfig = cfgservice.ConfigSource.Configs ["DisplayNames"]; if (displayNamesConfig != null) { if (!displayNamesConfig.GetBoolean ("Enabled", true)) return; string bannedNamesString = displayNamesConfig.GetString ("BannedUserNames", ""); if (bannedNamesString != "") bannedNames = new List<string> (bannedNamesString.Split (',')); m_update_days = displayNamesConfig.GetDouble ("UpdateDays", m_update_days); } m_service = service; m_profileConnector = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> (); m_eventQueue = service.Registry.RequestModuleInterface<IEventQueueService> (); m_userService = service.Registry.RequestModuleInterface<IUserAccountService> (); string post = CapsUtil.CreateCAPS ("SetDisplayName", ""); service.AddStreamHandler ("SetDisplayName", new GenericStreamHandler ("POST", post, ProcessSetDisplayName)); post = CapsUtil.CreateCAPS ("GetDisplayNames", ""); service.AddStreamHandler ("GetDisplayNames", new GenericStreamHandler ("GET", post, ProcessGetDisplayName)); }
public void RegisterCaps(IRegionClientCapsService service) { IConfig displayNamesConfig = service.ClientCaps.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs[ "DisplayNamesModule"]; if (displayNamesConfig != null) { if (!displayNamesConfig.GetBoolean("Enabled", true)) { return; } string bannedNamesString = displayNamesConfig.GetString("BannedUserNames", ""); if (bannedNamesString != "") { bannedNames = new List <string>(bannedNamesString.Split(',')); } } m_service = service; m_profileConnector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(); m_eventQueue = service.Registry.RequestModuleInterface <IEventQueueService>(); m_userService = service.Registry.RequestModuleInterface <IUserAccountService>(); string post = CapsUtil.CreateCAPS("SetDisplayName", ""); service.AddStreamHandler("SetDisplayName", new GenericStreamHandler("POST", post, ProcessSetDisplayName)); post = CapsUtil.CreateCAPS("GetDisplayNames", ""); service.AddStreamHandler("GetDisplayNames", new GenericStreamHandler("GET", post, ProcessGetDisplayName)); }
public void RegisterCaps(IRegionClientCapsService service) { m_service = service; m_userService = service.Registry.RequestModuleInterface<IUserAccountService>(); m_profileConnector = DataManager.RequestPlugin<IProfileConnector>(); m_service.AddStreamHandler("MeshUploadFlag", new GenericStreamHandler("GET", m_service.CreateCAPS("MeshUploadFlag", ""), MeshUploadFlagCAP)); }
public void RegisterCaps(IRegionClientCapsService service) { m_service = service; m_userService = service.Registry.RequestModuleInterface <IUserAccountService>(); m_profileConnector = DataManager.RequestPlugin <IProfileConnector>(); m_service.AddStreamHandler("MeshUploadFlag", new GenericStreamHandler("GET", m_service.CreateCAPS("MeshUploadFlag", ""), MeshUploadFlagCAP)); }
public void RegisterCaps(IRegionClientCapsService service) { m_service = service; m_userService = service.Registry.RequestModuleInterface<IUserAccountService>(); m_profileConnector = DataManager.RequestPlugin<IProfileConnector>(); m_service.AddStreamHandler("MeshUploadFlag", new RestHTTPHandler("GET", m_service.CreateCAPS("MeshUploadFlag", ""), delegate(Hashtable m_dhttpMethod) { return MeshUploadFlagCAP(m_dhttpMethod); })); }
public void RegionLoaded(IScene scene) { if (!m_SearchEnabled) { return; } //Pull in the services we need ProfileFrontend = DataManager.DataManager.RequestPlugin <IProfileConnector>(); directoryService = DataManager.DataManager.RequestPlugin <IDirectoryServiceConnector>(); GroupsModule = scene.RequestModuleInterface <IGroupsModule>(); }
public void AddRegion(Scene scene) { if (!m_ProfileEnabled) return; ProfileFrontend = DataManager.DataManager.RequestPlugin<IProfileConnector>(); if (ProfileFrontend == null) return; if (!m_Scenes.Contains(scene)) m_Scenes.Add(scene); scene.EventManager.OnNewClient += NewClient; scene.EventManager.OnClosingClient += OnClosingClient; }
protected void HandleLoadAvatarProfile(string[] cmdparams) { if (cmdparams.Length != 6) { MainConsole.Instance.Info("[AvatarProfileArchiver] Not enough parameters!"); return; } StreamReader reader = new StreamReader(cmdparams[5]); string document = reader.ReadToEnd(); reader.Close(); reader.Dispose(); string[] lines = document.Split('\n'); List <string> file = new List <string>(lines); Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(file[1]); Dictionary <string, object> results = replyData["result"] as Dictionary <string, object>; UserAccount UDA = new UserAccount { Name = cmdparams[3] + cmdparams[4], PrincipalID = UUID.Random(), ScopeID = UUID.Zero, UserFlags = int.Parse(results["UserFlags"].ToString()), UserLevel = 0, UserTitle = results["UserTitle"].ToString(), Email = results["Email"].ToString(), Created = int.Parse(results["Created"].ToString()) }; //For security... Don't want everyone loading full god mode. UserAccountService.StoreUserAccount(UDA); replyData = WebUtils.ParseXmlResponse(file[2]); IUserProfileInfo UPI = new IUserProfileInfo(); UPI.FromKVP(replyData["result"] as Dictionary <string, object>); //Update the principle ID to the new user. UPI.PrincipalID = UDA.PrincipalID; IProfileConnector profileData = DataManager.DataManager.RequestPlugin <IProfileConnector>(); if (profileData.GetUserProfile(UPI.PrincipalID) == null) { profileData.CreateNewProfile(UPI.PrincipalID); } profileData.UpdateUserProfile(UPI); MainConsole.Instance.Info("[AvatarProfileArchiver] Loaded Avatar Profile from " + cmdparams[5]); }
byte[] GetProfile(OSDMap map) { OSDMap resp = new OSDMap(); string Name = map["Name"].AsString(); UserAccount account = m_registry.RequestModuleInterface <IUserAccountService>().GetUserAccount(UUID.Zero, Name); if (account != null) { OSDMap accountMap = new OSDMap(); accountMap["Created"] = account.Created; accountMap["PrincipalID"] = account.PrincipalID; TimeSpan diff = DateTime.Now - Util.ToDateTime(account.Created); int years = (int)diff.TotalDays / 356; int days = years > 0 ? (int)diff.TotalDays / years : (int)diff.TotalDays; accountMap["TimeSinceCreated"] = years + " years, " + days + " days"; IProfileConnector profileConnector = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); IUserProfileInfo profile = profileConnector.GetUserProfile(account.PrincipalID); if (profile != null) { resp["profile"] = profile.ToOSD(false);//not trusted, use false if (account.UserFlags == 0) { account.UserFlags = 2; //Set them to no info given } string flags = ((IUserProfileInfo.ProfileFlags)account.UserFlags).ToString(); IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile.ToString(); accountMap["AccountInfo"] = (profile.CustomType != "" ? profile.CustomType : account.UserFlags == 0 ? "Resident" : "Admin") + "\n" + flags; UserAccount partnerAccount = m_registry.RequestModuleInterface <IUserAccountService>().GetUserAccount(UUID.Zero, profile.Partner); if (partnerAccount != null) { accountMap["Partner"] = partnerAccount.Name; } else { accountMap["Partner"] = ""; } } resp["account"] = accountMap; } string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
public void AddRegion(IScene scene) { if (!m_ProfileEnabled) { return; } ProfileFrontend = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(); if (ProfileFrontend == null) { return; } m_Scene = scene; scene.EventManager.OnNewClient += NewClient; scene.EventManager.OnClosingClient += OnClosingClient; }
public void AddRegion(Scene scene) { if (!m_ProfileEnabled) { return; } ProfileFrontend = DataManager.DataManager.RequestPlugin <IProfileConnector>(); if (ProfileFrontend == null) { return; } if (!m_Scenes.Contains(scene)) { m_Scenes.Add(scene); } scene.EventManager.OnNewClient += NewClient; scene.EventManager.OnClosingClient += OnClosingClient; }
protected void HandleSaveAvatarProfile(string[] cmdparams) { if (cmdparams.Length != 6) { MainConsole.Instance.Info("[AvatarProfileArchiver] Not enough parameters!"); return; } UserAccount account = UserAccountService.GetUserAccount(null, cmdparams[3] + " " + cmdparams[4]); if (account == null) { MainConsole.Instance.Info("Account could not be found, stopping now."); return; } IProfileConnector data = DataManager.DataManager.RequestPlugin <IProfileConnector>(); string UPIxmlString = ""; Dictionary <string, object> result = new Dictionary <string, object>(); if (data != null) { IUserProfileInfo profile = data.GetUserProfile(account.PrincipalID); if (profile != null) { result["result"] = profile.ToKVP(); UPIxmlString = WebUtils.BuildXmlResponse(result); } } result["result"] = account.ToKVP(); string UDAxmlString = WebUtils.BuildXmlResponse(result); StreamWriter writer = new StreamWriter(cmdparams[5]); writer.Write("<profile>\n"); writer.Write(UDAxmlString + "\n"); writer.Write(UPIxmlString + "\n"); writer.Write("</profile>\n"); writer.Close(); writer.Dispose(); MainConsole.Instance.Info("[AvatarProfileArchiver] Saved Avatar Profile to " + cmdparams[5]); }
protected void HandleSetPartner(string[] cmdParams) { string first = MainConsole.Instance.Prompt("First User's name"); string second = MainConsole.Instance.Prompt("Second User's name"); IProfileConnector profileConnector = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); if (profileConnector != null) { IUserProfileInfo firstProfile = profileConnector.GetUserProfile(GetUserAccount(null, first).PrincipalID); IUserProfileInfo secondProfile = profileConnector.GetUserProfile(GetUserAccount(null, second).PrincipalID); firstProfile.Partner = secondProfile.PrincipalID; secondProfile.Partner = firstProfile.PrincipalID; profileConnector.UpdateUserProfile(firstProfile); profileConnector.UpdateUserProfile(secondProfile); MainConsole.Instance.Warn("Partner information updated. "); } }
public void AddRegion(IScene scene) { if (!m_ProfileEnabled) { return; } ProfileFrontend = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> (); if (ProfileFrontend == null) { return; } m_Scene = scene; scene.EventManager.OnNewClient += NewClient; scene.EventManager.OnClosingClient += OnClosingClient; IScheduledMoneyModule moneyModule = scene.RequestModuleInterface <IScheduledMoneyModule> (); if (moneyModule != null) { moneyModule.OnUserDidNotPay += moneyModule_OnUserDidNotPay; } }
public ProfileInfoHandler() { ProfileConnector = DataManager.RequestPlugin <IProfileConnector>("IProfileConnectorLocal"); AgentConnector = DataManager.RequestPlugin <IAgentConnector>("IAgentConnectorLocal"); }
OSDMap CreateAccount(OSDMap map) { bool Verified = false; string Name = map ["Name"].AsString(); string Password = ""; if (map.ContainsKey("Password")) { Password = map ["Password"].AsString(); } else { Password = map ["PasswordHash"].AsString(); //is really plaintext password, the system hashes it later. Not sure why it was called PasswordHash to start with. I guess the original design was to have the PHP code generate the salt and password hash, then just simply store it here } //string PasswordSalt = map["PasswordSalt"].AsString(); //not being used string HomeRegion = map ["HomeRegion"].AsString(); string Email = map ["Email"].AsString(); string AvatarArchive = map ["AvatarArchive"].AsString(); int userLevel = map ["UserLevel"].AsInteger(); string UserTitle = map ["UserTitle"].AsString(); //server expects: 0 is PG, 1 is Mature, 2 is Adult - use this when setting MaxMaturity and MaturityRating //viewer expects: 13 is PG, 21 is Mature, 42 is Adult int MaxMaturity = 2; //set to adult by default if (map.ContainsKey("MaxMaturity")) //MaxMaturity is the highest level that they can change the maturity rating to in the viewer { MaxMaturity = map ["MaxMaturity"].AsInteger(); } int MaturityRating = MaxMaturity; //set the default to whatever MaxMaturity was set tom incase they didn't define MaturityRating if (map.ContainsKey("MaturityRating")) //MaturityRating is the rating the user wants to be able to see { MaturityRating = map ["MaturityRating"].AsInteger(); } bool activationRequired = map.ContainsKey("ActivationRequired") ? map ["ActivationRequired"].AsBoolean() : false; IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService> (); if (accountService == null) { return(null); } if (!Password.StartsWith("$1$", System.StringComparison.Ordinal)) { Password = "******" + Util.Md5Hash(Password); } Password = Password.Remove(0, 3); //remove $1$ accountService.CreateUser(Name, Password, Email); UserAccount user = accountService.GetUserAccount(null, Name); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); IGridService gridService = m_registry.RequestModuleInterface <IGridService> (); if (agentInfoService != null && gridService != null) { GridRegion r = gridService.GetRegionByName(null, HomeRegion); if (r != null) { agentInfoService.SetHomePosition(user.PrincipalID.ToString(), r.RegionID, new Vector3(r.RegionSizeX / 2, r.RegionSizeY / 2, 20), Vector3.Zero); } else { MainConsole.Instance.DebugFormat("[API]: Could not set home position for user {0}, region \"{1}\" did not produce a result from the grid service", Name, HomeRegion); } } Verified = user != null; UUID userID = UUID.Zero; OSDMap resp = new OSDMap(); resp ["Verified"] = OSD.FromBoolean(Verified); if (Verified) { userID = user.PrincipalID; user.UserLevel = userLevel; // could not find a way to save this data here. DateTime RLDOB = map ["RLDOB"].AsDate(); string RLGender = map ["RLGender"].AsString(); string RLName = map ["RLName"].AsString(); string RLAddress = map ["RLAddress"].AsString(); string RLCity = map ["RLCity"].AsString(); string RLZip = map ["RLZip"].AsString(); string RLCountry = map ["RLCountry"].AsString(); string RLIP = map ["RLIP"].AsString(); IAgentConnector con = DataPlugins.RequestPlugin <IAgentConnector> (); con.CreateNewAgent(userID); IAgentInfo agent = con.GetAgent(userID); agent.MaxMaturity = MaxMaturity; agent.MaturityRating = MaturityRating; agent.OtherAgentInformation ["RLDOB"] = RLDOB; agent.OtherAgentInformation ["RLGender"] = RLGender; agent.OtherAgentInformation ["RLName"] = RLName; agent.OtherAgentInformation ["RLAddress"] = RLAddress; agent.OtherAgentInformation ["RLCity"] = RLCity; agent.OtherAgentInformation ["RLZip"] = RLZip; agent.OtherAgentInformation ["RLCountry"] = RLCountry; agent.OtherAgentInformation ["RLIP"] = RLIP; if (activationRequired) { UUID activationToken = UUID.Random(); agent.OtherAgentInformation ["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + Password); resp ["WebUIActivationToken"] = activationToken; } con.UpdateAgent(agent); accountService.StoreUserAccount(user); IProfileConnector profileData = DataPlugins.RequestPlugin <IProfileConnector> (); IUserProfileInfo profile = profileData.GetUserProfile(user.PrincipalID); if (profile == null) { profileData.CreateNewProfile(user.PrincipalID); profile = profileData.GetUserProfile(user.PrincipalID); } if (AvatarArchive.Length > 0) { profile.AArchiveName = AvatarArchive; } // MainConsole.Instance.InfoFormat("[WebUI] Triggered Archive load of " + profile.AArchiveName); profile.IsNewUser = true; profile.MembershipGroup = UserTitle; profile.CustomType = UserTitle; profileData.UpdateUserProfile(profile); // MainConsole.Instance.RunCommand("load avatar archive " + user.FirstName + " " + user.LastName + " Devil"); } resp ["UUID"] = OSD.FromUUID(userID); return(resp); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); var settings = webInterface.GetWebUISettings(); bool adminUser = Authenticator.CheckAdminAuthentication(httpRequest, Constants.USER_GOD_CUSTOMER_SERVICE); bool allowRegistration = settings.WebRegistration; bool anonymousLogins; // allow configuration to override the web settings IConfig config = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs ["LoginService"]; if (config != null) { anonymousLogins = config.GetBoolean("AllowAnonymousLogin", allowRegistration); allowRegistration = (allowRegistration || anonymousLogins); } if (!adminUser && !allowRegistration) { vars.Add("ErrorMessage", ""); vars.Add("RegistrationText", translator.GetTranslatedString("RegistrationText")); vars.Add("RegistrationsDisabled", translator.GetTranslatedString("RegistrationsDisabled")); vars.Add("Registrations", false); vars.Add("NoRegistrations", true); return(vars); } if (requestParameters.ContainsKey("Submit")) { string AvatarName = requestParameters["AvatarName"].ToString(); string AvatarPassword = requestParameters["AvatarPassword"].ToString(); string AvatarPasswordCheck = requestParameters["AvatarPassword2"].ToString(); string FirstName = requestParameters["FirstName"].ToString(); string LastName = requestParameters["LastName"].ToString(); //removed - greythane - deemed not used //string UserAddress = requestParameters["UserAddress"].ToString(); //string UserZip = requestParameters["UserZip"].ToString(); string UserCity = requestParameters["UserCity"].ToString(); string UserEmail = requestParameters["UserEmail"].ToString(); string UserHomeRegion = requestParameters["UserHomeRegion"].ToString(); string UserDOBMonth = requestParameters["UserDOBMonth"].ToString(); string UserDOBDay = requestParameters["UserDOBDay"].ToString(); string UserDOBYear = requestParameters["UserDOBYear"].ToString(); string AvatarArchive = requestParameters.ContainsKey("AvatarArchive") ? requestParameters["AvatarArchive"].ToString() : ""; bool ToSAccept = requestParameters.ContainsKey("ToSAccept") && requestParameters["ToSAccept"].ToString() == "Accepted"; string UserType = requestParameters.ContainsKey("UserType") // only admins can set membership ? requestParameters ["UserType"].ToString() : "Resident"; // revise UserDOBMonth to a number UserDOBMonth = ShortMonthToNumber(UserDOBMonth); // revise Type flags int UserFlags = webInterface.UserTypeToUserFlags(UserType); // a bit of idiot proofing if (AvatarName == "") { response = "<h3>" + translator.GetTranslatedString("AvatarNameError") + "</h3>"; return(null); } if ((AvatarPassword == "") || (AvatarPassword != AvatarPasswordCheck)) { response = "<h3>" + translator.GetTranslatedString("AvatarPasswordError") + "</h3>"; return(null); } if (UserEmail == "") { response = "<h3>" + translator.GetTranslatedString("AvatarEmailError") + "</h3>"; return(null); } // Thish - Only one space is allowed in the name to seperate First and Last of the avatar name if (AvatarName.Split(' ').Length != 2) { response = "<h3>" + translator.GetTranslatedString("AvatarNameSpacingError") + "</h3>"; return(null); } // so far so good... if (ToSAccept) { AvatarPassword = Util.Md5Hash(AvatarPassword); IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); UUID userID = UUID.Random(); string error = accountService.CreateUser(userID, settings.DefaultScopeID, AvatarName, AvatarPassword, UserEmail); if (error == "") { // set the user account type UserAccount account = accountService.GetUserAccount(null, userID); account.UserFlags = UserFlags; accountService.StoreUserAccount(account); // create and save agent info IAgentConnector con = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector> (); con.CreateNewAgent(userID); IAgentInfo agent = con.GetAgent(userID); agent.OtherAgentInformation ["RLFirstName"] = FirstName; agent.OtherAgentInformation ["RLLastName"] = LastName; //agent.OtherAgentInformation ["RLAddress"] = UserAddress; agent.OtherAgentInformation ["RLCity"] = UserCity; //agent.OtherAgentInformation ["RLZip"] = UserZip; agent.OtherAgentInformation ["UserDOBMonth"] = UserDOBMonth; agent.OtherAgentInformation ["UserDOBDay"] = UserDOBDay; agent.OtherAgentInformation ["UserDOBYear"] = UserDOBYear; agent.OtherAgentInformation ["UserFlags"] = UserFlags; /*if (activationRequired) * { * UUID activationToken = UUID.Random(); * agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash); * resp["WebUIActivationToken"] = activationToken; * }*/ con.UpdateAgent(agent); // create user profile details IProfileConnector profileData = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector> (); if (profileData != null) { IUserProfileInfo profile = profileData.GetUserProfile(userID); if (profile == null) { profileData.CreateNewProfile(userID); profile = profileData.GetUserProfile(userID); } if (AvatarArchive != "") { profile.AArchiveName = AvatarArchive; List <AvatarArchive> avarchives = webInterface.Registry.RequestModuleInterface <IAvatarAppearanceArchiver>().GetAvatarArchives(); UUID snapshotUUID = UUID.Zero; foreach (var archive in avarchives) { if (archive.FolderName == AvatarArchive) { snapshotUUID = archive.Snapshot; } } if (snapshotUUID != UUID.Zero) { profile.Image = snapshotUUID; } } profile.MembershipGroup = webInterface.UserFlagToType(UserFlags, webInterface.EnglishTranslator); // membership is english profile.IsNewUser = true; profileData.UpdateUserProfile(profile); } IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService> (); Vector3 position = new Vector3(128, 128, 25); Vector3 lookAt = new Vector3(0, 0, 22); if (agentInfoService != null) { agentInfoService.SetHomePosition(userID.ToString(), (UUID)UserHomeRegion, position, lookAt); } vars.Add("ErrorMessage", "Successfully created account, redirecting to main page"); response = "<h3>Successfully created account, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html\";}, 3000);" + "</script>"; } else { vars.Add("ErrorMessage", "<h3>" + error + "</h3>"); response = "<h3>" + error + "</h3>"; } } else { response = "<h3>You did not accept the Terms of Service agreement.</h3>"; } return(null); } List <Dictionary <string, object> > daysArgs = new List <Dictionary <string, object> >(); for (int i = 1; i <= 31; i++) { daysArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > monthsArgs = new List <Dictionary <string, object> >(); //for (int i = 1; i <= 12; i++) // monthsArgs.Add(new Dictionary<string, object> {{"Value", i}}); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Jan_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Feb_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Mar_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Apr_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("May_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Jun_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Jul_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Aug_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Sep_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Oct_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Nov_Short") } }); monthsArgs.Add(new Dictionary <string, object> { { "Value", translator.GetTranslatedString("Dec_Short") } }); List <Dictionary <string, object> > yearsArgs = new List <Dictionary <string, object> >(); for (int i = 1940; i <= 2013; i++) { yearsArgs.Add(new Dictionary <string, object> { { "Value", i } }); } vars.Add("Days", daysArgs); vars.Add("Months", monthsArgs); vars.Add("Years", yearsArgs); var sortBy = new Dictionary <string, bool>(); sortBy.Add("RegionName", true); var RegionListVars = new List <Dictionary <string, object> >(); var regions = Framework.Utilities.DataManager.RequestPlugin <IRegionData>().Get((RegionFlags)0, RegionFlags.Hyperlink | RegionFlags.Foreign | RegionFlags.Hidden, null, null, sortBy); foreach (var region in regions) { RegionListVars.Add(new Dictionary <string, object> { { "RegionName", region.RegionName }, { "RegionUUID", region.RegionID } }); } vars.Add("RegionList", RegionListVars); vars.Add("UserHomeRegionText", translator.GetTranslatedString("UserHomeRegionText")); vars.Add("UserTypeText", translator.GetTranslatedString("UserTypeText")); vars.Add("UserType", webInterface.UserTypeArgs(translator)); List <AvatarArchive> archives = webInterface.Registry.RequestModuleInterface <IAvatarAppearanceArchiver>().GetAvatarArchives(); List <Dictionary <string, object> > avatarArchives = new List <Dictionary <string, object> >(); IWebHttpTextureService webTextureService = webInterface.Registry. RequestModuleInterface <IWebHttpTextureService>(); foreach (var archive in archives) { avatarArchives.Add(new Dictionary <string, object> { { "AvatarArchiveName", archive.FolderName }, { "AvatarArchiveSnapshotID", archive.Snapshot }, { "AvatarArchiveSnapshotURL", webTextureService.GetTextureURL(archive.Snapshot) } }); } vars.Add("AvatarArchive", avatarArchives); IConfig loginServerConfig = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs["LoginService"]; string tosLocation = ""; if (loginServerConfig != null && loginServerConfig.GetBoolean("UseTermsOfServiceOnFirstLogin", false)) { tosLocation = loginServerConfig.GetString("FileNameOfTOS", ""); tosLocation = PathHelpers.VerifyReadFile(tosLocation, ".txt", Constants.DEFAULT_DATA_DIR); } string ToS = "There are no Terms of Service currently. This may be changed at any point in the future."; if (tosLocation != "") { System.IO.StreamReader reader = new System.IO.StreamReader(System.IO.Path.Combine(Environment.CurrentDirectory, tosLocation)); ToS = reader.ReadToEnd(); reader.Close(); } // check for user name seed string[] m_userNameSeed = null; if (loginServerConfig != null) { string userNameSeed = loginServerConfig.GetString("UserNameSeed", ""); if (userNameSeed != "") { m_userNameSeed = userNameSeed.Split(','); } } Utilities.MarkovNameGenerator ufNames = new Utilities.MarkovNameGenerator(); Utilities.MarkovNameGenerator ulNames = new Utilities.MarkovNameGenerator(); string[] nameSeed = m_userNameSeed == null ? Utilities.UserNames : m_userNameSeed; string firstName = ufNames.FirstName(nameSeed, 3, 4); string lastName = ulNames.FirstName(nameSeed, 5, 6); string enteredName = firstName + " " + lastName; vars.Add("AvatarName", enteredName); vars.Add("ToSMessage", ToS); vars.Add("TermsOfServiceAccept", translator.GetTranslatedString("TermsOfServiceAccept")); vars.Add("TermsOfServiceText", translator.GetTranslatedString("TermsOfServiceText")); vars.Add("RegistrationsDisabled", ""); //vars.Add("RegistrationsDisabled", translator.GetTranslatedString("RegistrationsDisabled")); vars.Add("RegistrationText", translator.GetTranslatedString("RegistrationText")); vars.Add("AvatarNameText", translator.GetTranslatedString("AvatarNameText")); vars.Add("AvatarPasswordText", translator.GetTranslatedString("Password")); vars.Add("AvatarPasswordConfirmationText", translator.GetTranslatedString("PasswordConfirmation")); vars.Add("AvatarScopeText", translator.GetTranslatedString("AvatarScopeText")); vars.Add("FirstNameText", translator.GetTranslatedString("FirstNameText")); vars.Add("LastNameText", translator.GetTranslatedString("LastNameText")); vars.Add("UserAddressText", translator.GetTranslatedString("UserAddressText")); vars.Add("UserZipText", translator.GetTranslatedString("UserZipText")); vars.Add("UserCityText", translator.GetTranslatedString("UserCityText")); vars.Add("UserCountryText", translator.GetTranslatedString("UserCountryText")); vars.Add("UserDOBText", translator.GetTranslatedString("UserDOBText")); vars.Add("UserEmailText", translator.GetTranslatedString("UserEmailText")); vars.Add("Accept", translator.GetTranslatedString("Accept")); vars.Add("Submit", translator.GetTranslatedString("Submit")); vars.Add("SubmitURL", "register.html"); vars.Add("ErrorMessage", ""); vars.Add("Registrations", true); vars.Add("NoRegistrations", false); return(vars); }
public void Start(IConfigSource config, IRegistryCore registry) { m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>(); m_Database = Framework.Utilities.DataManager.RequestPlugin<IUserAccountData>(); m_profileConnector = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>(); }
protected void HandleLoadAvatarProfile(string module, string[] cmdparams) { if (cmdparams.Length != 6) { m_log.Info("[AvatarProfileArchiver] Not enough parameters!"); return; } StreamReader reader = new StreamReader(cmdparams[5]); string document = reader.ReadToEnd(); reader.Close(); reader.Dispose(); string[] lines = document.Split('\n'); List <string> file = new List <string>(lines); Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(file[1]); Dictionary <string, object> results = replyData["result"] as Dictionary <string, object>; UserAccount UDA = new UserAccount(); UDA.Name = cmdparams[3] + cmdparams[4]; UDA.PrincipalID = UUID.Random(); UDA.ScopeID = UUID.Zero; UDA.UserFlags = int.Parse(results["UserFlags"].ToString()); UDA.UserLevel = 0; //For security... Don't want everyone loading full god mode. UDA.UserTitle = results["UserTitle"].ToString(); UDA.Email = results["Email"].ToString(); UDA.Created = int.Parse(results["Created"].ToString()); if (results.ContainsKey("ServiceURLs") && results["ServiceURLs"] != null) { UDA.ServiceURLs = new Dictionary <string, object>(); string str = results["ServiceURLs"].ToString(); if (str != string.Empty) { string[] parts = str.Split(new char[] { ';' }); foreach (string s in parts) { string[] parts2 = s.Split(new char[] { '*' }); if (parts2.Length == 2) { UDA.ServiceURLs[parts2[0]] = parts2[1]; } } } } UserAccountService.StoreUserAccount(UDA); replyData = WebUtils.ParseXmlResponse(file[2]); IUserProfileInfo UPI = new IUserProfileInfo(); UPI.FromKVP(replyData["result"] as Dictionary <string, object>); //Update the principle ID to the new user. UPI.PrincipalID = UDA.PrincipalID; IProfileConnector profileData = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); if (profileData.GetUserProfile(UPI.PrincipalID) == null) { profileData.CreateNewProfile(UPI.PrincipalID); } profileData.UpdateUserProfile(UPI); m_log.Info("[AvatarProfileArchiver] Loaded Avatar Profile from " + cmdparams[5]); }
OSDMap GetProfile(OSDMap map) { OSDMap resp = new OSDMap(); string Name = map ["Name"].AsString(); UUID userID = map ["UUID"].AsUUID(); UserAccount account = Name != "" ? m_registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, Name) : m_registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, userID); if (account != null) { OSDMap accountMap = new OSDMap(); accountMap ["Created"] = account.Created; accountMap ["Name"] = account.Name; accountMap ["PrincipalID"] = account.PrincipalID; accountMap ["Email"] = account.Email; TimeSpan diff = DateTime.Now - Util.ToDateTime(account.Created); int years = (int)diff.TotalDays / 356; int days = years > 0 ? (int)diff.TotalDays / years : (int)diff.TotalDays; accountMap ["TimeSinceCreated"] = years + " years, " + days + " days"; // if we're sending account.Created do we really need to send this string ? IProfileConnector profileConnector = DataPlugins.RequestPlugin <IProfileConnector> (); IUserProfileInfo profile = profileConnector.GetUserProfile(account.PrincipalID); if (profile != null) { resp ["profile"] = profile.ToOSD(false); //not trusted, use false if (account.UserFlags == 0) { account.UserFlags = 2; //Set them to no info given } string flags = ((IUserProfileInfo.ProfileFlags)account.UserFlags).ToString(); IUserProfileInfo.ProfileFlags.NoPaymentInfoOnFile.ToString(); accountMap ["AccountInfo"] = (profile.CustomType != "" ? profile.CustomType : account.UserFlags == 0 ? "Resident" : "Admin") + "\n" + flags; UserAccount partnerAccount = m_registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, profile.Partner); if (partnerAccount != null) { accountMap ["Partner"] = partnerAccount.Name; accountMap ["PartnerUUID"] = partnerAccount.PrincipalID; } else { accountMap ["Partner"] = ""; accountMap ["PartnerUUID"] = UUID.Zero; } } IAgentConnector agentConnector = DataPlugins.RequestPlugin <IAgentConnector> (); IAgentInfo agent = agentConnector.GetAgent(account.PrincipalID); if (agent != null) { OSDMap agentMap = new OSDMap(); agentMap ["RLName"] = agent.OtherAgentInformation ["RLName"].AsString(); agentMap ["RLGender"] = agent.OtherAgentInformation ["RLGender"].AsString(); agentMap ["RLAddress"] = agent.OtherAgentInformation ["RLAddress"].AsString(); agentMap ["RLZip"] = agent.OtherAgentInformation ["RLZip"].AsString(); agentMap ["RLCity"] = agent.OtherAgentInformation ["RLCity"].AsString(); agentMap ["RLCountry"] = agent.OtherAgentInformation ["RLCountry"].AsString(); resp ["agent"] = agentMap; } resp ["account"] = accountMap; } return(resp); }
private byte[] ProcessCreateAccount(OSDMap map) { bool Verified = false; string Name = map["Name"].AsString(); string PasswordHash = map["PasswordHash"].AsString(); //string PasswordSalt = map["PasswordSalt"].AsString(); string HomeRegion = map["HomeRegion"].AsString(); string Email = map["Email"].AsString(); string AvatarArchive = map["AvatarArchive"].AsString(); IUserAccountService accountService = m_registry.RequestModuleInterface <IUserAccountService>(); if (accountService == null) { return(null); } if (!PasswordHash.StartsWith("$1$")) { PasswordHash = "$1$" + Util.Md5Hash(PasswordHash); } PasswordHash = PasswordHash.Remove(0, 3); //remove $1$ accountService.CreateUser(Name, PasswordHash, Email); UserAccount user = accountService.GetUserAccount(UUID.Zero, Name); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); IGridService gridService = m_registry.RequestModuleInterface <IGridService> (); if (agentInfoService != null && gridService != null) { GridRegion r = gridService.GetRegionByName(UUID.Zero, HomeRegion); agentInfoService.SetHomePosition(user.PrincipalID.ToString(), r.RegionID, new Vector3(r.RegionSizeX / 2, r.RegionSizeY / 2, 20), Vector3.Zero); } Verified = user != null; UUID userID = UUID.Zero; if (Verified) { // could not find a way to save this data here. /*DateTime RLDOB = map["RLDOB"].AsDate(); * string RLFirstName = map["RLFisrtName"].AsString(); * string RLLastName = map["RLLastName"].AsString(); * string RLAdress = map["RLAdress"].AsString(); * string RLCity = map["RLCity"].AsString(); * string RLZip = map["RLZip"].AsString(); * string RLCountry = map["RLCountry"].AsString(); * string RLIP = map["RLIP"].AsString();*/ // could not find a way to save this data here. userID = user.PrincipalID; user.UserLevel = -1; accountService.StoreUserAccount(user); IProfileConnector profileData = DataManager.RequestPlugin <IProfileConnector>(); IUserProfileInfo profile = profileData.GetUserProfile(user.PrincipalID); if (profile == null) { profileData.CreateNewProfile(user.PrincipalID); profile = profileData.GetUserProfile(user.PrincipalID); } if (AvatarArchive.Length > 0) { profile.AArchiveName = AvatarArchive + ".database"; } profile.IsNewUser = true; profileData.UpdateUserProfile(profile); } OSDMap resp = new OSDMap(); resp["Verified"] = OSD.FromBoolean(Verified); resp["UUID"] = OSD.FromUUID(userID); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
public void AddRegion(IScene scene) { if (!m_ProfileEnabled) return; ProfileFrontend = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>(); if (ProfileFrontend == null) return; m_Scene = scene; scene.EventManager.OnNewClient += NewClient; scene.EventManager.OnClosingClient += OnClosingClient; }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); if (requestParameters.ContainsKey("Submit")) { string AvatarName = requestParameters["AvatarName"].ToString(); string AvatarPassword = requestParameters["AvatarPassword"].ToString(); string FirstName = requestParameters["FirstName"].ToString(); string LastName = requestParameters["LastName"].ToString(); string UserAddress = requestParameters["UserAddress"].ToString(); string UserZip = requestParameters["UserZip"].ToString(); string UserCity = requestParameters["UserCity"].ToString(); string UserEmail = requestParameters["UserEmail"].ToString(); string UserDOBMonth = requestParameters["UserDOBMonth"].ToString(); string UserDOBDay = requestParameters["UserDOBDay"].ToString(); string UserDOBYear = requestParameters["UserDOBYear"].ToString(); string AvatarArchive = requestParameters.ContainsKey("AvatarArchive") ? requestParameters["AvatarArchive"].ToString() : ""; bool ToSAccept = requestParameters.ContainsKey("ToSAccept") && requestParameters["ToSAccept"].ToString() == "Accepted"; IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>(); var settings = generics.GetGeneric <GridSettings>(UUID.Zero, "WebSettings", "Settings"); if (ToSAccept) { AvatarPassword = Util.Md5Hash(AvatarPassword); IUserAccountService accountService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); UUID userID = UUID.Random(); string error = accountService.CreateUser(userID, settings.DefaultScopeID, AvatarName, AvatarPassword, UserEmail); if (error == "") { IAgentConnector con = Aurora.DataManager.DataManager.RequestPlugin <IAgentConnector>(); con.CreateNewAgent(userID); IAgentInfo agent = con.GetAgent(userID); agent.OtherAgentInformation["RLFirstName"] = FirstName; agent.OtherAgentInformation["RLLastName"] = LastName; agent.OtherAgentInformation["RLAddress"] = UserAddress; agent.OtherAgentInformation["RLCity"] = UserCity; agent.OtherAgentInformation["RLZip"] = UserZip; agent.OtherAgentInformation["UserDOBMonth"] = UserDOBMonth; agent.OtherAgentInformation["UserDOBDay"] = UserDOBDay; agent.OtherAgentInformation["UserDOBYear"] = UserDOBYear; /*if (activationRequired) * { * UUID activationToken = UUID.Random(); * agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash); * resp["WebUIActivationToken"] = activationToken; * }*/ con.UpdateAgent(agent); if (AvatarArchive != "") { IProfileConnector profileData = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); profileData.CreateNewProfile(userID); IUserProfileInfo profile = profileData.GetUserProfile(userID); profile.AArchiveName = AvatarArchive + ".database"; profile.IsNewUser = true; profileData.UpdateUserProfile(profile); } response = "<h3>Successfully created account, redirecting to main page</h3>" + "<script language=\"javascript\">" + "setTimeout(function() {window.location.href = \"index.html\";}, 3000);" + "</script>"; } else { response = "<h3>" + error + "</h3>"; } } else { response = "<h3>You did not accept the Terms of Service agreement.</h3>"; } return(null); } List <Dictionary <string, object> > daysArgs = new List <Dictionary <string, object> >(); for (int i = 1; i <= 31; i++) { daysArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > monthsArgs = new List <Dictionary <string, object> >(); for (int i = 1; i <= 12; i++) { monthsArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > yearsArgs = new List <Dictionary <string, object> >(); for (int i = 1900; i <= 2013; i++) { yearsArgs.Add(new Dictionary <string, object> { { "Value", i } }); } vars.Add("Days", daysArgs); vars.Add("Months", monthsArgs); vars.Add("Years", yearsArgs); List <AvatarArchive> archives = Aurora.DataManager.DataManager.RequestPlugin <IAvatarArchiverConnector>().GetAvatarArchives(true); List <Dictionary <string, object> > avatarArchives = new List <Dictionary <string, object> >(); IWebHttpTextureService webTextureService = webInterface.Registry. RequestModuleInterface <IWebHttpTextureService>(); foreach (var archive in archives) { avatarArchives.Add(new Dictionary <string, object> { { "AvatarArchiveName", archive.Name }, { "AvatarArchiveSnapshotID", archive.Snapshot }, { "AvatarArchiveSnapshotURL", webTextureService.GetTextureURL(UUID.Parse(archive.Snapshot)) } }); } vars.Add("AvatarArchive", avatarArchives); IConfig loginServerConfig = webInterface.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs["LoginService"]; string tosLocation = ""; if (loginServerConfig != null && loginServerConfig.GetBoolean("UseTermsOfServiceOnFirstLogin", false)) { tosLocation = loginServerConfig.GetString("FileNameOfTOS", ""); } string ToS = "There are no Terms of Service currently. This may be changed at any point in the future."; if (tosLocation != "") { System.IO.StreamReader reader = new System.IO.StreamReader(System.IO.Path.Combine(Environment.CurrentDirectory, tosLocation)); ToS = reader.ReadToEnd(); reader.Close(); } vars.Add("ToSMessage", ToS); vars.Add("TermsOfServiceAccept", translator.GetTranslatedString("TermsOfServiceAccept")); vars.Add("TermsOfServiceText", translator.GetTranslatedString("TermsOfServiceText")); vars.Add("RegistrationsDisabled", translator.GetTranslatedString("RegistrationsDisabled")); vars.Add("RegistrationText", translator.GetTranslatedString("RegistrationText")); vars.Add("AvatarNameText", translator.GetTranslatedString("AvatarNameText")); vars.Add("AvatarPasswordText", translator.GetTranslatedString("Password")); vars.Add("AvatarPasswordConfirmationText", translator.GetTranslatedString("PasswordConfirmation")); vars.Add("AvatarScopeText", translator.GetTranslatedString("AvatarScopeText")); vars.Add("FirstNameText", translator.GetTranslatedString("FirstNameText")); vars.Add("LastNameText", translator.GetTranslatedString("LastNameText")); vars.Add("UserAddressText", translator.GetTranslatedString("UserAddressText")); vars.Add("UserZipText", translator.GetTranslatedString("UserZipText")); vars.Add("UserCityText", translator.GetTranslatedString("UserCityText")); vars.Add("UserCountryText", translator.GetTranslatedString("UserCountryText")); vars.Add("UserDOBText", translator.GetTranslatedString("UserDOBText")); vars.Add("UserEmailText", translator.GetTranslatedString("UserEmailText")); vars.Add("Accept", translator.GetTranslatedString("Accept")); vars.Add("Submit", translator.GetTranslatedString("Submit")); vars.Add("SubmitURL", "register.html"); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); string username = filename.Split('/').LastOrDefault(); UserAccount account = null; if (httpRequest.Query.ContainsKey("userid")) { string userid = httpRequest.Query["userid"].ToString(); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, UUID.Parse(userid)); } else if (httpRequest.Query.ContainsKey("name") || username.Contains('.')) { string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username; name = name.Replace('.', ' '); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, name); } else { username = username.Replace("%20", " "); account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, username); } if (account == null) { return(vars); } vars.Add("UserName", account.Name); IProfileConnector profileConnector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(); IUserProfileInfo profile = profileConnector == null ? null : profileConnector.GetUserProfile(account.PrincipalID); vars.Add("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup); IWebHttpTextureService webhttpService = webInterface.Registry.RequestModuleInterface <IWebHttpTextureService>(); if (profile != null) { if (profile.Partner != UUID.Zero) { account = webInterface.Registry.RequestModuleInterface <IUserAccountService>(). GetUserAccount(null, profile.Partner); vars.Add("UserPartner", account.Name); } else { vars.Add("UserPartner", "No partner"); } vars.Add("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText); string url = "../images/icons/no_picture.jpg"; if (webhttpService != null && profile.Image != UUID.Zero) { url = webhttpService.GetTextureURL(profile.Image); } vars.Add("UserPictureURL", url); List <Dictionary <string, object> > picks = new List <Dictionary <string, object> >(); foreach (var pick in profileConnector.GetPicks(profile.PrincipalID)) { url = "../images/icons/no_picture.jpg"; if (webhttpService != null && pick.SnapshotUUID != UUID.Zero) { url = webhttpService.GetTextureURL(pick.SnapshotUUID); } picks.Add(new Dictionary <string, object> { { "PickSnapshotURL", url }, { "PickName", pick.OriginalName }, { "PickSim", pick.SimName }, { "PickLocation", pick.GlobalPos } }); } vars.Add("Picks", picks); } vars.Add("UsersPicksText", translator.GetTranslatedString("UsersPicksText")); return(vars); }
public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest, OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response) { response = null; var vars = new Dictionary <string, object>(); string error = ""; UUID userID = httpRequest.Query.ContainsKey("userid") ? UUID.Parse(httpRequest.Query["userid"].ToString()) : UUID.Parse(requestParameters["userid"].ToString()); IUserAccountService userService = webInterface.Registry.RequestModuleInterface <IUserAccountService>(); var agentService = Framework.Utilities.DataManager.RequestPlugin <IAgentConnector>(); UserAccount account = userService.GetUserAccount(null, userID); IAgentInfo agent = agentService.GetAgent(userID); if (agent == null) { error = "No agent information is available"; } // Set user type if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitSetUserType") { string UserType = requestParameters ["UserType"].ToString(); int UserFlags = webInterface.UserTypeToUserFlags(UserType); // set the user account type account.UserFlags = UserFlags; userService.StoreUserAccount(account); if (agent != null) { agent.OtherAgentInformation ["UserFlags"] = UserFlags; agentService.UpdateAgent(agent); response = "User has been updated."; } else { response = "Agent information is not available! Has the user logged in yet?"; } IProfileConnector profileData = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(); if (profileData != null) { IUserProfileInfo profile = profileData.GetUserProfile(userID); if (profile == null) { profileData.CreateNewProfile(userID); profile = profileData.GetUserProfile(userID); } profile.MembershipGroup = webInterface.UserFlagToType(UserFlags, webInterface.EnglishTranslator); // membership is english profileData.UpdateUserProfile(profile); } response = "User has been updated."; return(null); } // Password change if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitPasswordChange") { string password = requestParameters["password"].ToString(); string passwordconf = requestParameters["passwordconf"].ToString(); if (password != passwordconf) { response = "Passwords do not match"; } else { IAuthenticationService authService = webInterface.Registry.RequestModuleInterface <IAuthenticationService>(); if (authService != null) { response = authService.SetPassword(userID, "UserAccount", password) ? "Successfully set password" : "Failed to set your password, try again later"; } else { response = "No authentication service was available to change your password"; } } return(null); } // Email change if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitEmailChange") { string email = requestParameters["email"].ToString(); if (userService != null) { account.Email = email; userService.StoreUserAccount(account); response = "Successfully updated email"; } else { response = "No authentication service was available to change your password"; } return(null); } // Delete user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitDeleteUser") { string username = requestParameters["username"].ToString(); response = "Deleted user successfully"; if (username == account.Name) { userService.DeleteUser(account.PrincipalID, account.Name, "", false, false); } else { response = "The user name did not match"; } return(null); } // Temp Ban user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitTempBanUser") { int timeDays = int.Parse(requestParameters["TimeDays"].ToString()); int timeHours = int.Parse(requestParameters["TimeHours"].ToString()); int timeMinutes = int.Parse(requestParameters["TimeMinutes"].ToString()); if (agent != null) { agent.Flags |= IAgentFlags.TempBan; DateTime until = DateTime.Now.AddDays(timeDays).AddHours(timeHours).AddMinutes(timeMinutes); agent.OtherAgentInformation ["TemperaryBanInfo"] = until; agentService.UpdateAgent(agent); response = "User has been banned."; } else { response = "Agent information is not available! Has the user logged in yet?"; } return(null); } // Ban user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitBanUser") { if (agent != null) { agent.Flags |= IAgentFlags.PermBan; agentService.UpdateAgent(agent); response = "User has been banned."; } else { response = "Agent information is not available! Has the user logged in yet?"; } return(null); } //UnBan user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitUnbanUser") { if (agent != null) { agent.Flags &= ~IAgentFlags.TempBan; agent.Flags &= ~IAgentFlags.PermBan; agent.OtherAgentInformation.Remove("TemperaryBanInfo"); agentService.UpdateAgent(agent); response = "User has been unbanned."; } else { response = "Agent information is not available! Has the user logged in yet?"; } return(null); } // Login as user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitLoginAsUser") { Authenticator.ChangeAuthentication(httpRequest, account); webInterface.Redirect(httpResponse, "/"); return(vars); } // Kick user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitKickUser") { string message = requestParameters["KickMessage"].ToString(); IGridWideMessageModule messageModule = webInterface.Registry.RequestModuleInterface <IGridWideMessageModule>(); if (messageModule != null) { messageModule.KickUser(account.PrincipalID, message); } response = "User has been kicked."; return(null); } // Message user if (requestParameters.ContainsKey("Submit") && requestParameters["Submit"].ToString() == "SubmitMessageUser") { string message = requestParameters["Message"].ToString(); IGridWideMessageModule messageModule = webInterface.Registry.RequestModuleInterface <IGridWideMessageModule>(); if (messageModule != null) { messageModule.MessageUser(account.PrincipalID, message); } response = "User has been sent the message."; return(null); } // page variables string bannedUntil = ""; bool userBanned = agent == null ? false : ((agent.Flags & IAgentFlags.PermBan) == IAgentFlags.PermBan || (agent.Flags & IAgentFlags.TempBan) == IAgentFlags.TempBan); bool TempUserBanned = false; if (userBanned) { if ((agent.Flags & IAgentFlags.TempBan) == IAgentFlags.TempBan && agent.OtherAgentInformation["TemperaryBanInfo"].AsDate() < DateTime.Now.ToUniversalTime()) { userBanned = false; agent.Flags &= ~IAgentFlags.TempBan; agent.Flags &= ~IAgentFlags.PermBan; agent.OtherAgentInformation.Remove("TemperaryBanInfo"); agentService.UpdateAgent(agent); } else { DateTime bannedTime = agent.OtherAgentInformation["TemperaryBanInfo"].AsDate(); TempUserBanned = bannedTime != Util.UnixEpoch; bannedUntil = string.Format("{0} {1}", bannedTime.ToShortDateString(), bannedTime.ToLongTimeString()); } } bool userOnline = false; IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface <IAgentInfoService>(); if (agentInfoService != null) { UserInfo info = agentInfoService.GetUserInfo(account.PrincipalID.ToString()); userOnline = info != null ? info.IsOnline : false; } vars.Add("UserOnline", userOnline); vars.Add("NotUserBanned", !userBanned); vars.Add("UserBanned", userBanned); vars.Add("TempUserBanned", TempUserBanned); vars.Add("BannedUntil", bannedUntil); vars.Add("EmailValue", account.Email); vars.Add("UserID", account.PrincipalID); vars.Add("UserName", account.Name); vars.Add("ErrorMessage", error); vars.Add("ChangeUserInformationText", translator.GetTranslatedString("ChangeUserInformationText")); vars.Add("ChangePasswordText", translator.GetTranslatedString("ChangePasswordText")); vars.Add("NewPasswordText", translator.GetTranslatedString("NewPasswordText")); vars.Add("NewPasswordConfirmationText", translator.GetTranslatedString("NewPasswordConfirmationText")); vars.Add("ChangeEmailText", translator.GetTranslatedString("ChangeEmailText")); vars.Add("NewEmailText", translator.GetTranslatedString("NewEmailText")); vars.Add("UserNameText", translator.GetTranslatedString("UserNameText")); vars.Add("PasswordText", translator.GetTranslatedString("PasswordText")); vars.Add("DeleteUserText", translator.GetTranslatedString("DeleteUserText")); vars.Add("DeleteText", translator.GetTranslatedString("DeleteText")); vars.Add("DeleteUserInfoText", translator.GetTranslatedString("DeleteUserInfoText")); vars.Add("Submit", translator.GetTranslatedString("Submit")); vars.Add("Login", translator.GetTranslatedString("Login")); vars.Add("TypeUserNameToConfirm", translator.GetTranslatedString("TypeUserNameToConfirm")); vars.Add("AdminUserTypeInfoText", translator.GetTranslatedString("AdminUserTypeInfoText")); vars.Add("AdminSetUserTypeText", translator.GetTranslatedString("UserTypeText")); vars.Add("AdminLoginInAsUserText", translator.GetTranslatedString("AdminLoginInAsUserText")); vars.Add("AdminLoginInAsUserInfoText", translator.GetTranslatedString("AdminLoginInAsUserInfoText")); vars.Add("AdminDeleteUserText", translator.GetTranslatedString("AdminDeleteUserText")); vars.Add("AdminDeleteUserInfoText", translator.GetTranslatedString("AdminDeleteUserInfoText")); vars.Add("AdminUnbanUserText", translator.GetTranslatedString("AdminUnbanUserText")); vars.Add("AdminTempBanUserText", translator.GetTranslatedString("AdminTempBanUserText")); vars.Add("AdminTempBanUserInfoText", translator.GetTranslatedString("AdminTempBanUserInfoText")); vars.Add("AdminBanUserText", translator.GetTranslatedString("AdminBanUserText")); vars.Add("AdminBanUserInfoText", translator.GetTranslatedString("AdminBanUserInfoText")); vars.Add("BanText", translator.GetTranslatedString("BanText")); vars.Add("UnbanText", translator.GetTranslatedString("UnbanText")); vars.Add("TimeUntilUnbannedText", translator.GetTranslatedString("TimeUntilUnbannedText")); vars.Add("EdittingText", translator.GetTranslatedString("EdittingText")); vars.Add("BannedUntilText", translator.GetTranslatedString("BannedUntilText")); vars.Add("KickAUserInfoText", translator.GetTranslatedString("KickAUserInfoText")); vars.Add("KickAUserText", translator.GetTranslatedString("KickAUserText")); vars.Add("KickMessageText", translator.GetTranslatedString("KickMessageText")); vars.Add("KickUserText", translator.GetTranslatedString("KickUserText")); vars.Add("MessageAUserText", translator.GetTranslatedString("MessageAUserText")); vars.Add("MessageAUserInfoText", translator.GetTranslatedString("MessageAUserInfoText")); vars.Add("MessageUserText", translator.GetTranslatedString("MessageUserText")); List <Dictionary <string, object> > daysArgs = new List <Dictionary <string, object> >(); for (int i = 0; i <= 100; i++) { daysArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > hoursArgs = new List <Dictionary <string, object> >(); for (int i = 0; i <= 23; i++) { hoursArgs.Add(new Dictionary <string, object> { { "Value", i } }); } List <Dictionary <string, object> > minutesArgs = new List <Dictionary <string, object> >(); for (int i = 0; i <= 59; i++) { minutesArgs.Add(new Dictionary <string, object> { { "Value", i } }); } vars.Add("Days", daysArgs); vars.Add("Hours", hoursArgs); vars.Add("Minutes", minutesArgs); vars.Add("DaysText", translator.GetTranslatedString("DaysText")); vars.Add("HoursText", translator.GetTranslatedString("HoursText")); vars.Add("MinutesText", translator.GetTranslatedString("MinutesText")); vars.Add("UserType", webInterface.UserTypeArgs(translator)); return(vars); }
public void RegionLoaded(Scene scene) { if (!m_SearchEnabled) return; //Pull in the services we need ProfileFrontend = DataManager.DataManager.RequestPlugin<IProfileConnector>(); directoryService = Aurora.DataManager.DataManager.RequestPlugin<IDirectoryServiceConnector>(); GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); }
public void Start(IConfigSource config, IRegistryCore registry) { m_AuthenticationService = registry.RequestModuleInterface <IAuthenticationService>(); m_Database = Framework.Utilities.DataManager.RequestPlugin <IUserAccountData>(); m_profileConnector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>(); }
public void AddRegion(IScene scene) { if (!m_ProfileEnabled) return; ProfileFrontend = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> (); if (ProfileFrontend == null) return; m_Scene = scene; scene.EventManager.OnNewClient += NewClient; scene.EventManager.OnClosingClient += OnClosingClient; IScheduledMoneyModule moneyModule = scene.RequestModuleInterface<IScheduledMoneyModule> (); if (moneyModule != null) moneyModule.OnUserDidNotPay += moneyModule_OnUserDidNotPay; }
public void RegionLoaded(Scene scene) { m_eventQueue = scene.RequestModuleInterface <IEventQueueService>(); m_profileConnector = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector>(); }
public ProfileInfoHandler() { ProfileConnector = DataManager.RequestPlugin<IProfileConnector>("IProfileConnectorLocal"); }
public void RegionLoaded(Scene scene) { m_eventQueue = scene.RequestModuleInterface<IEventQueue>(); m_profileConnector = Aurora.DataManager.DataManager.RequestPlugin<IProfileConnector>(); }