/// <summary> /// Update a user's profile (Note: this does not work if the user does not have a profile) /// </summary> /// <param name="Profile"></param> /// <returns></returns> public bool UpdateUserProfile(IUserProfileInfo Profile) { IUserProfileInfo previousProfile = GetUserProfile(Profile.PrincipalID); //Make sure the previous one exists if (previousProfile == null) { return(false); } //Now fix values that the sim cannot change Profile.Partner = previousProfile.Partner; Profile.CustomType = previousProfile.CustomType; Profile.MembershipGroup = previousProfile.MembershipGroup; Profile.Created = previousProfile.Created; List <object> SetValues = new List <object>(); List <string> SetRows = new List <string>(); SetRows.Add("Value"); SetValues.Add(OSDParser.SerializeLLSDXmlString(Profile.ToOSD())); List <object> KeyValue = new List <object>(); List <string> KeyRow = new List <string>(); KeyRow.Add("ID"); KeyValue.Add(Profile.PrincipalID.ToString()); KeyRow.Add("`Key`"); KeyValue.Add("LLProfile"); //Update cache UserProfilesCache[Profile.PrincipalID] = Profile; return(GD.Update("userdata", SetValues.ToArray(), SetRows.ToArray(), KeyRow.ToArray(), KeyValue.ToArray())); }
public byte[] GetProfile(OSDMap request) { UUID principalID = request["PrincipalID"].AsUUID(); IUserProfileInfo UserProfile = ProfileConnector.GetUserProfile(principalID); OSDMap result = UserProfile != null?UserProfile.ToOSD() : new OSDMap(); string xmlString = OSDParser.SerializeJsonString(result); //m_log.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
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)); }
/// <summary> /// Create a new profile for a user /// </summary> /// <param name="AgentID"></param> public void CreateNewProfile(UUID AgentID) { List <object> values = new List <object> { AgentID.ToString(), "LLProfile" }; //Create a new basic profile for them IUserProfileInfo profile = new IUserProfileInfo { PrincipalID = AgentID }; values.Add(OSDParser.SerializeLLSDXmlString(profile.ToOSD())); //Value which is a default Profile GD.Insert(m_userProfileTable, values.ToArray()); }
/// <summary> /// Create a new profile for a user /// </summary> /// <param name="AgentID"></param> public void CreateNewProfile(UUID AgentID) { List <object> values = new List <object>(); values.Add(AgentID.ToString()); //ID values.Add("LLProfile"); //Key //Create a new basic profile for them IUserProfileInfo profile = new IUserProfileInfo(); profile.PrincipalID = AgentID; values.Add(OSDParser.SerializeLLSDXmlString(profile.ToOSD())); //Value which is a default Profile GD.Insert("userdata", values.ToArray()); }
/// <summary> /// Create a new profile for a user /// </summary> /// <param name="AgentID"></param> //[CanBeReflected(ThreatLevel = ThreatLevel.Full)] public void CreateNewProfile(UUID AgentID) { /*object remoteValue = DoRemote(AgentID); * if (remoteValue != null || m_doRemoteOnly) * return;*/ List <object> values = new List <object> { AgentID.ToString(), "LLProfile" }; //Create a new basic profile for them IUserProfileInfo profile = new IUserProfileInfo { PrincipalID = AgentID }; values.Add(OSDParser.SerializeLLSDXmlString(profile.ToOSD())); //Value which is a default Profile GD.Insert(m_userProfileTable, values.ToArray()); }
public bool UpdateUserProfile(IUserProfileInfo Profile) { try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService> ().FindValueOf(Profile.PrincipalID.ToString(), "RemoteServerURI"); foreach (string url in serverURIs) { OSDMap map = new OSDMap(); map["Method"] = "updateprofile"; map["Profile"] = Profile.ToOSD(); WebUtils.PostToService(url + "osd", map); } return(true); } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e.ToString()); } return(false); }
public bool UpdateUserProfile(IUserProfileInfo Profile) { object remoteValue = DoRemote(Profile); if (remoteValue != null || m_doRemoteOnly) { return(remoteValue != null && (bool)remoteValue); } IUserProfileInfo previousProfile = GetUserProfile(Profile.PrincipalID); //Make sure the previous one exists if (previousProfile == null) { return(false); } //Now fix values that the sim cannot change Profile.Partner = previousProfile.Partner; Profile.CustomType = previousProfile.CustomType; Profile.MembershipGroup = previousProfile.MembershipGroup; Profile.Created = previousProfile.Created; Dictionary <string, object> values = new Dictionary <string, object>(1); values["Value"] = OSDParser.SerializeLLSDXmlString(Profile.ToOSD()); QueryFilter filter = new QueryFilter(); filter.andFilters["ID"] = Profile.PrincipalID.ToString(); filter.andFilters["`Key`"] = "LLProfile"; //Update cache lock (UserProfilesCache) UserProfilesCache[Profile.PrincipalID] = Profile; return(GD.Update("userdata", values, null, filter, null, null)); }
public bool UpdateUserProfile(IUserProfileInfo Profile) { object remoteValue = DoRemote(Profile); if (remoteValue != null || m_doRemoteOnly) return remoteValue != null && (bool) remoteValue; IUserProfileInfo previousProfile = GetUserProfile(Profile.PrincipalID); //Make sure the previous one exists if (previousProfile == null) return false; //Now fix values that the sim cannot change Profile.Partner = previousProfile.Partner; Profile.CustomType = previousProfile.CustomType; Profile.MembershipGroup = previousProfile.MembershipGroup; Profile.Created = previousProfile.Created; Dictionary<string, object> values = new Dictionary<string, object>(1); values["Value"] = OSDParser.SerializeLLSDXmlString(Profile.ToOSD()); QueryFilter filter = new QueryFilter(); filter.andFilters["ID"] = Profile.PrincipalID.ToString(); filter.andFilters["`Key`"] = "LLProfile"; //Update cache lock(UserProfilesCache) UserProfilesCache[Profile.PrincipalID] = Profile; return GD.Update("userdata", values, null, filter, null, null); }
/// <summary> /// Create a new profile for a user /// </summary> /// <param name="AgentID"></param> //[CanBeReflected(ThreatLevel = ThreatLevel.Full)] public void CreateNewProfile(UUID AgentID) { /*object remoteValue = DoRemote(AgentID); if (remoteValue != null || m_doRemoteOnly) return;*/ List<object> values = new List<object> {AgentID.ToString(), "LLProfile"}; //Create a new basic profile for them IUserProfileInfo profile = new IUserProfileInfo {PrincipalID = AgentID}; values.Add(OSDParser.SerializeLLSDXmlString(profile.ToOSD())); //Value which is a default Profile GD.Insert("userdata", values.ToArray()); }
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); }