From 5246dc33dcfc51b7ebb19b269159df3991029350 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 13 Aug 2009 14:10:12 -0700 Subject: Renamed QueryItem/QueryFolder to GetItem/GetFolder. The word 'query' starting to get on my nerves. --- .../Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index 22289aa..41aacd0 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs @@ -156,12 +156,12 @@ namespace OpenSim.Services.Connectors return false; } - public InventoryItemBase QueryItem(InventoryItemBase item) + public InventoryItemBase GetItem(InventoryItemBase item) { return null; } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; } -- cgit v1.1 From 034c9cf606373bfa9d3f8040cd787f789e0efbf2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 13 Aug 2009 17:34:15 -0700 Subject: Added GetAssetPermissions. Few last bugs nixed. This is ready for testing. --- .../Inventory/HGInventoryServiceConnector.cs | 14 ++++++- .../Inventory/ISessionAuthInventoryService.cs | 2 + .../Inventory/InventoryServiceConnector.cs | 49 +++++++++++++++------- .../QuickAndDirtyInventoryServiceConnector.cs | 5 +++ 4 files changed, 54 insertions(+), 16 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index f6d1500..94b4ad9 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs @@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.Inventory /// public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID) { - m_log.Debug("[HGInventory]: GetSystemFolders " + id); + m_log.Debug("[HGInventory]: GetFolderContent " + id); string url = string.Empty; string userID = string.Empty; @@ -279,5 +279,17 @@ namespace OpenSim.Services.Connectors.Inventory return null; } + public int GetAssetPermissions(string id, UUID assetID, UUID sessionID) + { + string url = string.Empty; + string userID = string.Empty; + + if (StringToUrlAndUserID(id, out url, out userID)) + { + ISessionAuthInventoryService connector = GetConnector(url); + return connector.GetAssetPermissions(userID, assetID, sessionID); + } + return 0; + } } } diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index 973cb0a..f50bcf5 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs @@ -120,5 +120,7 @@ namespace OpenSim.Services.Connectors InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID session_id); + int GetAssetPermissions(string userID, UUID assetID, UUID session_id); + } } diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index e41b427..4907015 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -163,21 +163,21 @@ namespace OpenSim.Services.Connectors /// public Dictionary GetSystemFolders(string userID, UUID sessionID) { - // !!! Not just yet. - //try - //{ - // List folders = SynchronousRestSessionObjectPoster>.BeginPostObject( - // "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); - // Dictionary dFolders = new Dictionary(); - // foreach (InventoryFolderBase f in folders) - // dFolders[(AssetType)f.Type] = f; - // return dFolders; - //} - //catch (Exception e) - //{ - // m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}", - // e.Source, e.Message); - //} + try + { + List folders = SynchronousRestSessionObjectPoster>.BeginPostObject( + "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); + + Dictionary dFolders = new Dictionary(); + foreach (InventoryFolderBase f in folders) + dFolders[(AssetType)f.Type] = f; + return dFolders; + } + catch (Exception e) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}", + e.Source, e.Message); + } return new Dictionary(); } @@ -348,6 +348,25 @@ namespace OpenSim.Services.Connectors return null; } + public int GetAssetPermissions(string userID, UUID assetID, UUID sessionID) + { + try + { + InventoryItemBase item = new InventoryItemBase(); + item.Owner = new UUID(userID); + item.AssetID = assetID; + return SynchronousRestSessionObjectPoster.BeginPostObject( + "POST", m_ServerURI + "/AssetPermissions/", item, sessionID.ToString(), userID); + } + catch (Exception e) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: AssetPermissions operation failed, {0} {1}", + e.Source, e.Message); + } + + return 0; + } + #endregion /// diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index 41aacd0..5cbd307 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs @@ -176,5 +176,10 @@ namespace OpenSim.Services.Connectors return null; } + public int GetAssetPermissions(UUID userID, UUID assetID) + { + return 0; + } + } } -- cgit v1.1 From 3a3f9d5abbdd25511b1bb2cd7476ba68761a0d12 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 17 Aug 2009 14:14:22 -0700 Subject: Added some padding to the remote inventory connector so that it tries to operate with the old Grid.InventoryServer.exe. Untested, but it should work -- slow. --- .../Inventory/InventoryServiceConnector.cs | 74 ++++++++++++++++++++-- 1 file changed, 70 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 4907015..5d94eac 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -163,20 +163,47 @@ namespace OpenSim.Services.Connectors /// public Dictionary GetSystemFolders(string userID, UUID sessionID) { + List folders = null; + Dictionary dFolders = new Dictionary(); try { - List folders = SynchronousRestSessionObjectPoster>.BeginPostObject( + folders = SynchronousRestSessionObjectPoster>.BeginPostObject( "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); - Dictionary dFolders = new Dictionary(); foreach (InventoryFolderBase f in folders) dFolders[(AssetType)f.Type] = f; + return dFolders; } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}", + // Maybe we're talking to an old inventory server. Try this other thing. + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}. Trying RootFolders.", e.Source, e.Message); + + try + { + folders = SynchronousRestSessionObjectPoster>.BeginPostObject( + "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); + } + catch (Exception ex) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", + e.Source, ex.Message); + } + + if ((folders != null) && (folders.Count > 0)) + { + dFolders[AssetType.Folder] = folders[0]; // Root folder is the first one + folders.RemoveAt(0); + foreach (InventoryFolderBase f in folders) + { + if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) + dFolders[(AssetType)f.Type] = f; + } + + return dFolders; + } } return new Dictionary(); @@ -192,13 +219,52 @@ namespace OpenSim.Services.Connectors { try { + // normal case return SynchronousRestSessionObjectPoster.BeginPostObject( "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); } catch (Exception e) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}", + // Maybe we're talking to an old inventory server. Try this other thing. + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}. Trying RootFolders and GetItems.", e.Source, e.Message); + + List folders = null; + try + { + folders = SynchronousRestSessionObjectPoster>.BeginPostObject( + "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); + } + catch (Exception ex) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", + e.Source, ex.Message); + } + + if ((folders != null) && (folders.Count > 0)) + { + folders = folders.FindAll(delegate (InventoryFolderBase f) { return f.ParentID == folderID ; }); + + try + { + List items = SynchronousRestSessionObjectPoster>.BeginPostObject( + "POST", m_ServerURI + "/GetItems/", folderID.Guid, sessionID.ToString(), userID.ToString()); + + if (items != null) + { + InventoryCollection result = new InventoryCollection(); + result.Folders = folders; + result.Items = items; + result.UserID = new UUID(userID); + return result; + } + } + catch (Exception ex) + { + m_log.ErrorFormat("[INVENTORY CONNECTOR]: QueryFolder and GetItems operation failed, {0} {1}. Give up.", + e.Source, ex.Message); + } + } } return null; -- cgit v1.1