diff options
author | Tom | 2011-01-26 16:25:08 -0800 |
---|---|---|
committer | Tom | 2011-01-26 16:25:08 -0800 |
commit | 6b27587bc7631d6fd083f3b4f752d9ddcfda4830 (patch) | |
tree | 743dd62eb392e4ec95b76c92918289995c15fa5d | |
parent | Add userFlags check to isBanned. This checks bans against DenyAnonymous and D... (diff) | |
download | opensim-SC_OLD-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.zip opensim-SC_OLD-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.tar.gz opensim-SC_OLD-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.tar.bz2 opensim-SC_OLD-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.tar.xz |
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 :/
8 files changed, 55 insertions, 32 deletions
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 | |||
88 | 88 | ||
89 | public void AddCapsHandler(UUID agentId) | 89 | public void AddCapsHandler(UUID agentId) |
90 | { | 90 | { |
91 | int flags = 0; | 91 | int flags = m_scene.GetUserFlags(agentId); |
92 | ScenePresence sp; | ||
93 | if (m_scene.TryGetScenePresence(agentId, out sp)) | ||
94 | { | ||
95 | flags = sp.UserFlags; | ||
96 | } | ||
97 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | 92 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) |
98 | return; | 93 | return; |
99 | 94 | ||
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 | |||
142 | 142 | ||
143 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | 143 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
144 | { | 144 | { |
145 | bool inCache = false; | 145 | return GetUserAccount(scopeID, userID, true); |
146 | UserAccount account = m_Cache.Get(userID, out inCache); | 146 | } |
147 | if (inCache) | 147 | |
148 | return account; | 148 | public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) |
149 | { | ||
150 | UserAccount account; | ||
151 | if (useCache) | ||
152 | { | ||
153 | bool inCache = false; | ||
154 | account = m_Cache.Get(userID, out inCache); | ||
155 | if (inCache) | ||
156 | return account; | ||
157 | } | ||
149 | 158 | ||
150 | account = m_UserService.GetUserAccount(scopeID, userID); | 159 | account = m_UserService.GetUserAccount(scopeID, userID); |
151 | m_Cache.Cache(userID, account); | 160 | 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 | |||
2443 | // If the user is banned, we won't let any of their objects | 2443 | // If the user is banned, we won't let any of their objects |
2444 | // enter. Period. | 2444 | // enter. Period. |
2445 | // | 2445 | // |
2446 | int flags = 0; | 2446 | int flags = GetUserFlags(sceneObject.OwnerID); |
2447 | ScenePresence sp; | ||
2448 | if (TryGetScenePresence(sceneObject.OwnerID, out sp)) | ||
2449 | { | ||
2450 | flags = sp.UserFlags; | ||
2451 | } | ||
2452 | |||
2453 | |||
2454 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | 2447 | if (m_regInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) |
2455 | { | 2448 | { |
2456 | m_log.Info("[INTERREGION]: Denied prim crossing for " + | 2449 | m_log.Info("[INTERREGION]: Denied prim crossing for " + |
@@ -2480,7 +2473,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2480 | SceneObjectPart RootPrim = sceneObject.RootPart; | 2473 | SceneObjectPart RootPrim = sceneObject.RootPart; |
2481 | 2474 | ||
2482 | // Fix up attachment Parent Local ID | 2475 | // Fix up attachment Parent Local ID |
2483 | sp = GetScenePresence(sceneObject.OwnerID); | 2476 | ScenePresence sp = GetScenePresence(sceneObject.OwnerID); |
2484 | 2477 | ||
2485 | if (sp != null) | 2478 | if (sp != null) |
2486 | { | 2479 | { |
@@ -2554,7 +2547,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2554 | } | 2547 | } |
2555 | return 2; // StateSource.PrimCrossing | 2548 | return 2; // StateSource.PrimCrossing |
2556 | } | 2549 | } |
2557 | 2550 | public int GetUserFlags(UUID user) | |
2551 | { | ||
2552 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2553 | /* | ||
2554 | ScenePresence sp; | ||
2555 | if (TryGetScenePresence(user, out sp)) | ||
2556 | { | ||
2557 | return sp.UserFlags; | ||
2558 | } | ||
2559 | else | ||
2560 | { | ||
2561 | */ | ||
2562 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user, false); | ||
2563 | return uac.UserFlags; | ||
2564 | //} | ||
2565 | } | ||
2558 | #endregion | 2566 | #endregion |
2559 | 2567 | ||
2560 | #region Add/Remove Avatar Methods | 2568 | #region Add/Remove Avatar Methods |
@@ -3625,12 +3633,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3625 | 3633 | ||
3626 | if (m_regInfo.EstateSettings != null) | 3634 | if (m_regInfo.EstateSettings != null) |
3627 | { | 3635 | { |
3628 | int flags = 0; | 3636 | int flags = GetUserFlags(agent.AgentID); |
3629 | ScenePresence sp; | ||
3630 | if (TryGetScenePresence(agent.AgentID, out sp)) | ||
3631 | { | ||
3632 | flags = sp.UserFlags; | ||
3633 | } | ||
3634 | if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags)) | 3637 | if ((!m_seeIntoBannedRegion) && m_regInfo.EstateSettings.IsBanned(agent.AgentID, flags)) |
3635 | { | 3638 | { |
3636 | //Add some more info to help users | 3639 | //Add some more info to help users |
@@ -3836,12 +3839,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3836 | 3839 | ||
3837 | // We have to wait until the viewer contacts this region after receiving EAC. | 3840 | // We have to wait until the viewer contacts this region after receiving EAC. |
3838 | // That calls AddNewClient, which finally creates the ScenePresence | 3841 | // That calls AddNewClient, which finally creates the ScenePresence |
3839 | int flags = 0; | 3842 | int flags = GetUserFlags(cAgentData.AgentID); |
3840 | ScenePresence sp; | ||
3841 | if (TryGetScenePresence(cAgentData.AgentID, out sp)) | ||
3842 | { | ||
3843 | flags = sp.UserFlags; | ||
3844 | } | ||
3845 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | 3843 | if (m_regInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) |
3846 | { | 3844 | { |
3847 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | 3845 | 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 | |||
131 | 131 | ||
132 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | 132 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) |
133 | { | 133 | { |
134 | return GetUserAccount(scopeID, userID, true); | ||
135 | } | ||
136 | |||
137 | public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) | ||
138 | { | ||
134 | // Cache check | 139 | // Cache check |
135 | UserAccount account; | 140 | UserAccount account; |
136 | if (m_accountCache.TryGetValue(userID, out account)) | 141 | 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 | |||
113 | 113 | ||
114 | public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID) | 114 | public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID) |
115 | { | 115 | { |
116 | return GetUserAccount(scopeID, userID, true); | ||
117 | } | ||
118 | |||
119 | public virtual UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) | ||
120 | { | ||
116 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); | 121 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetUserAccount {0}", userID); |
117 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 122 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
118 | //sendData["SCOPEID"] = scopeID.ToString(); | 123 | //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 | |||
80 | return GetUser(userID.ToString()); | 80 | return GetUser(userID.ToString()); |
81 | } | 81 | } |
82 | 82 | ||
83 | public UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache) | ||
84 | { | ||
85 | return GetUser(userID.ToString()); | ||
86 | } | ||
87 | |||
83 | public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) | 88 | public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) |
84 | { | 89 | { |
85 | return null; | 90 | 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 | |||
143 | 143 | ||
144 | public interface IUserAccountService | 144 | public interface IUserAccountService |
145 | { | 145 | { |
146 | UserAccount GetUserAccount(UUID scopeID, UUID userID, bool useCache); | ||
146 | UserAccount GetUserAccount(UUID scopeID, UUID userID); | 147 | UserAccount GetUserAccount(UUID scopeID, UUID userID); |
147 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); | 148 | UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); |
148 | UserAccount GetUserAccount(UUID scopeID, string Email); | 149 | 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 | |||
208 | 208 | ||
209 | public UserAccount GetUserAccount(UUID scopeID, UUID principalID) | 209 | public UserAccount GetUserAccount(UUID scopeID, UUID principalID) |
210 | { | 210 | { |
211 | return GetUserAccount(scopeID, principalID, true); | ||
212 | } | ||
213 | |||
214 | public UserAccount GetUserAccount(UUID scopeID, UUID principalID, bool useCache) | ||
215 | { | ||
211 | UserAccountData[] d; | 216 | UserAccountData[] d; |
212 | 217 | ||
213 | if (scopeID != UUID.Zero) | 218 | if (scopeID != UUID.Zero) |