diff options
author | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
commit | 159fcbf150b7da0e229b29aa7b94793484543d12 (patch) | |
tree | b8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |
parent | Merge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2 opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | 69 |
1 files changed, 61 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index b2b628d..ce7ed26 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -62,6 +62,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
62 | private string m_ThisGatekeeper; | 62 | private string m_ThisGatekeeper; |
63 | private bool m_RestrictInventoryAccessAbroad; | 63 | private bool m_RestrictInventoryAccessAbroad; |
64 | 64 | ||
65 | private bool m_bypassPermissions = true; | ||
66 | |||
65 | // private bool m_Initialized = false; | 67 | // private bool m_Initialized = false; |
66 | 68 | ||
67 | #region INonSharedRegionModule | 69 | #region INonSharedRegionModule |
@@ -100,6 +102,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
100 | } | 102 | } |
101 | else | 103 | else |
102 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | 104 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); |
105 | |||
106 | m_bypassPermissions = !Util.GetConfigVarFromSections<bool>(source, "serverside_object_permissions", | ||
107 | new string[] { "Startup", "Permissions" }, true); | ||
108 | |||
103 | } | 109 | } |
104 | } | 110 | } |
105 | } | 111 | } |
@@ -114,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
114 | scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; | 120 | scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; |
115 | scene.EventManager.OnTeleportStart += TeleportStart; | 121 | scene.EventManager.OnTeleportStart += TeleportStart; |
116 | scene.EventManager.OnTeleportFail += TeleportFail; | 122 | scene.EventManager.OnTeleportFail += TeleportFail; |
123 | |||
124 | // We're fgoing to enforce some stricter permissions if Outbound is false | ||
125 | scene.Permissions.OnTakeObject += CanTakeObject; | ||
126 | scene.Permissions.OnTakeCopyObject += CanTakeObject; | ||
127 | scene.Permissions.OnTransferUserInventory += OnTransferUserInventory; | ||
117 | } | 128 | } |
118 | 129 | ||
119 | #endregion | 130 | #endregion |
@@ -135,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
135 | if (sp is ScenePresence) | 146 | if (sp is ScenePresence) |
136 | { | 147 | { |
137 | AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); | 148 | AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); |
138 | if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | 149 | if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) |
139 | { | 150 | { |
140 | if (m_RestrictInventoryAccessAbroad) | 151 | if (m_RestrictInventoryAccessAbroad) |
141 | { | 152 | { |
@@ -185,8 +196,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
185 | } | 196 | } |
186 | } | 197 | } |
187 | 198 | ||
188 | public void UploadInventoryItem(UUID avatarID, UUID assetID, string name, int userlevel) | 199 | public void UploadInventoryItem(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel) |
189 | { | 200 | { |
201 | if (type == AssetType.Link) | ||
202 | return; | ||
203 | |||
190 | string userAssetServer = string.Empty; | 204 | string userAssetServer = string.Empty; |
191 | if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) | 205 | if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) |
192 | { | 206 | { |
@@ -221,7 +235,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
221 | { | 235 | { |
222 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); | 236 | UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data); |
223 | 237 | ||
224 | UploadInventoryItem(remoteClient.AgentId, newAssetID, "", 0); | 238 | UploadInventoryItem(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0); |
225 | 239 | ||
226 | return newAssetID; | 240 | return newAssetID; |
227 | } | 241 | } |
@@ -232,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
232 | protected override void ExportAsset(UUID agentID, UUID assetID) | 246 | protected override void ExportAsset(UUID agentID, UUID assetID) |
233 | { | 247 | { |
234 | if (!assetID.Equals(UUID.Zero)) | 248 | if (!assetID.Equals(UUID.Zero)) |
235 | UploadInventoryItem(agentID, assetID, "", 0); | 249 | UploadInventoryItem(agentID, AssetType.Unknown, assetID, "", 0); |
236 | else | 250 | else |
237 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); | 251 | m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); |
238 | } | 252 | } |
@@ -244,7 +258,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
244 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 258 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
245 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 259 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
246 | { | 260 | { |
247 | m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); | 261 | m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); |
248 | 262 | ||
249 | //if (fromTaskID.Equals(UUID.Zero)) | 263 | //if (fromTaskID.Equals(UUID.Zero)) |
250 | //{ | 264 | //{ |
@@ -297,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
297 | if (m_Scene.TryGetScenePresence(userID, out sp)) | 311 | if (m_Scene.TryGetScenePresence(userID, out sp)) |
298 | { | 312 | { |
299 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 313 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
300 | if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 314 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) |
301 | { | 315 | { |
302 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 316 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); |
303 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | 317 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); |
@@ -348,7 +362,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
348 | InventoryFolderBase root = m_Scene.InventoryService.GetRootFolder(client.AgentId); | 362 | InventoryFolderBase root = m_Scene.InventoryService.GetRootFolder(client.AgentId); |
349 | InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID); | 363 | InventoryCollection content = m_Scene.InventoryService.GetFolderContent(client.AgentId, root.ID); |
350 | 364 | ||
351 | inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); | 365 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); |
366 | |||
367 | foreach (InventoryFolderBase f in content.Folders) | ||
368 | { | ||
369 | if (f.Name != "My Suitcase" && f.Name != "Current Outfit") | ||
370 | keep.Add(f); | ||
371 | } | ||
372 | |||
373 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); | ||
352 | } | 374 | } |
353 | } | 375 | } |
354 | } | 376 | } |
@@ -381,7 +403,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
381 | 403 | ||
382 | foreach (InventoryFolderBase f in content.Folders) | 404 | foreach (InventoryFolderBase f in content.Folders) |
383 | { | 405 | { |
384 | if (f.Name != "My Suitcase") | 406 | if (f.Name != "My Suitcase" && f.Name != "Current Outfit") |
385 | { | 407 | { |
386 | f.Name = f.Name + " (Unavailable)"; | 408 | f.Name = f.Name + " (Unavailable)"; |
387 | keep.Add(f); | 409 | keep.Add(f); |
@@ -406,5 +428,36 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
406 | } | 428 | } |
407 | 429 | ||
408 | #endregion | 430 | #endregion |
431 | |||
432 | #region Permissions | ||
433 | |||
434 | private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene) | ||
435 | { | ||
436 | if (m_bypassPermissions) return true; | ||
437 | |||
438 | if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer)) | ||
439 | { | ||
440 | SceneObjectGroup sog = null; | ||
441 | if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer) | ||
442 | return true; | ||
443 | |||
444 | return false; | ||
445 | } | ||
446 | |||
447 | return true; | ||
448 | } | ||
449 | |||
450 | private bool OnTransferUserInventory(UUID itemID, UUID userID, UUID recipientID) | ||
451 | { | ||
452 | if (m_bypassPermissions) return true; | ||
453 | |||
454 | if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(recipientID)) | ||
455 | return false; | ||
456 | |||
457 | return true; | ||
458 | } | ||
459 | |||
460 | |||
461 | #endregion | ||
409 | } | 462 | } |
410 | } \ No newline at end of file | 463 | } \ No newline at end of file |