diff options
Diffstat (limited to 'OpenSim')
4 files changed, 102 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index ce7ed26..283a0cf 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -64,6 +64,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
64 | 64 | ||
65 | private bool m_bypassPermissions = true; | 65 | private bool m_bypassPermissions = true; |
66 | 66 | ||
67 | // This simple check makes it possible to support grids in which all the simulators | ||
68 | // share all central services of the Robust server EXCEPT assets. In other words, | ||
69 | // grids where the simulators' assets are kept in one DB and the users' inventory assets | ||
70 | // are kept on another. When users rez items from inventory or take objects from world, | ||
71 | // an HG-like asset copy takes place between the 2 servers, the world asset server and | ||
72 | // the user's asset server. | ||
73 | private bool m_CheckSeparateAssets = false; | ||
74 | private string m_LocalAssetsURL = string.Empty; | ||
75 | |||
67 | // private bool m_Initialized = false; | 76 | // private bool m_Initialized = false; |
68 | 77 | ||
69 | #region INonSharedRegionModule | 78 | #region INonSharedRegionModule |
@@ -99,6 +108,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
99 | 108 | ||
100 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); | 109 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); |
101 | m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true); | 110 | m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true); |
111 | m_CheckSeparateAssets = thisModuleConfig.GetBoolean("CheckSeparateAssets", false); | ||
112 | m_LocalAssetsURL = thisModuleConfig.GetString("RegionHGAssetServerURI", string.Empty); | ||
113 | m_LocalAssetsURL = m_LocalAssetsURL.Trim(new char[] { '/' }); | ||
114 | |||
102 | } | 115 | } |
103 | else | 116 | else |
104 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | 117 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); |
@@ -293,41 +306,92 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
293 | 306 | ||
294 | public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | 307 | public override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) |
295 | { | 308 | { |
296 | string userAssetServer = string.Empty; | 309 | string senderAssetServer = string.Empty; |
297 | if (IsForeignUser(sender, out userAssetServer) && userAssetServer != string.Empty) | 310 | string receiverAssetServer = string.Empty; |
298 | m_assMapper.Get(item.AssetID, sender, userAssetServer); | 311 | bool isForeignSender, isForeignReceiver; |
312 | isForeignSender = IsForeignUser(sender, out senderAssetServer); | ||
313 | isForeignReceiver = IsForeignUser(receiver, out receiverAssetServer); | ||
314 | |||
315 | // They're both local. Nothing to do. | ||
316 | if (!isForeignSender && !isForeignReceiver) | ||
317 | return; | ||
318 | |||
319 | // At least one of them is foreign. | ||
320 | // If both users have the same asset server, no need to transfer the asset | ||
321 | if (senderAssetServer.Equals(receiverAssetServer)) | ||
322 | { | ||
323 | m_log.DebugFormat("[HGScene]: Asset transfer between foreign users, but they have the same server. No transfer."); | ||
324 | return; | ||
325 | } | ||
299 | 326 | ||
300 | if (IsForeignUser(receiver, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission) | 327 | if (isForeignSender && senderAssetServer != string.Empty) |
301 | m_assMapper.Post(item.AssetID, receiver, userAssetServer); | 328 | m_assMapper.Get(item.AssetID, sender, senderAssetServer); |
329 | |||
330 | if (isForeignReceiver && receiverAssetServer != string.Empty && m_OutboundPermission) | ||
331 | m_assMapper.Post(item.AssetID, receiver, receiverAssetServer); | ||
302 | } | 332 | } |
303 | 333 | ||
304 | public override bool IsForeignUser(UUID userID, out string assetServerURL) | 334 | public override bool IsForeignUser(UUID userID, out string assetServerURL) |
305 | { | 335 | { |
306 | assetServerURL = string.Empty; | 336 | assetServerURL = string.Empty; |
307 | 337 | ||
308 | if (UserManagementModule != null && !UserManagementModule.IsLocalGridUser(userID)) | 338 | if (UserManagementModule != null) |
309 | { // foreign | 339 | { |
310 | ScenePresence sp = null; | 340 | if (!m_CheckSeparateAssets) |
311 | if (m_Scene.TryGetScenePresence(userID, out sp)) | ||
312 | { | 341 | { |
313 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 342 | if (!UserManagementModule.IsLocalGridUser(userID)) |
314 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 343 | { // foreign |
315 | { | 344 | ScenePresence sp = null; |
316 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 345 | if (m_Scene.TryGetScenePresence(userID, out sp)) |
317 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | 346 | { |
347 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
348 | if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | ||
349 | { | ||
350 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | ||
351 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | ||
352 | } | ||
353 | } | ||
354 | else | ||
355 | { | ||
356 | assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); | ||
357 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | ||
358 | } | ||
359 | return true; | ||
318 | } | 360 | } |
319 | } | 361 | } |
320 | else | 362 | else |
321 | { | 363 | { |
322 | assetServerURL = UserManagementModule.GetUserServerURL(userID, "AssetServerURI"); | 364 | if (IsLocalInventoryAssetsUser(userID, out assetServerURL)) |
323 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); | 365 | { |
366 | m_log.DebugFormat("[HGScene]: user {0} has local assets {1}", userID, assetServerURL); | ||
367 | return false; | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | m_log.DebugFormat("[HGScene]: user {0} has foreign assets {1}", userID, assetServerURL); | ||
372 | return true; | ||
373 | } | ||
324 | } | 374 | } |
325 | return true; | ||
326 | } | 375 | } |
327 | |||
328 | return false; | 376 | return false; |
329 | } | 377 | } |
330 | 378 | ||
379 | private bool IsLocalInventoryAssetsUser(UUID uuid, out string assetsURL) | ||
380 | { | ||
381 | assetsURL = UserManagementModule.GetUserServerURL(uuid, "AssetServerURI"); | ||
382 | if (assetsURL == string.Empty) | ||
383 | { | ||
384 | AgentCircuitData agent = m_Scene.AuthenticateHandler.GetAgentCircuitData(uuid); | ||
385 | if (agent != null) | ||
386 | { | ||
387 | assetsURL = agent.ServiceURLs["AssetServerURI"].ToString(); | ||
388 | assetsURL = assetsURL.Trim(new char[] { '/' }); | ||
389 | } | ||
390 | } | ||
391 | return m_LocalAssetsURL.Equals(assetsURL); | ||
392 | } | ||
393 | |||
394 | |||
331 | protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) | 395 | protected override InventoryItemBase GetItem(UUID agentID, UUID itemID) |
332 | { | 396 | { |
333 | InventoryItemBase item = base.GetItem(agentID, itemID); | 397 | InventoryItemBase item = base.GetItem(agentID, itemID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 91f1b63..3c3d077 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -125,13 +125,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
125 | 125 | ||
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | } | ||
129 | |||
130 | public bool AddInventoryItem(InventoryItemBase item) | ||
131 | { | ||
132 | return AddInventoryItem(item, true); | ||
128 | } | 133 | } |
129 | 134 | ||
130 | /// <summary> | 135 | /// <summary> |
131 | /// Add the given inventory item to a user's inventory. | 136 | /// Add the given inventory item to a user's inventory. |
132 | /// </summary> | 137 | /// </summary> |
133 | /// <param name="item"></param> | 138 | /// <param name="item"></param> |
134 | public bool AddInventoryItem(InventoryItemBase item) | 139 | public bool AddInventoryItem(InventoryItemBase item, bool trigger) |
135 | { | 140 | { |
136 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) | 141 | if (item.Folder != UUID.Zero && InventoryService.AddItem(item)) |
137 | { | 142 | { |
@@ -140,7 +145,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | { | 145 | { |
141 | userlevel = 1; | 146 | userlevel = 1; |
142 | } | 147 | } |
143 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | 148 | if (trigger) |
149 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
144 | 150 | ||
145 | return true; | 151 | return true; |
146 | } | 152 | } |
@@ -179,7 +185,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | { | 185 | { |
180 | userlevel = 1; | 186 | userlevel = 1; |
181 | } | 187 | } |
182 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | 188 | if (trigger) |
189 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); | ||
183 | 190 | ||
184 | if (originalFolder != UUID.Zero) | 191 | if (originalFolder != UUID.Zero) |
185 | { | 192 | { |
@@ -764,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 771 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
765 | if (invAccess != null) | 772 | if (invAccess != null) |
766 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); | 773 | invAccess.TransferInventoryAssets(itemCopy, senderId, recipient); |
767 | AddInventoryItem(itemCopy); | 774 | AddInventoryItem(itemCopy, false); |
768 | 775 | ||
769 | if (!Permissions.BypassPermissions()) | 776 | if (!Permissions.BypassPermissions()) |
770 | { | 777 | { |
diff --git a/OpenSim/Tools/Configger/ConfigurationLoader.cs b/OpenSim/Tools/Configger/ConfigurationLoader.cs index 0b6ee9c..4820e0b 100644 --- a/OpenSim/Tools/Configger/ConfigurationLoader.cs +++ b/OpenSim/Tools/Configger/ConfigurationLoader.cs | |||
@@ -64,14 +64,14 @@ namespace OpenSim.Tools.Configger | |||
64 | /// <param name="configSettings"></param> | 64 | /// <param name="configSettings"></param> |
65 | /// <param name="networkInfo"></param> | 65 | /// <param name="networkInfo"></param> |
66 | /// <returns>A configuration that gets passed to modules</returns> | 66 | /// <returns>A configuration that gets passed to modules</returns> |
67 | public IConfigSource LoadConfigSettings() | 67 | public IConfigSource LoadConfigSettings(IConfig startupConfig) |
68 | { | 68 | { |
69 | bool iniFileExists = false; | 69 | bool iniFileExists = false; |
70 | 70 | ||
71 | List<string> sources = new List<string>(); | 71 | List<string> sources = new List<string>(); |
72 | 72 | ||
73 | string iniFileName = "OpenSim.ini"; | 73 | string iniFileName = startupConfig.GetString("inifile", Path.Combine(".", "OpenSim.ini")); |
74 | string iniFilePath = Path.Combine(".", iniFileName); | 74 | Console.WriteLine("---> " + iniFileName + " <---"); |
75 | 75 | ||
76 | if (IsUri(iniFileName)) | 76 | if (IsUri(iniFileName)) |
77 | { | 77 | { |
@@ -80,10 +80,10 @@ namespace OpenSim.Tools.Configger | |||
80 | } | 80 | } |
81 | else | 81 | else |
82 | { | 82 | { |
83 | if (File.Exists(iniFilePath)) | 83 | if (File.Exists(iniFileName)) |
84 | { | 84 | { |
85 | if (!sources.Contains(iniFilePath)) | 85 | if (!sources.Contains(iniFileName)) |
86 | sources.Add(iniFilePath); | 86 | sources.Add(iniFileName); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
diff --git a/OpenSim/Tools/Configger/Main.cs b/OpenSim/Tools/Configger/Main.cs index 61a12e3..d7d918b 100644 --- a/OpenSim/Tools/Configger/Main.cs +++ b/OpenSim/Tools/Configger/Main.cs | |||
@@ -35,15 +35,16 @@ namespace OpenSim.Tools.Configger | |||
35 | public static int Main(string[] args) | 35 | public static int Main(string[] args) |
36 | { | 36 | { |
37 | ArgvConfigSource argvConfig = new ArgvConfigSource(args); | 37 | ArgvConfigSource argvConfig = new ArgvConfigSource(args); |
38 | |||
38 | argvConfig.AddSwitch("Startup", "format", "f"); | 39 | argvConfig.AddSwitch("Startup", "format", "f"); |
40 | argvConfig.AddSwitch("Startup", "inifile"); | ||
39 | 41 | ||
40 | IConfig startupConfig = argvConfig.Configs["Startup"]; | 42 | IConfig startupConfig = argvConfig.Configs["Startup"]; |
41 | 43 | ||
42 | string format = startupConfig.GetString("format", "ini"); | 44 | string format = startupConfig.GetString("format", "ini"); |
43 | 45 | ||
44 | ConfigurationLoader loader = new ConfigurationLoader(); | 46 | ConfigurationLoader loader = new ConfigurationLoader(); |
45 | 47 | IConfigSource s = loader.LoadConfigSettings(startupConfig); | |
46 | IConfigSource s = loader.LoadConfigSettings(); | ||
47 | 48 | ||
48 | if (format == "mysql") | 49 | if (format == "mysql") |
49 | { | 50 | { |