diff options
Added CreateObject(regionhandle, userID, itemID) to post objects that are to be fetched from the user's inventory server and rezzed in the region. Added all code necessary to fetch the item and the asset, and rez it inworld. The access to the item is uncap-ed and unverified -- I may place it later either under a cap or with auth verification. But in this model regions don't have the user's inventory, so they would have to guess the item IDs.
Added safemode config to Standalone Hypergrid, similar effect to AllowRegionAccessToInventory in Inventory Server. Everyone should have these vars set to their default values except me!
Diffstat (limited to 'OpenSim/Region/Framework')
4 files changed, 82 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs index ef3cb51..b57b5ed 100644 --- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs | |||
@@ -89,6 +89,16 @@ namespace OpenSim.Region.Framework.Interfaces | |||
89 | /// <returns></returns> | 89 | /// <returns></returns> |
90 | bool SendCreateObject(ulong regionHandle, ISceneObject sog, bool isLocalCall); | 90 | bool SendCreateObject(ulong regionHandle, ISceneObject sog, bool isLocalCall); |
91 | 91 | ||
92 | /// <summary> | ||
93 | /// Create an object from the user's inventory in the destination region. | ||
94 | /// This message is used primarily for prim crossing. | ||
95 | /// </summary> | ||
96 | /// <param name="regionHandle"></param> | ||
97 | /// <param name="sog"></param> | ||
98 | /// <param name="isLocalCall"></param> | ||
99 | /// <returns></returns> | ||
100 | bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID); | ||
101 | |||
92 | #endregion Objects | 102 | #endregion Objects |
93 | 103 | ||
94 | #region Regions | 104 | #region Regions |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index e9106e5..b192101 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Framework.Communications.Clients; | ||
36 | 37 | ||
37 | //using HyperGrid.Framework; | 38 | //using HyperGrid.Framework; |
38 | //using OpenSim.Region.Communications.Hypergrid; | 39 | //using OpenSim.Region.Communications.Hypergrid; |
@@ -50,6 +51,10 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
50 | // This maps between asset UUIDs and asset servers | 51 | // This maps between asset UUIDs and asset servers |
51 | private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>(); | 52 | private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>(); |
52 | 53 | ||
54 | // This maps between inventory server urls and inventory server clients | ||
55 | private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); | ||
56 | |||
57 | |||
53 | private Scene m_scene; | 58 | private Scene m_scene; |
54 | #endregion | 59 | #endregion |
55 | 60 | ||
@@ -72,6 +77,14 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
72 | return null; | 77 | return null; |
73 | } | 78 | } |
74 | 79 | ||
80 | private string UserInventoryURL(UUID userID) | ||
81 | { | ||
82 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | ||
83 | if (uinfo != null) | ||
84 | return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI; | ||
85 | return null; | ||
86 | } | ||
87 | |||
75 | private bool IsLocalUser(UUID userID) | 88 | private bool IsLocalUser(UUID userID) |
76 | { | 89 | { |
77 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | 90 | CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID); |
@@ -275,9 +288,9 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
275 | 288 | ||
276 | #region Public interface | 289 | #region Public interface |
277 | 290 | ||
278 | public void Get(UUID itemID, UUID ownerID) | 291 | public void Get(UUID assetID, UUID ownerID) |
279 | { | 292 | { |
280 | if (!IsInAssetMap(itemID) && !IsLocalUser(ownerID)) | 293 | if (!IsInAssetMap(assetID) && !IsLocalUser(ownerID)) |
281 | { | 294 | { |
282 | // Get the item from the remote asset server onto the local AssetCache | 295 | // Get the item from the remote asset server onto the local AssetCache |
283 | // and place an entry in m_assetMap | 296 | // and place an entry in m_assetMap |
@@ -295,11 +308,11 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
295 | m_assetServers.Add(userAssetURL, asscli); | 308 | m_assetServers.Add(userAssetURL, asscli); |
296 | } | 309 | } |
297 | 310 | ||
298 | m_log.Debug("[HGScene]: Fetching object " + itemID + " to asset server " + userAssetURL); | 311 | m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL); |
299 | bool success = FetchAsset(asscli, itemID, false); // asscli.RequestAsset(item.ItemID, false); | 312 | bool success = FetchAsset(asscli, assetID, false); // asscli.RequestAsset(item.ItemID, false); |
300 | 313 | ||
301 | // OK, now fetch the inside. | 314 | // OK, now fetch the inside. |
302 | Dictionary<UUID, bool> ids = SniffUUIDs(itemID); | 315 | Dictionary<UUID, bool> ids = SniffUUIDs(assetID); |
303 | Dump(ids); | 316 | Dump(ids); |
304 | foreach (KeyValuePair<UUID, bool> kvp in ids) | 317 | foreach (KeyValuePair<UUID, bool> kvp in ids) |
305 | FetchAsset(asscli, kvp.Key, kvp.Value); | 318 | FetchAsset(asscli, kvp.Key, kvp.Value); |
@@ -308,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
308 | if (success) | 321 | if (success) |
309 | { | 322 | { |
310 | m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL); | 323 | m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL); |
311 | m_assetMap.Add(itemID, asscli); | 324 | m_assetMap.Add(assetID, asscli); |
312 | } | 325 | } |
313 | else | 326 | else |
314 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); | 327 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); |
@@ -318,7 +331,36 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
318 | } | 331 | } |
319 | } | 332 | } |
320 | 333 | ||
321 | public void Post(UUID itemID, UUID ownerID) | 334 | public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) |
335 | { | ||
336 | if (!IsLocalUser(item.Owner)) | ||
337 | { | ||
338 | InventoryClient invCli = null; | ||
339 | string inventoryURL = UserInventoryURL(item.Owner); | ||
340 | if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli)) | ||
341 | { | ||
342 | m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL); | ||
343 | invCli = new InventoryClient(inventoryURL); | ||
344 | m_inventoryServers.Add(inventoryURL, invCli); | ||
345 | } | ||
346 | |||
347 | item = invCli.GetInventoryItem(item); | ||
348 | if (item != null) | ||
349 | { | ||
350 | // Change the folder, stick it in root folder, all items flattened out here in this region cache | ||
351 | item.Folder = rootFolder; | ||
352 | //userInfo.AddItem(item); don't use this, it calls back to the inventory server | ||
353 | lock (userInfo.RootFolder.Items) | ||
354 | { | ||
355 | userInfo.RootFolder.Items[item.ID] = item; | ||
356 | } | ||
357 | |||
358 | } | ||
359 | } | ||
360 | return item; | ||
361 | } | ||
362 | |||
363 | public void Post(UUID assetID, UUID ownerID) | ||
322 | { | 364 | { |
323 | if (!IsLocalUser(ownerID)) | 365 | if (!IsLocalUser(ownerID)) |
324 | { | 366 | { |
@@ -337,11 +379,11 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
337 | asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache! | 379 | asscli.SetReceiver(m_scene.CommsManager.AssetCache); // Straight to the asset cache! |
338 | m_assetServers.Add(userAssetURL, asscli); | 380 | m_assetServers.Add(userAssetURL, asscli); |
339 | } | 381 | } |
340 | m_log.Debug("[HGScene]: Posting object " + itemID + " to asset server " + userAssetURL); | 382 | m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL); |
341 | bool success = PostAsset(asscli, itemID); | 383 | bool success = PostAsset(asscli, assetID); |
342 | 384 | ||
343 | // Now the inside | 385 | // Now the inside |
344 | Dictionary<UUID, bool> ids = SniffUUIDs(itemID); | 386 | Dictionary<UUID, bool> ids = SniffUUIDs(assetID); |
345 | Dump(ids); | 387 | Dump(ids); |
346 | foreach (KeyValuePair<UUID, bool> kvp in ids) | 388 | foreach (KeyValuePair<UUID, bool> kvp in ids) |
347 | PostAsset(asscli, kvp.Key); | 389 | PostAsset(asscli, kvp.Key); |
@@ -349,8 +391,8 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
349 | if (success) | 391 | if (success) |
350 | { | 392 | { |
351 | m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); | 393 | m_log.Debug("[HGScene]: Successfully posted item to remote asset server " + userAssetURL); |
352 | if (!m_assetMap.ContainsKey(itemID)) | 394 | if (!m_assetMap.ContainsKey(assetID)) |
353 | m_assetMap.Add(itemID, asscli); | 395 | m_assetMap.Add(assetID, asscli); |
354 | } | 396 | } |
355 | else | 397 | else |
356 | m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); | 398 | m_log.Warn("[HGScene]: Could not post asset to remote asset server " + userAssetURL); |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index 93b81e0..4fde9bb 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs | |||
@@ -120,6 +120,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
120 | { | 120 | { |
121 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 121 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); |
122 | 122 | ||
123 | if (item == null) | ||
124 | { // Fetch the item | ||
125 | item = new InventoryItemBase(); | ||
126 | item.Owner = remoteClient.AgentId; | ||
127 | item.ID = itemID; | ||
128 | item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); | ||
129 | } | ||
123 | if (item != null) | 130 | if (item != null) |
124 | { | 131 | { |
125 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); | 132 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5f68ccb..30257f1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1731,6 +1731,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1731 | return true; | 1731 | return true; |
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | public virtual bool IncomingCreateObject(UUID userID, UUID itemID) | ||
1735 | { | ||
1736 | ScenePresence sp = GetScenePresence(userID); | ||
1737 | if (sp != null) | ||
1738 | { | ||
1739 | uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); | ||
1740 | SceneObjectGroup sog = m_sceneGraph.RezSingleAttachment(sp.ControllingClient, itemID, attPt); | ||
1741 | } | ||
1742 | return false; | ||
1743 | } | ||
1744 | |||
1734 | public bool AddSceneObject(UUID primID, SceneObjectGroup sceneObject) | 1745 | public bool AddSceneObject(UUID primID, SceneObjectGroup sceneObject) |
1735 | { | 1746 | { |
1736 | // If the user is banned, we won't let any of their objects | 1747 | // If the user is banned, we won't let any of their objects |