Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
Melanie
2010-07-08 17:32:57 +01:00
18 changed files with 157 additions and 148 deletions

View File

@@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
if (ids.ContainsKey(assetID))
ids.Remove(assetID);
foreach (UUID uuid in ids.Keys)
FetchAsset(userAssetURL, uuid);

View File

@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return ret;
}
// DO NOT OVERRIDE THIS METHOD
// DO NOT OVERRIDE THE BASE METHOD
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient)
{
@@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (!assetID.Equals(UUID.Zero))
{
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
if (remoteClient != null)
UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
}
else
m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
@@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
m_assMapper.Post(item.AssetID, receiver, userAssetServer);
}
#endregion
public bool IsForeignUser(UUID userID, out string assetServerURL)
public override bool IsForeignUser(UUID userID, out string assetServerURL)
{
assetServerURL = string.Empty;
UserAccount account = null;
@@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return false;
}
#endregion
protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
{
InventoryItemBase item = base.GetItem(agentID, itemID);
string userAssetServer = string.Empty;
if (IsForeignUser(agentID, out userAssetServer))
m_assMapper.Get(item.AssetID, agentID, userAssetServer);
return item;
}
}
}

View File

@@ -639,6 +639,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
}
public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
{
InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
if (assetRequestItem == null)
{
ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
if (lib != null)
assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
if (assetRequestItem == null)
return false;
}
// At this point, we need to apply perms
// only to notecards and scripts. All
// other asset types are always available
//
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
{
if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
{
remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
return false;
}
}
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
{
if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
{
remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
return false;
}
}
if (assetRequestItem.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
Name, requestID, itemID, assetRequestItem.AssetID);
return false;
}
return true;
}
public virtual bool IsForeignUser(UUID userID, out string assetServerURL)
{
assetServerURL = string.Empty;
return false;
}
#endregion
#region Misc
@@ -661,6 +712,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return asset;
}
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
{
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
assetRequestItem = invService.GetItem(assetRequestItem);
return assetRequestItem;
}
#endregion
}
}

View File

@@ -41,7 +41,7 @@ using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
public class HGAssetBroker :
ISharedRegionModule, IAssetService, IHyperAssetService
ISharedRegionModule, IAssetService
{
private static readonly ILog m_log =
LogManager.GetLogger(
@@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
m_aScene = scene;
scene.RegisterModuleInterface<IAssetService>(this);
scene.RegisterModuleInterface<IHyperAssetService>(this);
}
public void RemoveRegion(Scene scene)

View File

@@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
}
}
// else put a null; it means that the methods should forward to local grid's inventory
m_InventoryURLs.Add(userID, null);
}
private void DropInventoryServiceURL(UUID userID)
@@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
if (m_InventoryURLs.ContainsKey(userID))
return m_InventoryURLs[userID];
else
CacheInventoryServiceURL(userID);
CacheInventoryServiceURL(userID);
return m_InventoryURLs[userID];
if (m_InventoryURLs.ContainsKey(userID))
return m_InventoryURLs[userID];
return null; //it means that the methods should forward to local grid's inventory
}
#endregion