From 4d3696d6581e61581915614b150909ff797a4956 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 12:40:33 -0800 Subject: Make llSHA1Hash SL compatible when using characters like the euro symbol (€) --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dffc0bd..1ccf76e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -32,6 +32,7 @@ using System.Diagnostics; //for [DebuggerNonUserCode] using System.Runtime.Remoting.Lifetime; using System.Text; using System.Threading; +using System.Security.Cryptography; using System.Text.RegularExpressions; using Nini.Config; using log4net; @@ -6944,7 +6945,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llSHA1String(string src) { m_host.AddScriptLPS(1); - return Util.SHA1Hash(src).ToLower(); + SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); + return BitConverter.ToString(SHA1.ComputeHash(Encoding.UTF8.GetBytes(src))).Replace("-", String.Empty).ToLower(); } protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) -- cgit v1.1 From 63dcd44e8727a4e264feaf2d981c70bbfa209811 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 12:47:43 -0800 Subject: Provide an SL compatible llMD5String function across all platforms --- OpenSim/Framework/Util.cs | 14 ++++++++++---- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index cef756c..9227708 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -409,19 +409,25 @@ namespace OpenSim.Framework /// /// /// + public static string Md5Hash(string data) { - byte[] dataMd5 = ComputeMD5Hash(data); + return Md5Hash(data, Encoding.Default); + } + + public static string Md5Hash(string data, Encoding encoding) + { + byte[] dataMd5 = ComputeMD5Hash(data, encoding); StringBuilder sb = new StringBuilder(); for (int i = 0; i < dataMd5.Length; i++) sb.AppendFormat("{0:x2}", dataMd5[i]); return sb.ToString(); } - private static byte[] ComputeMD5Hash(string data) + private static byte[] ComputeMD5Hash(string data, Encoding encoding) { MD5 md5 = MD5.Create(); - return md5.ComputeHash(Encoding.Default.GetBytes(data)); + return md5.ComputeHash(encoding.GetBytes(data)); } /// @@ -1161,7 +1167,7 @@ namespace OpenSim.Framework public static Guid GetHashGuid(string data, string salt) { - byte[] hash = ComputeMD5Hash(data + salt); + byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default); //string s = BitConverter.ToString(hash); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1ccf76e..45af13a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6939,7 +6939,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llMD5String(string src, int nonce) { m_host.AddScriptLPS(1); - return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString())); + return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString()), Encoding.UTF8); } public LSL_String llSHA1String(string src) -- cgit v1.1 From 04c62c4959d99ed3a8d350464db64aac6db1ec5f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 12:54:12 -0800 Subject: Revert my previous SHA1 commit in favour of a better implementation --- OpenSim/Framework/Util.cs | 12 +++++++++--- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 +--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 9227708..96292ff 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -435,16 +435,22 @@ namespace OpenSim.Framework /// /// /// + public static string SHA1Hash(string data) { - byte[] hash = ComputeSHA1Hash(data); + return SHA1Hash(data, Encoding.Default); + } + + public static string SHA1Hash(string data, Encoding encoding) + { + byte[] hash = ComputeSHA1Hash(data, encoding); return BitConverter.ToString(hash).Replace("-", String.Empty); } - private static byte[] ComputeSHA1Hash(string src) + private static byte[] ComputeSHA1Hash(string src, Encoding encoding) { SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); - return SHA1.ComputeHash(Encoding.Default.GetBytes(src)); + return SHA1.ComputeHash(encoding.GetBytes(src)); } public static int fast_distance2d(int x, int y) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 45af13a..f5b7f5f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -32,7 +32,6 @@ using System.Diagnostics; //for [DebuggerNonUserCode] using System.Runtime.Remoting.Lifetime; using System.Text; using System.Threading; -using System.Security.Cryptography; using System.Text.RegularExpressions; using Nini.Config; using log4net; @@ -6945,8 +6944,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llSHA1String(string src) { m_host.AddScriptLPS(1); - SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); - return BitConverter.ToString(SHA1.ComputeHash(Encoding.UTF8.GetBytes(src))).Replace("-", String.Empty).ToLower(); + return Util.SHA1Hash(src, Encoding.UTF8).ToLower(); } protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist) -- cgit v1.1 From 3ecf712e4dd5318442e7c853eb43299840594ce5 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 14:20:39 -0800 Subject: Add userFlags check to isBanned. This checks bans against DenyAnonymous and DenyMinors. Note that the ban doesn't actually work yet due to some stuff mel's working on . --- OpenSim/Framework/EstateSettings.cs | 23 +++++++++++- OpenSim/Framework/Tests/MundaneFrameworkTests.cs | 6 +-- .../Agent/Capabilities/CapabilitiesModule.cs | 8 +++- OpenSim/Region/Framework/Scenes/Scene.cs | 43 ++++++++++++++++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++ 5 files changed, 78 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index 2a495b0..f9c13f3 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -338,11 +338,30 @@ namespace OpenSim.Framework return false; } - public bool IsBanned(UUID avatarID) + public bool IsBanned(UUID avatarID, int userFlags) { foreach (EstateBan ban in l_EstateBans) if (ban.BannedUserID == avatarID) return true; + + if (!IsEstateManager(avatarID) && !HasAccess(avatarID)) + { + if (DenyMinors) + { + if ((userFlags & 32) == 0) + { + return true; + } + } + if (DenyAnonymous) + { + if ((userFlags & 4) == 0) + { + return true; + } + } + } + return false; } @@ -350,7 +369,7 @@ namespace OpenSim.Framework { if (ban == null) return; - if (!IsBanned(ban.BannedUserID)) + if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans l_EstateBans.Add(ban); } diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs index e7f8bfc..e131260 100644 --- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs +++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs @@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests BannedHostNameMask = string.Empty, BannedUserID = bannedUserId} ); - Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); - Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); + Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not."); + Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is."); es.RemoveBan(bannedUserId); - Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); + Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is."); es.AddEstateManager(UUID.Zero); diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index c023a6f..cbc2fd6 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -88,7 +88,13 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities public void AddCapsHandler(UUID agentId) { - if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) + int flags = 0; + ScenePresence sp; + if (m_scene.TryGetScenePresence(agentId, out sp)) + { + flags = sp.UserFlags; + } + if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) return; String capsObjectPath = GetCapsPath(agentId); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a4f630a..2ca82ca 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2443,7 +2443,15 @@ namespace OpenSim.Region.Framework.Scenes // If the user is banned, we won't let any of their objects // enter. Period. // - if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID)) + int flags = 0; + ScenePresence sp; + if (TryGetScenePresence(sceneObject.OwnerID, out sp)) + { + flags = sp.UserFlags; + } + + + if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) { m_log.Info("[INTERREGION]: Denied prim crossing for " + "banned avatar"); @@ -2472,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart RootPrim = sceneObject.RootPart; // Fix up attachment Parent Local ID - ScenePresence sp = GetScenePresence(sceneObject.OwnerID); + sp = GetScenePresence(sceneObject.OwnerID); if (sp != null) { @@ -3617,8 +3625,29 @@ namespace OpenSim.Region.Framework.Scenes if (m_regInfo.EstateSettings != null) { - if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID)) + int flags = 0; + ScenePresence sp; + if (TryGetScenePresence(agent.AgentID, out sp)) { + flags = sp.UserFlags; + } + if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags)) + { + //Add some more info to help users + if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 32)) + { + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires age verification", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + reason = String.Format("Denied access to region (0): Region requires age verification"); + return false; + } + if (!m_regInfo.EstateSettings.IsBanned(agent.AgentID, 4)) + { + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the region requires payment info on file", + agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); + reason = String.Format("Denied access to region (0): Region requires payment info on file"); + return false; + } m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); reason = String.Format("Denied access to region {0}: You have been banned from that region.", @@ -3807,7 +3836,13 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence - if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID)) + int flags = 0; + ScenePresence sp; + if (TryGetScenePresence(cAgentData.AgentID, out sp)) + { + flags = sp.UserFlags; + } + if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) { m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); return false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6a3983f..c4ae0f0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes { get { return m_attachments; } } + protected List m_attachments = new List(); private Dictionary scriptedcontrols = new Dictionary(); @@ -136,6 +137,12 @@ namespace OpenSim.Region.Framework.Scenes private bool m_updateflag; private byte m_movementflag; private Vector3? m_forceToApply; + private int m_userFlags; + public int UserFlags + { + get { return m_userFlags; } + } + private uint m_requestedSitTargetID; private UUID m_requestedSitTargetUUID; public bool SitGround = false; @@ -763,6 +770,7 @@ namespace OpenSim.Region.Framework.Scenes m_localId = m_scene.AllocateLocalId(); UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); + m_userFlags = account.UserFlags; if (account != null) m_userLevel = account.UserLevel; -- cgit v1.1 From 6b27587bc7631d6fd083f3b4f752d9ddcfda4830 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 16:25:08 -0800 Subject: Add a "useCached" parameter to GetUserAccount. Add a function to Scene to get the user flags. It has to be here due to access restrictions :/ --- .../Agent/Capabilities/CapabilitiesModule.cs | 7 +--- .../LocalUserAccountServiceConnector.cs | 17 ++++++--- OpenSim/Region/Framework/Scenes/Scene.cs | 42 +++++++++++----------- .../SimianUserAccountServiceConnector.cs | 5 +++ .../UserAccounts/UserAccountServiceConnector.cs | 5 +++ .../Services/HypergridService/UserAccountCache.cs | 5 +++ OpenSim/Services/Interfaces/IUserAccountService.cs | 1 + .../UserAccountService/UserAccountService.cs | 5 +++ 8 files changed, 55 insertions(+), 32 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index cbc2fd6..5c5cb70 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -88,12 +88,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities public void AddCapsHandler(UUID agentId) { - int flags = 0; - ScenePresence sp; - if (m_scene.TryGetScenePresence(agentId, out sp)) - { - flags = sp.UserFlags; - } + int flags = m_scene.GetUserFlags(agentId); if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) return; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 9ecbcc6..54340e6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs @@ -142,10 +142,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public UserAccount GetUserAccount(UUID scopeID, UUID userID) { - bool inCache = false; - UserAccount account = m_Cache.Get(userID, out inCache); - if (inCache) - return account; + return GetUserAccount(scopeID, userID, true); + } + + public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) + { + UserAccount account; + if (useCache) + { + bool inCache = false; + account = m_Cache.Get(userID, out inCache); + if (inCache) + return account; + } account = m_UserService.GetUserAccount(scopeID, userID); m_Cache.Cache(userID, account); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2ca82ca..99248c1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2443,14 +2443,7 @@ namespace OpenSim.Region.Framework.Scenes // If the user is banned, we won't let any of their objects // enter. Period. // - int flags = 0; - ScenePresence sp; - if (TryGetScenePresence(sceneObject.OwnerID, out sp)) - { - flags = sp.UserFlags; - } - - + int flags = GetUserFlags(sceneObject.OwnerID); if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) { m_log.Info("[INTERREGION]: Denied prim crossing for " + @@ -2480,7 +2473,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart RootPrim = sceneObject.RootPart; // Fix up attachment Parent Local ID - sp = GetScenePresence(sceneObject.OwnerID); + ScenePresence sp = GetScenePresence(sceneObject.OwnerID); if (sp != null) { @@ -2554,7 +2547,22 @@ namespace OpenSim.Region.Framework.Scenes } return 2; // StateSource.PrimCrossing } - + public int GetUserFlags(UUID user) + { + //Unfortunately the SP approach means that the value is cached until region is restarted + /* + ScenePresence sp; + if (TryGetScenePresence(user, out sp)) + { + return sp.UserFlags; + } + else + { + */ + UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user, false); + return uac.UserFlags; + //} + } #endregion #region Add/Remove Avatar Methods @@ -3625,12 +3633,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_regInfo.EstateSettings != null) { - int flags = 0; - ScenePresence sp; - if (TryGetScenePresence(agent.AgentID, out sp)) - { - flags = sp.UserFlags; - } + int flags = GetUserFlags(agent.AgentID); if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags)) { //Add some more info to help users @@ -3836,12 +3839,7 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence - int flags = 0; - ScenePresence sp; - if (TryGetScenePresence(cAgentData.AgentID, out sp)) - { - flags = sp.UserFlags; - } + int flags = GetUserFlags(cAgentData.AgentID); if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) { m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 801b424..fe4e2bf 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -131,6 +131,11 @@ namespace OpenSim.Services.Connectors.SimianGrid public UserAccount GetUserAccount(UUID scopeID, UUID userID) { + return GetUserAccount(scopeID, userID, true); + } + + public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) + { // Cache check UserAccount account; if (m_accountCache.TryGetValue(userID, out account)) diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 205a4aa..c21b250 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -113,6 +113,11 @@ namespace OpenSim.Services.Connectors public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID) { + return GetUserAccount(scopeID, userID, true); + } + + public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) + { //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); Dictionary sendData = new Dictionary(); //sendData["SCOPEID"] = scopeID.ToString(); diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index e0a3e61..bbc531e 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs @@ -80,6 +80,11 @@ namespace OpenSim.Services.HypergridService return GetUser(userID.ToString()); } + public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) + { + return GetUser(userID.ToString()); + } + public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return null; diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index a91aa0f..21be98c 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -143,6 +143,7 @@ namespace OpenSim.Services.Interfaces public interface IUserAccountService { + UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache); UserAccount GetUserAccount(UUID scopeID, UUID userID); UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); UserAccount GetUserAccount(UUID scopeID, string Email); diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index cbd6f35..b914668 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -208,6 +208,11 @@ namespace OpenSim.Services.UserAccountService public UserAccount GetUserAccount(UUID scopeID, UUID principalID) { + return GetUserAccount(scopeID, principalID, true); + } + + public UserAccount GetUserAccount(UUID scopeID, UUID principalID, bool useCache) + { UserAccountData[] d; if (scopeID != UUID.Zero) -- cgit v1.1 From 31fb448cfc9c43532c38a58fff75fb6c0e67d632 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 26 Jan 2011 17:06:17 -0800 Subject: Mostly revert the last commit with the aim of searching for a better solution --- .../UserAccounts/LocalUserAccountServiceConnector.cs | 17 ++++------------- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- .../SimianGrid/SimianUserAccountServiceConnector.cs | 5 ----- .../UserAccounts/UserAccountServiceConnector.cs | 5 ----- OpenSim/Services/HypergridService/UserAccountCache.cs | 5 ----- OpenSim/Services/Interfaces/IUserAccountService.cs | 1 - .../Services/UserAccountService/UserAccountService.cs | 5 ----- 7 files changed, 5 insertions(+), 35 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 54340e6..9ecbcc6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs @@ -142,19 +142,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public UserAccount GetUserAccount(UUID scopeID, UUID userID) { - return GetUserAccount(scopeID, userID, true); - } - - public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) - { - UserAccount account; - if (useCache) - { - bool inCache = false; - account = m_Cache.Get(userID, out inCache); - if (inCache) - return account; - } + bool inCache = false; + UserAccount account = m_Cache.Get(userID, out inCache); + if (inCache) + return account; account = m_UserService.GetUserAccount(scopeID, userID); m_Cache.Cache(userID, account); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 99248c1..236e9c1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2559,7 +2559,7 @@ namespace OpenSim.Region.Framework.Scenes else { */ - UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user, false); + UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); return uac.UserFlags; //} } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index fe4e2bf..801b424 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -131,11 +131,6 @@ namespace OpenSim.Services.Connectors.SimianGrid public UserAccount GetUserAccount(UUID scopeID, UUID userID) { - return GetUserAccount(scopeID, userID, true); - } - - public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) - { // Cache check UserAccount account; if (m_accountCache.TryGetValue(userID, out account)) diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index c21b250..205a4aa 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -113,11 +113,6 @@ namespace OpenSim.Services.Connectors public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID) { - return GetUserAccount(scopeID, userID, true); - } - - public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) - { //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); Dictionary sendData = new Dictionary(); //sendData["SCOPEID"] = scopeID.ToString(); diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index bbc531e..e0a3e61 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs @@ -80,11 +80,6 @@ namespace OpenSim.Services.HypergridService return GetUser(userID.ToString()); } - public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) - { - return GetUser(userID.ToString()); - } - public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return null; diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 21be98c..a91aa0f 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -143,7 +143,6 @@ namespace OpenSim.Services.Interfaces public interface IUserAccountService { - UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache); UserAccount GetUserAccount(UUID scopeID, UUID userID); UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); UserAccount GetUserAccount(UUID scopeID, string Email); diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index b914668..cbd6f35 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -208,11 +208,6 @@ namespace OpenSim.Services.UserAccountService public UserAccount GetUserAccount(UUID scopeID, UUID principalID) { - return GetUserAccount(scopeID, principalID, true); - } - - public UserAccount GetUserAccount(UUID scopeID, UUID principalID, bool useCache) - { UserAccountData[] d; if (scopeID != UUID.Zero) -- cgit v1.1