aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTom2011-01-26 16:25:08 -0800
committerTom2011-01-26 16:25:08 -0800
commit6b27587bc7631d6fd083f3b4f752d9ddcfda4830 (patch)
tree743dd62eb392e4ec95b76c92918289995c15fa5d /OpenSim/Region
parentAdd userFlags check to isBanned. This checks bans against DenyAnonymous and D... (diff)
downloadopensim-SC-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.zip
opensim-SC-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.tar.gz
opensim-SC-6b27587bc7631d6fd083f3b4f752d9ddcfda4830.tar.bz2
opensim-SC-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 :/
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs42
3 files changed, 34 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);