On the way to making HG inventory work. Inventory can now be accessed again. Assets are still broken.
parent
5001f61c08
commit
81a6f9a515
|
@ -50,25 +50,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
private bool m_Initialized = false;
|
private bool m_Initialized = false;
|
||||||
private Scene m_Scene;
|
private Scene m_Scene;
|
||||||
private IUserAccountService m_UserAccountService; // This should change to IUserProfileService
|
private IUserAccountService m_UserAccountService;
|
||||||
|
|
||||||
private IInventoryService m_GridService;
|
private IInventoryService m_GridService;
|
||||||
private ISessionAuthInventoryService m_HGService;
|
private ISessionAuthInventoryService m_HGService;
|
||||||
|
|
||||||
private string m_LocalGridInventoryURI = string.Empty;
|
|
||||||
|
|
||||||
private string LocalGridInventory
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
// REFACTORING PROBLEM
|
|
||||||
//if (m_LocalGridInventoryURI == null || m_LocalGridInventoryURI == "")
|
|
||||||
// m_LocalGridInventoryURI = m_Scene.CommsManager.NetworkServersInfo.InventoryURL;
|
|
||||||
//return m_LocalGridInventoryURI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return null; }
|
||||||
|
@ -133,8 +119,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty);
|
|
||||||
|
|
||||||
Init(source);
|
Init(source);
|
||||||
|
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
|
@ -199,22 +183,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public override InventoryCollection GetUserInventory(UUID userID)
|
public override InventoryCollection GetUserInventory(UUID userID)
|
||||||
{
|
{
|
||||||
if (IsLocalGridUser(userID))
|
return null;
|
||||||
return m_GridService.GetUserInventory(userID);
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
|
||||||
{
|
{
|
||||||
if (IsLocalGridUser(userID))
|
|
||||||
m_GridService.GetUserInventory(userID, callback);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UUID sessionID = GetSessionID(userID);
|
|
||||||
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
|
||||||
m_HGService.GetUserInventory(uri, sessionID, callback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inherited. See base
|
// Inherited. See base
|
||||||
|
@ -234,19 +207,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
if (IsLocalGridUser(userID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(userID, out uri))
|
||||||
return m_GridService.GetFolderContent(userID, folderID);
|
return m_GridService.GetFolderContent(userID, folderID);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(userID);
|
UUID sessionID = GetSessionID(userID);
|
||||||
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
uri = uri + "/" + userID.ToString();
|
||||||
return m_HGService.GetFolderContent(uri, folderID, sessionID);
|
return m_HGService.GetFolderContent(uri, folderID, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
||||||
{
|
{
|
||||||
if (IsLocalGridUser(userID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(userID, out uri))
|
||||||
{
|
{
|
||||||
// This is not pretty, but it will have to do for now
|
// This is not pretty, but it will have to do for now
|
||||||
if (m_GridService is BaseInventoryConnector)
|
if (m_GridService is BaseInventoryConnector)
|
||||||
|
@ -263,7 +238,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(userID);
|
UUID sessionID = GetSessionID(userID);
|
||||||
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
uri = uri + "/" + userID.ToString();
|
||||||
return m_HGService.GetSystemFolders(uri, sessionID);
|
return m_HGService.GetSystemFolders(uri, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,12 +274,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
|
||||||
{
|
{
|
||||||
if (IsLocalGridUser(userID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(userID, out uri))
|
||||||
return m_GridService.GetFolderItems(userID, folderID);
|
return m_GridService.GetFolderItems(userID, folderID);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(userID);
|
UUID sessionID = GetSessionID(userID);
|
||||||
string uri = GetUserInventoryURI(userID) + "/" + userID;
|
uri = uri + "/" + userID.ToString();
|
||||||
return m_HGService.GetFolderItems(uri, folderID, sessionID);
|
return m_HGService.GetFolderItems(uri, folderID, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,12 +290,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(folder.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(folder.Owner, out uri))
|
||||||
return m_GridService.AddFolder(folder);
|
return m_GridService.AddFolder(folder);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(folder.Owner);
|
UUID sessionID = GetSessionID(folder.Owner);
|
||||||
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
|
uri = uri + "/" + folder.Owner.ToString();
|
||||||
return m_HGService.AddFolder(uri, folder, sessionID);
|
return m_HGService.AddFolder(uri, folder, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,12 +306,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(folder.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(folder.Owner, out uri))
|
||||||
return m_GridService.UpdateFolder(folder);
|
return m_GridService.UpdateFolder(folder);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(folder.Owner);
|
UUID sessionID = GetSessionID(folder.Owner);
|
||||||
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
|
uri = uri + "/" + folder.Owner.ToString();
|
||||||
return m_HGService.UpdateFolder(uri, folder, sessionID);
|
return m_HGService.UpdateFolder(uri, folder, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -346,12 +324,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folderIDs.Count == 0)
|
if (folderIDs.Count == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(ownerID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(ownerID, out uri))
|
||||||
return m_GridService.DeleteFolders(ownerID, folderIDs);
|
return m_GridService.DeleteFolders(ownerID, folderIDs);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(ownerID);
|
UUID sessionID = GetSessionID(ownerID);
|
||||||
string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
|
uri = uri + "/" + ownerID.ToString();
|
||||||
return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
|
return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,12 +340,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(folder.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(folder.Owner, out uri))
|
||||||
return m_GridService.MoveFolder(folder);
|
return m_GridService.MoveFolder(folder);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(folder.Owner);
|
UUID sessionID = GetSessionID(folder.Owner);
|
||||||
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
|
uri = uri + "/" + folder.Owner.ToString();
|
||||||
return m_HGService.MoveFolder(uri, folder, sessionID);
|
return m_HGService.MoveFolder(uri, folder, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,12 +356,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(folder.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(folder.Owner, out uri))
|
||||||
return m_GridService.PurgeFolder(folder);
|
return m_GridService.PurgeFolder(folder);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(folder.Owner);
|
UUID sessionID = GetSessionID(folder.Owner);
|
||||||
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
|
uri = uri + "/" + folder.Owner.ToString();
|
||||||
return m_HGService.PurgeFolder(uri, folder, sessionID);
|
return m_HGService.PurgeFolder(uri, folder, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,14 +375,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(item.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(item.Owner, out uri))
|
||||||
{
|
{
|
||||||
return m_GridService.AddItem(item);
|
return m_GridService.AddItem(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(item.Owner);
|
UUID sessionID = GetSessionID(item.Owner);
|
||||||
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
|
uri = uri + "/" + item.Owner.ToString();
|
||||||
return m_HGService.AddItem(uri, item, sessionID);
|
return m_HGService.AddItem(uri, item, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,12 +393,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(item.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(item.Owner, out uri))
|
||||||
return m_GridService.UpdateItem(item);
|
return m_GridService.UpdateItem(item);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(item.Owner);
|
UUID sessionID = GetSessionID(item.Owner);
|
||||||
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
|
uri = uri + "/" + item.Owner.ToString();
|
||||||
return m_HGService.UpdateItem(uri, item, sessionID);
|
return m_HGService.UpdateItem(uri, item, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,12 +411,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (items.Count == 0)
|
if (items.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (IsLocalGridUser(ownerID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(ownerID, out uri))
|
||||||
return m_GridService.MoveItems(ownerID, items);
|
return m_GridService.MoveItems(ownerID, items);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(ownerID);
|
UUID sessionID = GetSessionID(ownerID);
|
||||||
string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
|
uri = uri + "/" + ownerID.ToString();
|
||||||
return m_HGService.MoveItems(uri, items, sessionID);
|
return m_HGService.MoveItems(uri, items, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,12 +431,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (itemIDs.Count == 0)
|
if (itemIDs.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (IsLocalGridUser(ownerID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(ownerID, out uri))
|
||||||
return m_GridService.DeleteItems(ownerID, itemIDs);
|
return m_GridService.DeleteItems(ownerID, itemIDs);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(ownerID);
|
UUID sessionID = GetSessionID(ownerID);
|
||||||
string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
|
uri = uri + "/" + ownerID.ToString();
|
||||||
return m_HGService.DeleteItems(uri, itemIDs, sessionID);
|
return m_HGService.DeleteItems(uri, itemIDs, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,12 +447,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return null;
|
return null;
|
||||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
|
||||||
if (IsLocalGridUser(item.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(item.Owner, out uri))
|
||||||
return m_GridService.GetItem(item);
|
return m_GridService.GetItem(item);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(item.Owner);
|
UUID sessionID = GetSessionID(item.Owner);
|
||||||
string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
|
uri = uri + "/" + item.Owner.ToString();
|
||||||
return m_HGService.QueryItem(uri, item, sessionID);
|
return m_HGService.QueryItem(uri, item, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,12 +463,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (IsLocalGridUser(folder.Owner))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(folder.Owner, out uri))
|
||||||
return m_GridService.GetFolder(folder);
|
return m_GridService.GetFolder(folder);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(folder.Owner);
|
UUID sessionID = GetSessionID(folder.Owner);
|
||||||
string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
|
uri = uri + "/" + folder.Owner.ToString();
|
||||||
return m_HGService.QueryFolder(uri, folder, sessionID);
|
return m_HGService.QueryFolder(uri, folder, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,12 +486,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||||
{
|
{
|
||||||
if (IsLocalGridUser(userID))
|
string uri = string.Empty;
|
||||||
|
if (!IsForeignUser(userID, out uri))
|
||||||
return m_GridService.GetAssetPermissions(userID, assetID);
|
return m_GridService.GetAssetPermissions(userID, assetID);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(userID);
|
UUID sessionID = GetSessionID(userID);
|
||||||
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
uri = uri + "/" + userID.ToString();
|
||||||
return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
|
return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,59 +511,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsLocalGridUser(UUID userID)
|
private bool IsForeignUser(UUID userID, out string inventoryURL)
|
||||||
{
|
{
|
||||||
return true;
|
inventoryURL = string.Empty;
|
||||||
|
UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
||||||
// REFACTORING PROBLEM. This needs to be rewritten
|
if (account == null) // foreign user
|
||||||
|
{
|
||||||
//if (m_UserAccountService == null)
|
ScenePresence sp = null;
|
||||||
//{
|
m_Scene.TryGetAvatar(userID, out sp);
|
||||||
// m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no user account service. Returning false.");
|
if (sp != null)
|
||||||
// return false;
|
{
|
||||||
//}
|
AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||||
|
if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
|
||||||
//UserAccount uinfo = m_UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
|
{
|
||||||
//if (uinfo == null)
|
inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
|
||||||
//{
|
inventoryURL = inventoryURL.Trim(new char[] { '/' });
|
||||||
// m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no account for user {0}. Returning false.", userID);
|
return true;
|
||||||
// return false;
|
}
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
//if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
|
return false;
|
||||||
// // this happens in standalone profiles, apparently
|
|
||||||
// return true;
|
|
||||||
|
|
||||||
//string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
|
||||||
|
|
||||||
//string uri = LocalGridInventory.TrimEnd('/');
|
|
||||||
|
|
||||||
//if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
|
|
||||||
//{
|
|
||||||
// return true;
|
|
||||||
//}
|
|
||||||
//m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
|
|
||||||
//return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetUserInventoryURI(UUID userID)
|
|
||||||
{
|
|
||||||
string invURI = LocalGridInventory;
|
|
||||||
// REFACTORING PROBLEM!!! This needs to be rewritten
|
|
||||||
|
|
||||||
//CachedUserInfo uinfo = m_UserAccountService.GetUserDetails(userID);
|
|
||||||
//if ((uinfo == null) || (uinfo.UserProfile == null))
|
|
||||||
// return invURI;
|
|
||||||
|
|
||||||
//string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
|
||||||
|
|
||||||
//if ((userInventoryServerURI != null) &&
|
|
||||||
// (userInventoryServerURI != ""))
|
|
||||||
// invURI = userInventoryServerURI;
|
|
||||||
|
|
||||||
return invURI;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue