diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs index a0c592e398..cd39296512 100644 --- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs +++ b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs @@ -220,7 +220,11 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager new LocalUserServices( m_openSim.NetServersInfo.DefaultHomeLocX, m_openSim.NetServersInfo.DefaultHomeLocY, inventoryService); localuserService.AddPlugin(m_openSim.ConfigurationSettings.StandaloneUserPlugin, m_openSim.ConfigurationSettings.StandaloneUserSource); + HGUserServices userService = new HGUserServices(localuserService); + // This plugin arrangement could eventually be configurable rather than hardcoded here. + OGS1UserDataPlugin userDataPlugin = new OGS1UserDataPlugin(m_commsManager); + userService.AddPlugin(userDataPlugin); HGGridServicesStandalone gridService = new HGGridServicesStandalone(m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager); diff --git a/OpenSim/Data/IUserData.cs b/OpenSim/Data/IUserData.cs index 1564033ba3..9ac923fc1e 100644 --- a/OpenSim/Data/IUserData.cs +++ b/OpenSim/Data/IUserData.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; @@ -48,8 +49,15 @@ namespace OpenSim.Data /// /// Account firstname /// Account lastname - /// The user data profile + /// The user data profile. Null if no user is found UserProfileData GetUserByName(string fname, string lname); + + /// + /// Get a user from a given uri. + /// + /// + /// The user data profile. Null if no user is found. + UserProfileData GetUserByUri(Uri uri); /// /// Returns a list of UUIDs firstnames and lastnames that match string query entered into the avatar picker. @@ -63,7 +71,7 @@ namespace OpenSim.Data /// Returns the current agent for a user searching by it's UUID /// /// The users UUID - /// The current agent session + /// The current agent session. Null if no session was found UserAgentData GetAgentByUUID(UUID user); /// diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index 0fa9e58817..167a837142 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; @@ -42,6 +43,7 @@ namespace OpenSim.Data public abstract UserAgentData GetAgentByUUID(UUID user); public abstract UserAgentData GetAgentByName(string name); public abstract UserAgentData GetAgentByName(string fname, string lname); + public UserProfileData GetUserByUri(Uri uri) { return null; } public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey); public abstract void AddNewUserProfile(UserProfileData user); public abstract bool UpdateUserProfile(UserProfileData user); diff --git a/OpenSim/Framework/Communications/IAvatarService.cs b/OpenSim/Framework/Communications/IAvatarService.cs index 3822e9f8ee..db583e1fe2 100644 --- a/OpenSim/Framework/Communications/IAvatarService.cs +++ b/OpenSim/Framework/Communications/IAvatarService.cs @@ -31,10 +31,18 @@ namespace OpenSim.Framework.Communications { public interface IAvatarService { - /// Get's the User Appearance + /// + /// Get avatar appearance information + /// + /// + /// AvatarAppearance GetUserAppearance(UUID user); + /// + /// Update avatar appearance information + /// + /// + /// void UpdateUserAppearance(UUID user, AvatarAppearance appearance); - } } diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 72a428186a..1b7136792c 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -1147,14 +1147,15 @@ namespace OpenSim.Framework.Communications.Services if (m_userManager.VerifySession(guess_aid, guess_sid)) { authed = "TRUE"; + m_log.InfoFormat("[UserManager]: CheckAuthSession TRUE for user {0}", guess_aid); + } + else + { + m_log.InfoFormat("[UserManager]: CheckAuthSession FALSE"); + return Util.CreateUnknownUserErrorResponse(); } - m_log.InfoFormat("[UserManager]: CheckAuthSession TRUE for user {0}", guess_aid); - } - else - { - m_log.InfoFormat("[UserManager]: CheckAuthSession FALSE"); - return Util.CreateUnknownUserErrorResponse(); } + Hashtable responseData = new Hashtable(); responseData["auth_session"] = authed; response.Value = responseData; diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 1115041484..3b43622c92 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -50,7 +50,7 @@ namespace OpenSim.Framework.Communications /// /// List of plugins to search for user data /// - private List _plugins = new List(); + private List m_plugins = new List(); protected IInterServiceInventoryServices m_interServiceInventoryService; @@ -69,7 +69,7 @@ namespace OpenSim.Framework.Communications /// The plugin that will provide user data public void AddPlugin(IUserDataPlugin plugin) { - _plugins.Add(plugin); + m_plugins.Add(plugin); } /// @@ -84,15 +84,15 @@ namespace OpenSim.Framework.Communications /// public void AddPlugin(string provider, string connect) { - _plugins.AddRange(DataPluginFactory.LoadDataPlugins(provider, connect)); + m_plugins.AddRange(DataPluginFactory.LoadDataPlugins(provider, connect)); } #region Get UserProfile // see IUserService - public UserProfileData GetUserProfile(string fname, string lname) + public virtual UserProfileData GetUserProfile(string fname, string lname) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { UserProfileData profile = plugin.GetUserByName(fname, lname); @@ -108,7 +108,7 @@ namespace OpenSim.Framework.Communications public void LogoutUsers(UUID regionID) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { plugin.LogoutUsers(regionID); } @@ -116,7 +116,7 @@ namespace OpenSim.Framework.Communications public void ResetAttachments(UUID userID) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { plugin.ResetAttachments(userID); } @@ -124,12 +124,20 @@ namespace OpenSim.Framework.Communications public UserProfileData GetUserProfile(Uri uri) { - throw new NotImplementedException(); + foreach (IUserDataPlugin plugin in m_plugins) + { + UserProfileData profile = plugin.GetUserByUri(uri); + + if (null != profile) + return profile; + } + + return null; } - public UserAgentData GetAgentByUUID(UUID userId) + public virtual UserAgentData GetAgentByUUID(UUID userId) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { UserAgentData agent = plugin.GetAgentByUUID(userId); @@ -150,7 +158,7 @@ namespace OpenSim.Framework.Communications // see IUserService public virtual UserProfileData GetUserProfile(UUID uuid) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { UserProfileData profile = plugin.GetUserByUUID(uuid); @@ -164,10 +172,10 @@ namespace OpenSim.Framework.Communications return null; } - public List GenerateAgentPickerRequestResponse(UUID queryID, string query) + public virtual List GenerateAgentPickerRequestResponse(UUID queryID, string query) { List pickerlist = new List(); - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -188,9 +196,9 @@ namespace OpenSim.Framework.Communications /// /// /// - public bool UpdateUserProfile(UserProfileData data) + public virtual bool UpdateUserProfile(UserProfileData data) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -217,7 +225,7 @@ namespace OpenSim.Framework.Communications /// Agent profiles public UserAgentData GetUserAgent(UUID uuid) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -244,7 +252,7 @@ namespace OpenSim.Framework.Communications /// A user agent public UserAgentData GetUserAgent(string name) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -267,7 +275,7 @@ namespace OpenSim.Framework.Communications /// A user agent public UserAgentData GetUserAgent(string fname, string lname) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -287,9 +295,9 @@ namespace OpenSim.Framework.Communications /// /// the UUID of the friend list owner /// A List of FriendListItems that contains info about the user's friends - public List GetUserFriendList(UUID ownerID) + public virtual List GetUserFriendList(UUID ownerID) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -309,9 +317,9 @@ namespace OpenSim.Framework.Communications return null; } - public Dictionary GetFriendRegionInfos (List uuids) + public virtual Dictionary GetFriendRegionInfos (List uuids) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -332,7 +340,7 @@ namespace OpenSim.Framework.Communications public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -345,13 +353,13 @@ namespace OpenSim.Framework.Communications } } - public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) + public virtual void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { - plugin.AddNewUserFriend(friendlistowner,friend,perms); + plugin.AddNewUserFriend(friendlistowner, friend, perms); } catch (Exception e) { @@ -360,9 +368,9 @@ namespace OpenSim.Framework.Communications } } - public void RemoveUserFriend(UUID friendlistowner, UUID friend) + public virtual void RemoveUserFriend(UUID friendlistowner, UUID friend) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -375,9 +383,9 @@ namespace OpenSim.Framework.Communications } } - public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) + public virtual void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -394,7 +402,7 @@ namespace OpenSim.Framework.Communications /// Resets the currentAgent in the user profile /// /// The agent's ID - public void ClearUserAgent(UUID agentID) + public virtual void ClearUserAgent(UUID agentID) { UserProfileData profile = GetUserProfile(agentID); @@ -408,7 +416,6 @@ namespace OpenSim.Framework.Communications UpdateUserProfile(profile); } - #endregion #region CreateAgent @@ -544,7 +551,7 @@ namespace OpenSim.Framework.Communications /// /// /// - public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) + public virtual void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) { if (StatsManager.UserStats != null) StatsManager.UserStats.AddLogout(); @@ -583,15 +590,6 @@ namespace OpenSim.Framework.Communications } } - /// - /// Process a user logoff from OpenSim (deprecated as of 2008-08-27) - /// - /// - /// - /// - /// - /// - /// public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) { LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3()); @@ -643,7 +641,7 @@ namespace OpenSim.Framework.Communications user.HomeRegionY = regY; user.Email = email; - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -669,13 +667,13 @@ namespace OpenSim.Framework.Communications } /// - /// Reset a user password + /// Reset a user password. /// /// /// /// /// true if the update was successful, false otherwise - public bool ResetUserPassword(string firstName, string lastName, string newPassword) + public virtual bool ResetUserPassword(string firstName, string lastName, string newPassword) { string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty); @@ -705,7 +703,7 @@ namespace OpenSim.Framework.Communications /// The agent data to be added public bool AddUserAgent(UserAgentData agentdata) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -725,9 +723,9 @@ namespace OpenSim.Framework.Communications /// /// /// - public AvatarAppearance GetUserAppearance(UUID user) + public virtual AvatarAppearance GetUserAppearance(UUID user) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -741,14 +739,9 @@ namespace OpenSim.Framework.Communications return null; } - /// - /// Update avatar appearance information - /// - /// - /// - public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) + public virtual void UpdateUserAppearance(UUID user, AvatarAppearance appearance) { - foreach (IUserDataPlugin plugin in _plugins) + foreach (IUserDataPlugin plugin in m_plugins) { try { @@ -838,8 +831,8 @@ namespace OpenSim.Framework.Communications return false; } } - - public bool VerifySession(UUID userID, UUID sessionID) + + public virtual bool VerifySession(UUID userID, UUID sessionID) { UserProfileData userProfile = GetUserProfile(userID); @@ -851,6 +844,7 @@ namespace OpenSim.Framework.Communications return true; } } + return false; } diff --git a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs index 6dec026dc3..f76328c2c9 100644 --- a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs +++ b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs @@ -70,6 +70,6 @@ namespace OpenSim.Grid.MessagingServer.Modules { //throw new Exception("The method or operation is not implemented."); return null; - } + } } } diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 795efaa8c0..8881e810df 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -331,6 +331,7 @@ namespace OpenSim.Grid.UserServer.Modules } } } + if (responseSuccess) { handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 2ef0fd3c6e..126823736f 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs @@ -31,6 +31,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; +using OpenSim.Region.Communications.OGS1; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Communications.Hypergrid @@ -51,7 +52,6 @@ namespace OpenSim.Region.Communications.Hypergrid IAssetCache assetCache, SceneManager sman, LibraryRootFolder libraryRootFolder) : base(serversInfo, httpServer, assetCache, false, libraryRootFolder) { - // From constructor at CommunicationsOGS1 HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService); m_gridService = gridInterComms; @@ -63,12 +63,15 @@ namespace OpenSim.Region.Communications.Hypergrid AddSecureInventoryService(invService); m_defaultInventoryHost = invService.Host; if (SecureInventoryService != null) - m_log.Info("[HG] SecureInventoryService."); + m_log.Info("[HG]: SecureInventoryService."); else - m_log.Info("[HG] Non-secureInventoryService."); - + m_log.Info("[HG]: Non-secureInventoryService."); HGUserServices userServices = new HGUserServices(this); + // This plugin arrangement could eventually be configurable rather than hardcoded here. + OGS1UserDataPlugin userDataPlugin = new OGS1UserDataPlugin(this); + userServices.AddPlugin(userDataPlugin); + m_userService = userServices; m_messageService = userServices; m_avatarService = (IAvatarService)m_userService; diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs index 370ef121a8..357d8a62d8 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs @@ -59,6 +59,7 @@ namespace OpenSim.Region.Communications.Hypergrid // Constructor called when running in standalone public HGUserServices(LocalUserServices local) + : base(null) { m_localUserServices = local; } @@ -101,30 +102,12 @@ namespace OpenSim.Region.Communications.Hypergrid base.LogOffUser(userid, regionid, regionhandle, position, lookat); } - /// - /// Logs off a user on the user server (deprecated as of 2008-08-27) - /// - /// UUID of the user - /// UUID of the Region - /// regionhandle - /// final position x - /// final position y - /// final position z - public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) - { - string url = string.Empty; - if ((m_localUserServices != null) && !IsForeignUser(userid, out url)) - m_localUserServices.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); - else - base.LogOffUser(userid, regionid, regionhandle, posx, posy, posz); - } - public override UserProfileData GetUserProfile(string firstName, string lastName) { if (m_localUserServices != null) return m_localUserServices.GetUserProfile(firstName, lastName); - return GetUserProfile(firstName + " " + lastName); + return base.GetUserProfile(firstName, lastName); } public override List GenerateAgentPickerRequestResponse(UUID queryID, string query) @@ -135,18 +118,6 @@ namespace OpenSim.Region.Communications.Hypergrid return base.GenerateAgentPickerRequestResponse(queryID, query); } - /// - /// Get a user profile from the user server - /// - /// - /// null if the request fails - public override UserProfileData GetUserProfile(string name) - { - // This doesn't exist in LocalUserServices - - return base.GetUserProfile(name); - } - /// /// Get a user profile from the user server /// diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index a239033271..eb60610c54 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -80,6 +80,6 @@ namespace OpenSim.Region.Communications.Local throw new Exception("[LOCAL USER SERVICES]: Unknown master user UUID. Possible reason: UserServer is not running."); } return data; - } + } } } diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index f32b160dce..ee8562f274 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -55,7 +55,11 @@ namespace OpenSim.Region.Communications.OGS1 m_defaultInventoryHost = invService.Host; } + // This plugin arrangement could eventually be configurable rather than hardcoded here. OGS1UserServices userServices = new OGS1UserServices(this); + OGS1UserDataPlugin userDataPlugin = new OGS1UserDataPlugin(this); + userServices.AddPlugin(userDataPlugin); + m_userService = userServices; m_messageService = userServices; m_avatarService = (IAvatarService)m_userService; diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs new file mode 100644 index 0000000000..f54345113d --- /dev/null +++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs @@ -0,0 +1,760 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Reflection; +using System.Text.RegularExpressions; +using System.Xml.Serialization; +using log4net; +using Nwc.XmlRpc; +using OpenMetaverse; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Communications.Clients; + +namespace OpenSim.Region.Communications.OGS1 +{ + public class OGS1UserDataPlugin : IUserDataPlugin + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected CommunicationsManager m_commsManager; + + public OGS1UserDataPlugin(CommunicationsManager commsManager) + { + m_log.DebugFormat("[OGS1 USER SERVICES]: {0} initialized", Name); + m_commsManager = commsManager; + } + + public string Version { get { return "0.1"; } } + public string Name { get { return "Open Grid Services 1 (OGS1) User Data Plugin"; } } + public void Initialise() {} + + public void Initialise(string connect) {} + + public void Dispose() {} + + // Arguably the presence of these means that IUserDataPlugin could be fissioned + public UserAgentData GetUserAgent(string name) { return null; } + public UserAgentData GetAgentByName(string name) { return null; } + public UserAgentData GetAgentByName(string fname, string lname) { return null; } + public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {} + public void AddNewUserProfile(UserProfileData user) {} + public void AddNewUserAgent(UserAgentData agent) {} + public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; } + public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; } + public void ResetAttachments(UUID userID) {} + public void LogoutUsers(UUID regionID) {} + + public UserProfileData GetUserByUri(Uri uri) + { + WebRequest request = WebRequest.Create(uri); + + WebResponse webResponse = request.GetResponse(); + + XmlSerializer deserializer = new XmlSerializer(typeof(XmlRpcResponse)); + XmlRpcResponse xmlRpcResponse = (XmlRpcResponse)deserializer.Deserialize(webResponse.GetResponseStream()); + + Hashtable respData = (Hashtable)xmlRpcResponse.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + +// public Uri GetUserUri(UserProfileData userProfile) +// { +// throw new NotImplementedException(); +// } + + public virtual UserAgentData GetAgentByUUID(UUID userId) + { + try + { + Hashtable param = new Hashtable(); + param["avatar_uuid"] = userId.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); + + XmlRpcResponse resp = req.Send(GetUserServerURL(userId), 6000); + Hashtable respData = (Hashtable)resp.Value; + if (respData.Contains("error_type")) + { + //m_log.Warn("[GRID]: " + + // "Error sent by user server when trying to get agent: (" + + // (string) respData["error_type"] + + // "): " + (string)respData["error_desc"]); + return null; + } + UUID sessionid = UUID.Zero; + + UserAgentData userAgent = new UserAgentData(); + userAgent.Handle = Convert.ToUInt64((string)respData["handle"]); + UUID.TryParse((string)respData["sessionid"], out sessionid); + userAgent.SessionID = sessionid; + + if ((string)respData["agent_online"] == "TRUE") + { + userAgent.AgentOnline = true; + } + else + { + userAgent.AgentOnline = false; + } + + return userAgent; + } + catch (Exception e) + { + m_log.ErrorFormat( + "[OGS1 USER SERVICES]: Error when trying to fetch agent data by uuid from remote user server: {0}", + e); + } + + return null; + } + + public virtual UserProfileData GetUserByName(string firstName, string lastName) + { + return GetUserProfile(firstName + " " + lastName); + } + + public virtual List GeneratePickerResults(UUID queryID, string query) + { + List pickerlist = new List(); + Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]"); + try + { + Hashtable param = new Hashtable(); + param["queryid"] = (string)queryID.ToString(); + param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData); + } + catch (WebException e) + { + m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar Picker Response: " + + e.Message); + // Return Empty picker list (no results) + } + return pickerlist; + } + + /// + /// Get a user profile from the user server + /// + /// + /// null if the request fails + protected virtual UserProfileData GetUserProfile(string name) + { + try + { + Hashtable param = new Hashtable(); + param["avatar_name"] = name; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (WebException e) + { + m_log.ErrorFormat( + "[OGS1 USER SERVICES]: Error when trying to fetch profile data by name from remote user server: {0}", + e); + } + + return null; + } + + /// + /// Get a user profile from the user server + /// + /// + /// null if the request fails + public virtual UserProfileData GetUserByUUID(UUID avatarID) + { + try + { + Hashtable param = new Hashtable(); + param["avatar_uuid"] = avatarID.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToUserProfile(respData); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[OGS1 USER SERVICES]: Error when trying to fetch profile data by uuid from remote user server: {0}", + e); + } + + return null; + } + + public virtual bool UpdateUserProfile(UserProfileData userProfile) + { + m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile."); + + Hashtable param = new Hashtable(); + param["avatar_uuid"] = userProfile.ID.ToString(); + //param["AllowPublish"] = userProfile.ToString(); + param["FLImageID"] = userProfile.FirstLifeImage.ToString(); + param["ImageID"] = userProfile.Image.ToString(); + //param["MaturePublish"] = MaturePublish.ToString(); + param["AboutText"] = userProfile.AboutText; + param["FLAboutText"] = userProfile.FirstLifeAboutText; + //param["ProfileURL"] = userProfile.ProfileURL.ToString(); + + param["home_region"] = userProfile.HomeRegion.ToString(); + param["home_region_id"] = userProfile.HomeRegionID.ToString(); + + param["home_pos_x"] = userProfile.HomeLocationX.ToString(); + param["home_pos_y"] = userProfile.HomeLocationY.ToString(); + param["home_pos_z"] = userProfile.HomeLocationZ.ToString(); + param["home_look_x"] = userProfile.HomeLookAtX.ToString(); + param["home_look_y"] = userProfile.HomeLookAtY.ToString(); + param["home_look_z"] = userProfile.HomeLookAtZ.ToString(); + param["user_flags"] = userProfile.UserFlags.ToString(); + param["god_level"] = userProfile.GodLevel.ToString(); + param["custom_type"] = userProfile.CustomType.ToString(); + param["partner"] = userProfile.Partner.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("update_user_profile", parameters); + XmlRpcResponse resp = req.Send(GetUserServerURL(userProfile.ID), 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if (((string)respData["returnString"]).ToUpper() != "TRUE") + { + m_log.Warn("[GRID]: Unable to update user profile, User Server Reported an issue"); + return false; + } + } + else + { + m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!"); + return false; + } + } + else + { + m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!"); + return false; + } + + return true; + } + + /// + /// Adds a new friend to the database for XUser + /// + /// The agent that who's friends list is being added to + /// The agent that being added to the friends list of the friends list owner + /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects + public virtual void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) + { + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.Guid.ToString(); + param["friendID"] = friend.Guid.ToString(); + param["friendPerms"] = perms.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to add new friend, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); + + } + } + catch (WebException e) + { + m_log.Warn("[GRID]: Error when trying to AddNewUserFriend: " + + e.Message); + + } + } + + /// + /// Delete friend on friendlistowner's friendlist. + /// + /// The agent that who's friends list is being updated + /// The Ex-friend agent + public virtual void RemoveUserFriend(UUID friendlistowner, UUID friend) + { + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.Guid.ToString(); + param["friendID"] = friend.Guid.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to remove friend, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); + + } + } + catch (WebException e) + { + m_log.Warn("[GRID]: Error when trying to RemoveUserFriend: " + + e.Message); + + } + } + + /// + /// Update permissions for friend on friendlistowner's friendlist. + /// + /// The agent that who's friends list is being updated + /// The agent that is getting or loosing permissions + /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects + public virtual void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) + { + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.Guid.ToString(); + param["friendID"] = friend.Guid.ToString(); + param["friendPerms"] = perms.ToString(); + IList parameters = new ArrayList(); + parameters.Add(param); + + XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); + Hashtable respData = (Hashtable)resp.Value; + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to update_user_friend_perms, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); + + } + } + catch (WebException e) + { + m_log.Warn("[GRID]: Error when trying to update_user_friend_perms: " + + e.Message); + } + } + /// + /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner + /// + /// The agent that we're retreiving the friends Data. + public virtual List GetUserFriendList(UUID friendlistowner) + { + List buddylist = new List(); + + try + { + Hashtable param = new Hashtable(); + param["ownerID"] = friendlistowner.Guid.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000); + Hashtable respData = (Hashtable)resp.Value; + + if (respData != null && respData.Contains("avcount")) + { + buddylist = ConvertXMLRPCDataToFriendListItemList(respData); + } + + } + catch (WebException e) + { + m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar's friends list: " + + e.Message); + // Return Empty list (no friends) + } + return buddylist; + } + + public virtual Dictionary GetFriendRegionInfos(List uuids) + { + Dictionary result = new Dictionary(); + + // ask MessageServer about the current on-/offline status and regions the friends are in + ArrayList parameters = new ArrayList(); + Hashtable map = new Hashtable(); + + ArrayList list = new ArrayList(); + foreach (UUID uuid in uuids) + { + list.Add(uuid.ToString()); + list.Add(uuid.ToString()); + } + map["uuids"] = list; + + map["recv_key"] = m_commsManager.NetworkServersInfo.UserRecvKey; + map["send_key"] = m_commsManager.NetworkServersInfo.UserSendKey; + + parameters.Add(map); + + try + { + XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.MessagingURL, 8000); + Hashtable respData = resp != null ? (Hashtable)resp.Value : null; + + if (respData == null || respData.ContainsKey("faultMessage")) + { + m_log.WarnFormat("[OGS1 USER SERVICES]: Contacting MessagingServer about user-regions resulted in error: {0}", + respData == null ? "" : respData["faultMessage"]); + } + else if (!respData.ContainsKey("count")) + { + m_log.WarnFormat("[OGS1 USER SERVICES]: Wrong format in response for MessagingServer request get_presence_info_bulk: missing 'count' field"); + } + else + { + int count = (int)respData["count"]; + m_log.DebugFormat("[OGS1 USER SERVICES]: Request returned {0} results.", count); + for (int i = 0; i < count; ++i) + { + if (respData.ContainsKey("uuid_" + i) && respData.ContainsKey("isOnline_" + i) && respData.ContainsKey("regionHandle_" + i)) + { + UUID uuid; + if (UUID.TryParse((string)respData["uuid_" + i], out uuid)) + { + FriendRegionInfo info = new FriendRegionInfo(); + info.isOnline = (bool)respData["isOnline_" + i]; + if (info.isOnline) + { + // TODO remove this after the next protocol update (say, r7800?) + info.regionHandle = Convert.ToUInt64(respData["regionHandle_" + i]); + + // accept missing id + if (respData.ContainsKey("regionID_" + i)) + UUID.TryParse((string)respData["regionID_" + i], out info.regionID); + } + + result.Add(uuid, info); + } + } + else + { + m_log.WarnFormat("[OGS1 USER SERVICES]: Response to get_presence_info_bulk contained an error in entry {0}", i); + } + } + } + } + catch (WebException e) + { + m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch friend infos: {0}", e.Message); + } + + m_log.DebugFormat("[OGS1 USER SERVICES]: Returning {0} entries", result.Count); + + return result; + } + + public virtual AvatarAppearance GetUserAppearance(UUID user) + { + AvatarAppearance appearance = null; + + try + { + Hashtable param = new Hashtable(); + param["owner"] = user.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters); + XmlRpcResponse resp = req.Send(GetUserServerURL(user), 8000); + Hashtable respData = (Hashtable)resp.Value; + + return ConvertXMLRPCDataToAvatarAppearance(respData); + } + catch (WebException e) + { + m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch appearance for avatar {0}, {1}", user, e.Message); + } + + return appearance; + } + + public virtual void UpdateUserAppearance(UUID user, AvatarAppearance appearance) + { + try + { + Hashtable param = appearance.ToHashTable(); + param["owner"] = user.ToString(); + + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters); + XmlRpcResponse resp = req.Send(GetUserServerURL(user), 8000); + Hashtable respData = (Hashtable)resp.Value; + + if (respData != null) + { + if (respData.Contains("returnString")) + { + if ((string)respData["returnString"] == "TRUE") + { + + } + else + { + m_log.Warn("[GRID]: Unable to update_user_appearance, User Server Reported an issue"); + } + } + else + { + m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!"); + } + } + else + { + m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!"); + } + } + catch (WebException e) + { + m_log.Warn("[OGS1 USER SERVICES]: Error when trying to update Avatar's appearance: " + + e.Message); + // Return Empty list (no friends) + } + } + + protected virtual string GetUserServerURL(UUID userID) + { + return m_commsManager.NetworkServersInfo.UserURL; + } + + protected UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) + { + if (data.Contains("error_type")) + { + m_log.Warn("[GRID]: " + + "Error sent by user server when trying to get user profile: (" + + data["error_type"] + + "): " + data["error_desc"]); + return null; + } + + UserProfileData userData = new UserProfileData(); + userData.FirstName = (string)data["firstname"]; + userData.SurName = (string)data["lastname"]; + userData.ID = new UUID((string)data["uuid"]); + userData.Created = Convert.ToInt32(data["profile_created"]); + userData.UserInventoryURI = (string)data["server_inventory"]; + userData.UserAssetURI = (string)data["server_asset"]; + userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; + userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]); + userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); + userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); + userData.AboutText = (string)data["profile_about"]; + userData.Image = new UUID((string)data["profile_image"]); + userData.LastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); + userData.HomeRegion = Convert.ToUInt64((string)data["home_region"]); + if (data.Contains("home_region_id")) + userData.HomeRegionID = new UUID((string)data["home_region_id"]); + else + userData.HomeRegionID = UUID.Zero; + userData.HomeLocation = + new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), + (float)Convert.ToDecimal((string)data["home_coordinates_y"]), + (float)Convert.ToDecimal((string)data["home_coordinates_z"])); + userData.HomeLookAt = + new Vector3((float)Convert.ToDecimal((string)data["home_look_x"]), + (float)Convert.ToDecimal((string)data["home_look_y"]), + (float)Convert.ToDecimal((string)data["home_look_z"])); + if (data.Contains("user_flags")) + userData.UserFlags = Convert.ToInt32((string)data["user_flags"]); + if (data.Contains("god_level")) + userData.GodLevel = Convert.ToInt32((string)data["god_level"]); + + if (data.Contains("custom_type")) + userData.CustomType = (string)data["custom_type"]; + else + userData.CustomType = ""; + if (userData.CustomType == null) + userData.CustomType = ""; + + if (data.Contains("partner")) + userData.Partner = new UUID((string)data["partner"]); + else + userData.Partner = UUID.Zero; + + return userData; + } + + protected AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) + { + if (data != null) + { + if (data.Contains("error_type")) + { + m_log.Warn("[GRID]: " + + "Error sent by user server when trying to get user appearance: (" + + data["error_type"] + + "): " + data["error_desc"]); + return null; + } + else + { + return new AvatarAppearance(data); + } + } + else + { + m_log.Error("[GRID]: The avatar appearance is null, something bad happenend"); + return null; + } + } + + protected List ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data) + { + List pickerlist = new List(); + int pickercount = Convert.ToInt32((string)data["avcount"]); + UUID respqueryID = new UUID((string)data["queryid"]); + if (queryID == respqueryID) + { + for (int i = 0; i < pickercount; i++) + { + AvatarPickerAvatar apicker = new AvatarPickerAvatar(); + UUID avatarID = new UUID((string)data["avatarid" + i.ToString()]); + string firstname = (string)data["firstname" + i.ToString()]; + string lastname = (string)data["lastname" + i.ToString()]; + apicker.AvatarID = avatarID; + apicker.firstName = firstname; + apicker.lastName = lastname; + pickerlist.Add(apicker); + } + } + else + { + m_log.Warn("[OGS1 USER SERVICES]: Got invalid queryID from userServer"); + } + return pickerlist; + } + + protected List ConvertXMLRPCDataToFriendListItemList(Hashtable data) + { + List buddylist = new List(); + int buddycount = Convert.ToInt32((string)data["avcount"]); + + + for (int i = 0; i < buddycount; i++) + { + FriendListItem buddylistitem = new FriendListItem(); + + buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]); + buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]); + buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); + buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); + + buddylist.Add(buddylistitem); + } + + return buddylist; + } + } +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 18363289e8..5f771070d5 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -35,229 +35,36 @@ using System.Xml.Serialization; using log4net; using Nwc.XmlRpc; using OpenMetaverse; +using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Clients; namespace OpenSim.Region.Communications.OGS1 -{ - public class OGS1UserServices : IUserService, IAvatarService, IMessagingService +{ + public class OGS1UserServices : UserManagerBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + protected CommunicationsManager m_commsManager; - + public OGS1UserServices(CommunicationsManager commsManager) + : base(commsManager.InterServiceInventoryService) { m_commsManager = commsManager; } - - public OGS1UserServices() + + public override void ClearUserAgent(UUID avatarID) { + // TODO: implement + // It may be possible to use the UserManagerBase implementation. } - - public UserProfileData ConvertXMLRPCDataToUserProfile(Hashtable data) + + protected virtual string GetUserServerURL(UUID userID) { - if (data.Contains("error_type")) - { - m_log.Warn("[GRID]: " + - "Error sent by user server when trying to get user profile: (" + - data["error_type"] + - "): " + data["error_desc"]); - return null; - } - - UserProfileData userData = new UserProfileData(); - userData.FirstName = (string)data["firstname"]; - userData.SurName = (string)data["lastname"]; - userData.ID = new UUID((string)data["uuid"]); - userData.Created = Convert.ToInt32(data["profile_created"]); - userData.UserInventoryURI = (string)data["server_inventory"]; - userData.UserAssetURI = (string)data["server_asset"]; - userData.FirstLifeAboutText = (string)data["profile_firstlife_about"]; - userData.FirstLifeImage = new UUID((string)data["profile_firstlife_image"]); - userData.CanDoMask = Convert.ToUInt32((string)data["profile_can_do"]); - userData.WantDoMask = Convert.ToUInt32(data["profile_want_do"]); - userData.AboutText = (string)data["profile_about"]; - userData.Image = new UUID((string)data["profile_image"]); - userData.LastLogin = Convert.ToInt32((string)data["profile_lastlogin"]); - userData.HomeRegion = Convert.ToUInt64((string)data["home_region"]); - if (data.Contains("home_region_id")) - userData.HomeRegionID = new UUID((string)data["home_region_id"]); - else - userData.HomeRegionID = UUID.Zero; - userData.HomeLocation = - new Vector3((float)Convert.ToDecimal((string)data["home_coordinates_x"]), - (float)Convert.ToDecimal((string)data["home_coordinates_y"]), - (float)Convert.ToDecimal((string)data["home_coordinates_z"])); - userData.HomeLookAt = - new Vector3((float)Convert.ToDecimal((string)data["home_look_x"]), - (float)Convert.ToDecimal((string)data["home_look_y"]), - (float)Convert.ToDecimal((string)data["home_look_z"])); - if (data.Contains("user_flags")) - userData.UserFlags = Convert.ToInt32((string)data["user_flags"]); - if (data.Contains("god_level")) - userData.GodLevel = Convert.ToInt32((string)data["god_level"]); - - if (data.Contains("custom_type")) - userData.CustomType = (string)data["custom_type"]; - else - userData.CustomType = ""; - if (userData.CustomType == null) - userData.CustomType = ""; - - if (data.Contains("partner")) - userData.Partner = new UUID((string)data["partner"]); - else - userData.Partner = UUID.Zero; - - return userData; + return m_commsManager.NetworkServersInfo.UserURL; } - - public UserProfileData GetUserProfile(Uri uri) - { - WebRequest request = WebRequest.Create(uri); - - WebResponse webResponse = request.GetResponse(); - - XmlSerializer deserializer = new XmlSerializer(typeof(XmlRpcResponse)); - XmlRpcResponse xmlRpcResponse = (XmlRpcResponse)deserializer.Deserialize(webResponse.GetResponseStream()); - - Hashtable respData = (Hashtable)xmlRpcResponse.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - - public Uri GetUserUri(UserProfileData userProfile) - { - throw new NotImplementedException(); - } - - /// - /// Get a user agent from the user server - /// - /// - /// null if the request fails - public virtual UserAgentData GetAgentByUUID(UUID userId) - { - try - { - Hashtable param = new Hashtable(); - param["avatar_uuid"] = userId.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_agent_by_uuid", parameters); - - XmlRpcResponse resp = req.Send(GetUserServerURL(userId), 6000); - Hashtable respData = (Hashtable)resp.Value; - if (respData.Contains("error_type")) - { - //m_log.Warn("[GRID]: " + - // "Error sent by user server when trying to get agent: (" + - // (string) respData["error_type"] + - // "): " + (string)respData["error_desc"]); - return null; - } - UUID sessionid = UUID.Zero; - - UserAgentData userAgent = new UserAgentData(); - userAgent.Handle = Convert.ToUInt64((string)respData["handle"]); - UUID.TryParse((string)respData["sessionid"], out sessionid); - userAgent.SessionID = sessionid; - - if ((string)respData["agent_online"] == "TRUE") - { - userAgent.AgentOnline = true; - } - else - { - userAgent.AgentOnline = false; - } - - return userAgent; - } - catch (Exception e) - { - m_log.ErrorFormat( - "[OGS1 USER SERVICES]: Error when trying to fetch agent data by uuid from remote user server: {0}", - e); - } - - return null; - } - - public AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data) - { - if (data != null) - { - if (data.Contains("error_type")) - { - m_log.Warn("[GRID]: " + - "Error sent by user server when trying to get user appearance: (" + - data["error_type"] + - "): " + data["error_desc"]); - return null; - } - else - { - return new AvatarAppearance(data); - } - } - else - { - m_log.Error("[GRID]: The avatar appearance is null, something bad happenend"); - return null; - } - } - - public List ConvertXMLRPCDataToAvatarPickerList(UUID queryID, Hashtable data) - { - List pickerlist = new List(); - int pickercount = Convert.ToInt32((string)data["avcount"]); - UUID respqueryID = new UUID((string)data["queryid"]); - if (queryID == respqueryID) - { - for (int i = 0; i < pickercount; i++) - { - AvatarPickerAvatar apicker = new AvatarPickerAvatar(); - UUID avatarID = new UUID((string)data["avatarid" + i.ToString()]); - string firstname = (string)data["firstname" + i.ToString()]; - string lastname = (string)data["lastname" + i.ToString()]; - apicker.AvatarID = avatarID; - apicker.firstName = firstname; - apicker.lastName = lastname; - pickerlist.Add(apicker); - } - } - else - { - m_log.Warn("[OGS1 USER SERVICES]: Got invalid queryID from userServer"); - } - return pickerlist; - } - - public List ConvertXMLRPCDataToFriendListItemList(Hashtable data) - { - List buddylist = new List(); - int buddycount = Convert.ToInt32((string)data["avcount"]); - - - for (int i = 0; i < buddycount; i++) - { - FriendListItem buddylistitem = new FriendListItem(); - - buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]); - buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]); - buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); - buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); - - buddylist.Add(buddylistitem); - } - - - return buddylist; - } - + /// /// Logs off a user on the user server /// @@ -266,7 +73,7 @@ namespace OpenSim.Region.Communications.OGS1 /// regionhandle /// final position /// final lookat - public virtual void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) + public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) { Hashtable param = new Hashtable(); param["avatar_uuid"] = userid.Guid.ToString(); @@ -290,123 +97,15 @@ namespace OpenSim.Region.Communications.OGS1 catch (WebException) { m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff"); - } + } } - - /// - /// Logs off a user on the user server (deprecated as of 2008-08-27) - /// - /// UUID of the user - /// UUID of the Region - /// regionhandle - /// final position x - /// final position y - /// final position z - public virtual void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) - { - LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3()); - } - - public virtual UserProfileData GetUserProfile(string firstName, string lastName) - { - return GetUserProfile(firstName + " " + lastName); - } - - public virtual List GenerateAgentPickerRequestResponse(UUID queryID, string query) - { - List pickerlist = new List(); - Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]"); - try - { - Hashtable param = new Hashtable(); - param["queryid"] = (string)queryID.ToString(); - param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty); - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData); - } - catch (WebException e) - { - m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar Picker Response: " + - e.Message); - // Return Empty picker list (no results) - } - return pickerlist; - } - - /// - /// Get a user profile from the user server - /// - /// - /// null if the request fails - public virtual UserProfileData GetUserProfile(string name) - { - try - { - Hashtable param = new Hashtable(); - param["avatar_name"] = name; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_by_name", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); - Hashtable respData = (Hashtable)resp.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - catch (WebException e) - { - m_log.ErrorFormat( - "[OGS1 USER SERVICES]: Error when trying to fetch profile data by name from remote user server: {0}", - e); - } - - return null; - } - - /// - /// Get a user profile from the user server - /// - /// - /// null if the request fails - public virtual UserProfileData GetUserProfile(UUID avatarID) - { - try - { - Hashtable param = new Hashtable(); - param["avatar_uuid"] = avatarID.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_by_uuid", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); - Hashtable respData = (Hashtable)resp.Value; - - return ConvertXMLRPCDataToUserProfile(respData); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[OGS1 USER SERVICES]: Error when trying to fetch profile data by uuid from remote user server: {0}", - e); - } - - return null; - } - - - public virtual void ClearUserAgent(UUID avatarID) - { - // TODO: implement - } - + /// /// Retrieve the user information for the given master uuid. /// /// /// - public virtual UserProfileData SetupMasterUser(string firstName, string lastName) + public override UserProfileData SetupMasterUser(string firstName, string lastName) { return SetupMasterUser(firstName, lastName, String.Empty); } @@ -416,7 +115,7 @@ namespace OpenSim.Region.Communications.OGS1 /// /// /// - public virtual UserProfileData SetupMasterUser(string firstName, string lastName, string password) + public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) { UserProfileData profile = GetUserProfile(firstName, lastName); return profile; @@ -427,7 +126,7 @@ namespace OpenSim.Region.Communications.OGS1 /// /// /// - public virtual UserProfileData SetupMasterUser(UUID uuid) + public override UserProfileData SetupMasterUser(UUID uuid) { UserProfileData data = GetUserProfile(uuid); @@ -439,424 +138,11 @@ namespace OpenSim.Region.Communications.OGS1 return data; } - - public virtual UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) - { - throw new Exception("The method or operation is not implemented."); - } - - public virtual bool ResetUserPassword(string firstName, string lastName, string newPassword) - { - throw new Exception("The method or operation is not implemented."); - } - - public virtual bool UpdateUserProfile(UserProfileData userProfile) - { - m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile."); - Hashtable param = new Hashtable(); - param["avatar_uuid"] = userProfile.ID.ToString(); - //param["AllowPublish"] = userProfile.ToString(); - param["FLImageID"] = userProfile.FirstLifeImage.ToString(); - param["ImageID"] = userProfile.Image.ToString(); - //param["MaturePublish"] = MaturePublish.ToString(); - param["AboutText"] = userProfile.AboutText; - param["FLAboutText"] = userProfile.FirstLifeAboutText; - //param["ProfileURL"] = userProfile.ProfileURL.ToString(); - - param["home_region"] = userProfile.HomeRegion.ToString(); - param["home_region_id"] = userProfile.HomeRegionID.ToString(); - - param["home_pos_x"] = userProfile.HomeLocationX.ToString(); - param["home_pos_y"] = userProfile.HomeLocationY.ToString(); - param["home_pos_z"] = userProfile.HomeLocationZ.ToString(); - param["home_look_x"] = userProfile.HomeLookAtX.ToString(); - param["home_look_y"] = userProfile.HomeLookAtY.ToString(); - param["home_look_z"] = userProfile.HomeLookAtZ.ToString(); - param["user_flags"] = userProfile.UserFlags.ToString(); - param["god_level"] = userProfile.GodLevel.ToString(); - param["custom_type"] = userProfile.CustomType.ToString(); - param["partner"] = userProfile.Partner.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("update_user_profile", parameters); - XmlRpcResponse resp = req.Send(GetUserServerURL(userProfile.ID), 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if (((string)respData["returnString"]).ToUpper() != "TRUE") - { - m_log.Warn("[GRID]: Unable to update user profile, User Server Reported an issue"); - return false; - } - } - else - { - m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!"); - return false; - } - } - else - { - m_log.Warn("[GRID]: Unable to update user profile, UserServer didn't understand me!"); - return false; - } - - return true; - } - - #region IUserServices Friend Methods - /// - /// Adds a new friend to the database for XUser - /// - /// The agent that who's friends list is being added to - /// The agent that being added to the friends list of the friends list owner - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - public virtual void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) - { - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.Guid.ToString(); - param["friendID"] = friend.Guid.ToString(); - param["friendPerms"] = perms.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("add_new_user_friend", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - m_log.Warn("[GRID]: Unable to add new friend, User Server Reported an issue"); - } - } - else - { - m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); - } - } - else - { - m_log.Warn("[GRID]: Unable to add new friend, UserServer didn't understand me!"); - - } - } - catch (WebException e) - { - m_log.Warn("[GRID]: Error when trying to AddNewUserFriend: " + - e.Message); - - } - - } - - /// - /// Delete friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The Ex-friend agent - public virtual void RemoveUserFriend(UUID friendlistowner, UUID friend) - { - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.Guid.ToString(); - param["friendID"] = friend.Guid.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("remove_user_friend", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - m_log.Warn("[GRID]: Unable to remove friend, User Server Reported an issue"); - } - } - else - { - m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); - } - } - else - { - m_log.Warn("[GRID]: Unable to remove friend, UserServer didn't understand me!"); - - } - } - catch (WebException e) - { - m_log.Warn("[GRID]: Error when trying to RemoveUserFriend: " + - e.Message); - - } - } - - /// - /// Update permissions for friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The agent that is getting or loosing permissions - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - public virtual void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) - { - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.Guid.ToString(); - param["friendID"] = friend.Guid.ToString(); - param["friendPerms"] = perms.ToString(); - IList parameters = new ArrayList(); - parameters.Add(param); - - XmlRpcRequest req = new XmlRpcRequest("update_user_friend_perms", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000); - Hashtable respData = (Hashtable)resp.Value; - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - m_log.Warn("[GRID]: Unable to update_user_friend_perms, User Server Reported an issue"); - } - } - else - { - m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); - } - } - else - { - m_log.Warn("[GRID]: Unable to update_user_friend_perms, UserServer didn't understand me!"); - - } - } - catch (WebException e) - { - m_log.Warn("[GRID]: Error when trying to update_user_friend_perms: " + - e.Message); - } - } - /// - /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner - /// - /// The agent that we're retreiving the friends Data. - public virtual List GetUserFriendList(UUID friendlistowner) - { - List buddylist = new List(); - - try - { - Hashtable param = new Hashtable(); - param["ownerID"] = friendlistowner.Guid.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000); - Hashtable respData = (Hashtable)resp.Value; - - if (respData != null && respData.Contains("avcount")) - { - buddylist = ConvertXMLRPCDataToFriendListItemList(respData); - } - - } - catch (WebException e) - { - m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar's friends list: " + - e.Message); - // Return Empty list (no friends) - } - return buddylist; - } - - public virtual Dictionary GetFriendRegionInfos(List uuids) - { - Dictionary result = new Dictionary(); - - // ask MessageServer about the current on-/offline status and regions the friends are in - ArrayList parameters = new ArrayList(); - Hashtable map = new Hashtable(); - - ArrayList list = new ArrayList(); - foreach (UUID uuid in uuids) - { - list.Add(uuid.ToString()); - list.Add(uuid.ToString()); - } - map["uuids"] = list; - - map["recv_key"] = m_commsManager.NetworkServersInfo.UserRecvKey; - map["send_key"] = m_commsManager.NetworkServersInfo.UserSendKey; - - parameters.Add(map); - - try - { - XmlRpcRequest req = new XmlRpcRequest("get_presence_info_bulk", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.MessagingURL, 8000); - Hashtable respData = resp != null ? (Hashtable)resp.Value : null; - - if (respData == null || respData.ContainsKey("faultMessage")) - { - m_log.WarnFormat("[OGS1 USER SERVICES]: Contacting MessagingServer about user-regions resulted in error: {0}", - respData == null ? "" : respData["faultMessage"]); - } - else if (!respData.ContainsKey("count")) - { - m_log.WarnFormat("[OGS1 USER SERVICES]: Wrong format in response for MessagingServer request get_presence_info_bulk: missing 'count' field"); - } - else - { - int count = (int)respData["count"]; - m_log.DebugFormat("[OGS1 USER SERVICES]: Request returned {0} results.", count); - for (int i = 0; i < count; ++i) - { - if (respData.ContainsKey("uuid_" + i) && respData.ContainsKey("isOnline_" + i) && respData.ContainsKey("regionHandle_" + i)) - { - UUID uuid; - if (UUID.TryParse((string)respData["uuid_" + i], out uuid)) - { - FriendRegionInfo info = new FriendRegionInfo(); - info.isOnline = (bool)respData["isOnline_" + i]; - if (info.isOnline) - { - // TODO remove this after the next protocol update (say, r7800?) - info.regionHandle = Convert.ToUInt64(respData["regionHandle_" + i]); - - // accept missing id - if (respData.ContainsKey("regionID_" + i)) - UUID.TryParse((string)respData["regionID_" + i], out info.regionID); - } - - result.Add(uuid, info); - } - } - else - { - m_log.WarnFormat("[OGS1 USER SERVICES]: Response to get_presence_info_bulk contained an error in entry {0}", i); - } - } - } - } - catch (WebException e) - { - m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch friend infos: {0}", e.Message); - } - - m_log.DebugFormat("[OGS1 USER SERVICES]: Returning {0} entries", result.Count); - return result; - } - - #endregion - - /// Appearance - public virtual AvatarAppearance GetUserAppearance(UUID user) - { - AvatarAppearance appearance = null; - - try - { - Hashtable param = new Hashtable(); - param["owner"] = user.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("get_avatar_appearance", parameters); - XmlRpcResponse resp = req.Send(GetUserServerURL(user), 8000); - Hashtable respData = (Hashtable)resp.Value; - - return ConvertXMLRPCDataToAvatarAppearance(respData); - } - catch (WebException e) - { - m_log.ErrorFormat("[OGS1 USER SERVICES]: Network problems when trying to fetch appearance for avatar {0}, {1}", user, e.Message); - } - - return appearance; - } - - public virtual void UpdateUserAppearance(UUID user, AvatarAppearance appearance) - { - try - { - Hashtable param = appearance.ToHashTable(); - param["owner"] = user.ToString(); - - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("update_avatar_appearance", parameters); - XmlRpcResponse resp = req.Send(GetUserServerURL(user), 8000); - Hashtable respData = (Hashtable)resp.Value; - - if (respData != null) - { - if (respData.Contains("returnString")) - { - if ((string)respData["returnString"] == "TRUE") - { - - } - else - { - m_log.Warn("[GRID]: Unable to update_user_appearance, User Server Reported an issue"); - } - } - else - { - m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!"); - } - } - else - { - m_log.Warn("[GRID]: Unable to update_user_appearance, UserServer didn't understand me!"); - } - } - catch (WebException e) - { - m_log.Warn("[OGS1 USER SERVICES]: Error when trying to update Avatar's appearance: " + - e.Message); - // Return Empty list (no friends) - } - } - - public virtual bool VerifySession(UUID userID, UUID sessionID) + + public override bool VerifySession(UUID userID, UUID sessionID) { m_log.DebugFormat("[OGS1 USER SERVICES]: Verifying user session for " + userID); return AuthClient.VerifySession(GetUserServerURL(userID), userID, sessionID); - } - - protected virtual string GetUserServerURL(UUID userID) - { - return m_commsManager.NetworkServersInfo.UserURL; - } - + } } -} +} \ No newline at end of file diff --git a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs index 73e8a0929a..58996e2d8a 100644 --- a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs @@ -86,6 +86,8 @@ namespace OpenSim.Tests.Common.Mock return userProfile; } + + public UserProfileData GetUserByUri(Uri uri) { return null; } public bool UpdateUserProfile(UserProfileData user) {