Merge branch 'master' of ../opensim-diva/ into inventory-connector
commit
973be65945
|
@ -747,7 +747,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
InventoryItemBase itemInfo = null;
|
||||
|
||||
itemInfo = m_InventoryService.QueryItem(item);
|
||||
itemInfo = m_InventoryService.GetItem(item);
|
||||
|
||||
if (itemInfo != null)
|
||||
{
|
||||
|
@ -784,7 +784,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
InventoryFolderBase folderInfo = null;
|
||||
|
||||
folderInfo = m_InventoryService.QueryFolder(folder);
|
||||
folderInfo = m_InventoryService.GetFolder(folder);
|
||||
|
||||
if (folderInfo != null)
|
||||
{
|
||||
|
|
|
@ -186,14 +186,14 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
|
||||
Assert.That(
|
||||
userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null);
|
||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
|
||||
Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
|
||||
|
||||
// 2: Try a folder create that should work
|
||||
Assert.That(
|
||||
userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Not.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Not.Null);
|
||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
|
||||
Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
|
||||
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.QueryFolder(myFolder);
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.GetFolder(myFolder);
|
||||
Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
|
||||
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
|
||||
Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
|
||||
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.QueryFolder(myFolder2);
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.GetFolder(myFolder2);
|
||||
Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
|
||||
Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
|
||||
Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
|
||||
|
@ -296,7 +296,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
InventoryFolderBase myFolder = new InventoryFolderBase();
|
||||
myFolder.ID = folderToMoveId;
|
||||
Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder).ParentID, Is.EqualTo(folder2Id));
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder).ParentID, Is.EqualTo(folder2Id));
|
||||
|
||||
Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
|
||||
}
|
||||
|
@ -322,13 +322,13 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
myFolder.ID = folder1Id;
|
||||
|
||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Not.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Not.Null);
|
||||
|
||||
// Test purge
|
||||
userInfo.PurgeFolder(rootFolder.ID);
|
||||
|
||||
Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -552,12 +552,12 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
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;
|
||||
}
|
||||
|
@ -575,5 +575,10 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
root.ParentID = UUID.Zero;
|
||||
return root;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,7 +354,16 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
|
||||
|
||||
public InventoryItemBase()
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryItemBase(UUID id)
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
|
|
|
@ -2156,16 +2156,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
protected void SendBulkUpdateInventoryFolder(InventoryFolderBase folderBase)
|
||||
{
|
||||
// XXX: Nasty temporary move that will be resolved shortly
|
||||
InventoryFolderImpl folder = (InventoryFolderImpl)folderBase;
|
||||
|
||||
// We will use the same transaction id for all the separate packets to be sent out in this update.
|
||||
UUID transactionId = UUID.Random();
|
||||
|
||||
List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks
|
||||
= new List<BulkUpdateInventoryPacket.FolderDataBlock>();
|
||||
|
||||
SendBulkUpdateInventoryFolderRecursive(folder, ref folderDataBlocks, transactionId);
|
||||
SendBulkUpdateInventoryFolderRecursive(folderBase, ref folderDataBlocks, transactionId);
|
||||
|
||||
if (folderDataBlocks.Count > 0)
|
||||
{
|
||||
|
@ -2191,17 +2188,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="folderDataBlocks"></param>
|
||||
/// <param name="transactionId"></param>
|
||||
private void SendBulkUpdateInventoryFolderRecursive(
|
||||
InventoryFolderImpl folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
|
||||
InventoryFolderBase folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
|
||||
UUID transactionId)
|
||||
{
|
||||
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
||||
|
||||
const int MAX_ITEMS_PER_PACKET = 5;
|
||||
|
||||
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
|
||||
// If there are any items then we have to start sending them off in this packet - the next folder will have
|
||||
// to be in its own bulk update packet. Also, we can only fit 5 items in a packet (at least this was the limit
|
||||
// being used on the Linden grid at 20081203).
|
||||
List<InventoryItemBase> items = folder.RequestListOfItems();
|
||||
InventoryCollection contents = invService.GetFolderContent(AgentId, folder.ID); // folder.RequestListOfItems();
|
||||
List<InventoryItemBase> items = contents.Items;
|
||||
while (items.Count > 0)
|
||||
{
|
||||
BulkUpdateInventoryPacket bulkUpdate
|
||||
|
@ -2233,8 +2232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
||||
}
|
||||
|
||||
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls();
|
||||
foreach (InventoryFolderImpl subFolder in subFolders)
|
||||
List<InventoryFolderBase> subFolders = contents.Folders;
|
||||
foreach (InventoryFolderBase subFolder in subFolders)
|
||||
{
|
||||
SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId);
|
||||
}
|
||||
|
@ -6609,20 +6608,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else // Agent
|
||||
{
|
||||
CachedUserInfo userInfo = ((Scene)m_scene).CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[CLIENT]: Could not resolve user {0} for caps inventory update",
|
||||
AgentId);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
break;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
|
||||
//InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
|
||||
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID));
|
||||
if (assetRequestItem == null)
|
||||
{
|
||||
assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
|
|
|
@ -192,40 +192,29 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
{
|
||||
if (XferUploaders.ContainsKey(transactionID))
|
||||
{
|
||||
CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
|
||||
remoteClient.AgentId);
|
||||
UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
|
||||
|
||||
if (userInfo != null)
|
||||
AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (asset == null)
|
||||
{
|
||||
UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
|
||||
|
||||
AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString());
|
||||
|
||||
if (asset == null)
|
||||
{
|
||||
asset = GetTransactionAsset(transactionID);
|
||||
}
|
||||
|
||||
if (asset != null && asset.FullID == assetID)
|
||||
{
|
||||
// Assets never get updated, new ones get created
|
||||
asset.FullID = UUID.Random();
|
||||
asset.Name = item.Name;
|
||||
asset.Description = item.Description;
|
||||
asset.Type = (sbyte)item.AssetType;
|
||||
item.AssetID = asset.FullID;
|
||||
|
||||
Manager.MyScene.AssetService.Store(asset);
|
||||
}
|
||||
|
||||
userInfo.UpdateItem(item);
|
||||
asset = GetTransactionAsset(transactionID);
|
||||
}
|
||||
else
|
||||
|
||||
if (asset != null && asset.FullID == assetID)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update",
|
||||
remoteClient.AgentId);
|
||||
// Assets never get updated, new ones get created
|
||||
asset.FullID = UUID.Random();
|
||||
asset.Name = item.Name;
|
||||
asset.Description = item.Description;
|
||||
asset.Type = (sbyte)item.AssetType;
|
||||
item.AssetID = asset.FullID;
|
||||
|
||||
Manager.MyScene.AssetService.Store(asset);
|
||||
}
|
||||
|
||||
IInventoryService invService = Manager.MyScene.InventoryService;
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ using log4net;
|
|||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
|
@ -214,39 +215,31 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
private void DoCreateItem(uint callbackID)
|
||||
{
|
||||
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
|
||||
CachedUserInfo userInfo =
|
||||
m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
|
||||
ourClient.AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = ourClient.AgentId;
|
||||
item.CreatorId = ourClient.AgentId.ToString();
|
||||
item.ID = UUID.Random();
|
||||
item.AssetID = m_asset.FullID;
|
||||
item.Description = m_description;
|
||||
item.Name = m_name;
|
||||
item.AssetType = type;
|
||||
item.InvType = invType;
|
||||
item.Folder = InventFolder;
|
||||
item.BasePermissions = 0x7fffffff;
|
||||
item.CurrentPermissions = 0x7fffffff;
|
||||
item.GroupPermissions=0;
|
||||
item.EveryOnePermissions=0;
|
||||
item.NextPermissions = nextPerm;
|
||||
item.Flags = (uint) wearableType;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
|
||||
|
||||
userInfo.AddItem(item);
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = ourClient.AgentId;
|
||||
item.CreatorId = ourClient.AgentId.ToString();
|
||||
item.ID = UUID.Random();
|
||||
item.AssetID = m_asset.FullID;
|
||||
item.Description = m_description;
|
||||
item.Name = m_name;
|
||||
item.AssetType = type;
|
||||
item.InvType = invType;
|
||||
item.Folder = InventFolder;
|
||||
item.BasePermissions = 0x7fffffff;
|
||||
item.CurrentPermissions = 0x7fffffff;
|
||||
item.GroupPermissions=0;
|
||||
item.EveryOnePermissions=0;
|
||||
item.NextPermissions = nextPerm;
|
||||
item.Flags = (uint) wearableType;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (invService.AddItem(item))
|
||||
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
|
||||
ourClient.AgentId);
|
||||
}
|
||||
ourClient.SendAlertMessage("Unable to create inventory item");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -37,6 +37,7 @@ using OpenSim.Framework.Communications.Cache;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.TextureDownload
|
||||
{
|
||||
|
@ -217,11 +218,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
|
|||
if (profile == null) // Deny unknown user
|
||||
return;
|
||||
|
||||
if (profile.RootFolder == null) // Deny no inventory
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory
|
||||
return;
|
||||
|
||||
if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
|
||||
return;
|
||||
// Diva 2009-08-13: this test doesn't make any sense to many devs
|
||||
//if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
|
||||
//{
|
||||
// m_log.WarnFormat("[TEXTURE]: user {0} doesn't have permissions to texture {1}");
|
||||
// return;
|
||||
//}
|
||||
|
||||
m_log.Debug("Texture preview");
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
{
|
||||
|
@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
|
||||
|
||||
public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance)
|
||||
public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
|
||||
{
|
||||
if (profile.RootFolder != null)
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
|
||||
if (invService.GetRootFolder(userID) != null)
|
||||
{
|
||||
for (int i = 0; i < 13; i++)
|
||||
{
|
||||
|
@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
else
|
||||
{
|
||||
InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID);
|
||||
InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID));
|
||||
|
||||
if (baseItem != null)
|
||||
{
|
||||
|
@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work");
|
||||
m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
|
||||
|
||||
AvatarAppearance avatAppearance = null;
|
||||
if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
|
||||
{
|
||||
|
@ -174,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
//m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name);
|
||||
|
||||
if (profile != null)
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
if (profile.RootFolder != null)
|
||||
if (wear.Type < 13)
|
||||
{
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
if (wear.Type < 13)
|
||||
{
|
||||
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
||||
}
|
||||
}
|
||||
|
||||
SetAppearanceAssets(profile, ref avatAppearance);
|
||||
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
||||
}
|
||||
}
|
||||
|
||||
SetAppearanceAssets(avatar.UUID, ref avatAppearance);
|
||||
|
||||
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
|
||||
avatar.Appearance = avatAppearance;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables",
|
||||
clientView.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name);
|
||||
}
|
||||
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
|
||||
avatar.Appearance = avatAppearance;
|
||||
}
|
||||
|
||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
||||
|
|
|
@ -39,6 +39,7 @@ using OpenSim.Framework.Communications;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
{
|
||||
|
@ -654,8 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID });
|
||||
|
||||
// find the folder for the friend...
|
||||
InventoryFolderImpl folder =
|
||||
initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard);
|
||||
//InventoryFolderImpl folder =
|
||||
// initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard);
|
||||
IInventoryService invService = initiator.Scene.InventoryService;
|
||||
InventoryFolderBase folder = invService.GetFolderForType(toAgentID, AssetType.CallingCard);
|
||||
if (folder != null)
|
||||
{
|
||||
// ... and add the calling card
|
||||
|
|
|
@ -33,6 +33,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
||||
{
|
||||
|
@ -62,42 +63,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
|||
|
||||
public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId)
|
||||
{
|
||||
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
|
||||
if (userInfo != null)
|
||||
InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId));
|
||||
if (item != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
|
||||
if (item != null)
|
||||
{
|
||||
item.Flags = 1;
|
||||
userInfo.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[GESTURES]: Unable to find gesture to activate {0} for {1}", gestureId, client.Name);
|
||||
item.Flags = 1;
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name);
|
||||
m_log.WarnFormat(
|
||||
"[GESTURES]: Unable to find gesture {0} to activate for {1}", gestureId, client.Name);
|
||||
}
|
||||
|
||||
public virtual void DeactivateGesture(IClientAPI client, UUID gestureId)
|
||||
{
|
||||
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
|
||||
if (userInfo != null)
|
||||
InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId));
|
||||
if (item != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
|
||||
if (item != null)
|
||||
{
|
||||
item.Flags = 0;
|
||||
userInfo.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
|
||||
item.Flags = 0;
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name);
|
||||
m_log.ErrorFormat(
|
||||
"[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
{
|
||||
|
@ -154,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
"into agent {1}'s inventory",
|
||||
folderID, new UUID(im.toAgentID));
|
||||
|
||||
InventoryFolderImpl folderCopy
|
||||
InventoryFolderBase folderCopy
|
||||
= scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero);
|
||||
|
||||
if (folderCopy == null)
|
||||
|
@ -247,53 +248,52 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
// It will have been pushed to the client, too
|
||||
//
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.
|
||||
GetUserDetails(client.AgentId);
|
||||
//CachedUserInfo userInfo =
|
||||
// scene.CommsManager.UserProfileCacheService.
|
||||
// GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
if (userInfo != null)
|
||||
InventoryFolderBase trashFolder =
|
||||
invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
|
||||
|
||||
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||
|
||||
InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID));
|
||||
InventoryFolderBase folder = null;
|
||||
|
||||
if (item != null && trashFolder != null)
|
||||
{
|
||||
InventoryFolderImpl trashFolder =
|
||||
userInfo.FindFolderForType((int)AssetType.TrashFolder);
|
||||
|
||||
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(inventoryEntityID);
|
||||
InventoryFolderBase folder = null;
|
||||
|
||||
if (item != null && trashFolder != null)
|
||||
{
|
||||
item.Folder = trashFolder.ID;
|
||||
item.Folder = trashFolder.ID;
|
||||
|
||||
userInfo.DeleteItem(inventoryEntityID);
|
||||
|
||||
scene.AddInventoryItem(client, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
folder = userInfo.RootFolder.FindFolder(inventoryEntityID);
|
||||
|
||||
if (folder != null & trashFolder != null)
|
||||
{
|
||||
userInfo.MoveFolder(inventoryEntityID, trashFolder.ID);
|
||||
}
|
||||
}
|
||||
// Diva comment: can't we just update this item???
|
||||
invService.DeleteItem(item);
|
||||
scene.AddInventoryItem(client, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID));
|
||||
|
||||
if ((null == item && null == folder) | null == trashFolder)
|
||||
{
|
||||
string reason = String.Empty;
|
||||
|
||||
if (trashFolder == null)
|
||||
reason += " Trash folder not found.";
|
||||
if (item == null)
|
||||
reason += " Item not found.";
|
||||
if (folder == null)
|
||||
reason += " Folder not found.";
|
||||
|
||||
client.SendAgentAlertMessage("Unable to delete "+
|
||||
"received inventory" + reason, false);
|
||||
if (folder != null & trashFolder != null)
|
||||
{
|
||||
folder.ParentID = trashFolder.ID;
|
||||
invService.MoveFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
if ((null == item && null == folder) | null == trashFolder)
|
||||
{
|
||||
string reason = String.Empty;
|
||||
|
||||
if (trashFolder == null)
|
||||
reason += " Trash folder not found.";
|
||||
if (item == null)
|
||||
reason += " Item not found.";
|
||||
if (folder == null)
|
||||
reason += " Folder not found.";
|
||||
|
||||
client.SendAgentAlertMessage("Unable to delete "+
|
||||
"received inventory" + reason, false);
|
||||
}
|
||||
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||
|
||||
|
@ -405,17 +405,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.
|
||||
GetUserDetails(user.ControllingClient.AgentId);
|
||||
//CachedUserInfo userInfo =
|
||||
// scene.CommsManager.UserProfileCacheService.
|
||||
// GetUserDetails(user.ControllingClient.AgentId);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
|
||||
return;
|
||||
}
|
||||
//if (userInfo == null)
|
||||
//{
|
||||
// m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
|
||||
// return;
|
||||
//}
|
||||
|
||||
AssetType assetType = (AssetType)msg.binaryBucket[0];
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
if (AssetType.Folder == assetType)
|
||||
{
|
||||
|
@ -425,31 +426,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
folder.ID = folderID;
|
||||
folder.Owner = user.ControllingClient.AgentId;
|
||||
|
||||
// Fetch from database
|
||||
// Fetch from service
|
||||
//
|
||||
if (!userInfo.QueryFolder(folder))
|
||||
folder = invService.GetFolder(folder);
|
||||
if (folder == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get folder info
|
||||
//
|
||||
InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID);
|
||||
if (folderInfo == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give");
|
||||
return;
|
||||
}
|
||||
user.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
|
||||
user.ControllingClient.SendBulkUpdateInventory(folderInfo);
|
||||
|
||||
// This unelegant, slow kludge is to reload the folders and
|
||||
// items. Since a folder give can transfer subfolders and
|
||||
// items, this is the easiest way to pull that stuff in
|
||||
//
|
||||
userInfo.DropInventory();
|
||||
userInfo.FetchInventory();
|
||||
//// This unelegant, slow kludge is to reload the folders and
|
||||
//// items. Since a folder give can transfer subfolders and
|
||||
//// items, this is the easiest way to pull that stuff in
|
||||
////
|
||||
//userInfo.DropInventory();
|
||||
//userInfo.FetchInventory();
|
||||
|
||||
// Deliver message
|
||||
//
|
||||
|
@ -463,20 +456,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
item.ID = itemID;
|
||||
item.Owner = user.ControllingClient.AgentId;
|
||||
|
||||
// Fetch from database
|
||||
// Fetch from service
|
||||
//
|
||||
if (!userInfo.QueryItem(item))
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get item info
|
||||
//
|
||||
item = userInfo.RootFolder.FindItem(item.ID);
|
||||
item = invService.GetItem(item);
|
||||
if (item == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give");
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns>null if no root folder was found</returns>
|
||||
public abstract InventoryFolderBase GetRootFolder(UUID userID);
|
||||
public InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
// Root folder is here as system type Folder.
|
||||
return m_cache.GetFolderForType(userID, AssetType.Folder);
|
||||
}
|
||||
|
||||
public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
|
||||
|
||||
|
@ -184,9 +188,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// <returns>true if the item was successfully deleted</returns>
|
||||
public abstract bool DeleteItem(InventoryItemBase item);
|
||||
|
||||
public abstract InventoryItemBase QueryItem(InventoryItemBase item);
|
||||
public abstract InventoryItemBase GetItem(InventoryItemBase item);
|
||||
|
||||
public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder);
|
||||
public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
|
||||
|
||||
/// <summary>
|
||||
/// Does the given user have an inventory structure?
|
||||
|
@ -202,5 +206,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// <returns></returns>
|
||||
public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||
|
||||
public abstract int GetAssetPermissions(UUID userID, UUID assetID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
||||
{
|
||||
if (IsLocalGridUser(userID))
|
||||
return GetSystemFoldersLocal(userID);
|
||||
{
|
||||
// This is not pretty, but it will have to do for now
|
||||
if (m_GridService is BaseInventoryConnector)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module");
|
||||
return ((BaseInventoryConnector)m_GridService).GetSystemFolders(userID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal");
|
||||
return GetSystemFoldersLocal(userID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(userID);
|
||||
|
@ -263,6 +275,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
folders[(AssetType)folder.Type] = folder;
|
||||
}
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count);
|
||||
// Put the root folder there, as type Folder
|
||||
folders[AssetType.Folder] = root;
|
||||
return folders;
|
||||
}
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
|
||||
|
@ -387,13 +401,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
}
|
||||
|
||||
public override InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
|
||||
if (IsLocalGridUser(item.Owner))
|
||||
return m_GridService.QueryItem(item);
|
||||
return m_GridService.GetItem(item);
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(item.Owner);
|
||||
|
@ -402,13 +416,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
}
|
||||
|
||||
public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (folder == null)
|
||||
return null;
|
||||
|
||||
if (IsLocalGridUser(folder.Owner))
|
||||
return m_GridService.QueryFolder(folder);
|
||||
return m_GridService.GetFolder(folder);
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(folder.Owner);
|
||||
|
@ -422,39 +436,56 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return false;
|
||||
}
|
||||
|
||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
if (IsLocalGridUser(userID))
|
||||
return m_GridService.GetAssetPermissions(userID, assetID);
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(userID);
|
||||
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
||||
return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UUID GetSessionID(UUID userID)
|
||||
{
|
||||
ScenePresence sp = m_Scene.GetScenePresence(userID);
|
||||
if (sp != null)
|
||||
return sp.ControllingClient.SessionId;
|
||||
CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
return uinfo.SessionID;
|
||||
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID);
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
private bool IsLocalGridUser(UUID userID)
|
||||
{
|
||||
if (m_UserProfileService == null)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false.");
|
||||
return false;
|
||||
}
|
||||
|
||||
CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
|
||||
if (uinfo == null)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID);
|
||||
return true;
|
||||
}
|
||||
|
||||
string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
string uri = m_LocalGridInventoryURI.TrimEnd('/');
|
||||
|
||||
if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == ""))
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri);
|
||||
|
||||
if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
|
||||
m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
|
||||
presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
|
||||
|
||||
if (folders.Count > 0)
|
||||
lock (m_InventoryCache)
|
||||
m_InventoryCache.Add(presence.UUID, folders);
|
||||
|
|
|
@ -201,8 +201,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
foreach (InventoryFolderBase folder in content.Folders)
|
||||
{
|
||||
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
||||
{
|
||||
m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type);
|
||||
folders[(AssetType)folder.Type] = folder;
|
||||
}
|
||||
}
|
||||
// Put the root folder there, as type Folder
|
||||
folders[AssetType.Folder] = root;
|
||||
m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type);
|
||||
|
||||
return folders;
|
||||
}
|
||||
}
|
||||
|
@ -292,14 +299,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_InventoryService.DeleteItem(item);
|
||||
}
|
||||
|
||||
public override InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
return m_InventoryService.QueryItem(item);
|
||||
return m_InventoryService.GetItem(item);
|
||||
}
|
||||
|
||||
public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return m_InventoryService.QueryFolder(folder);
|
||||
return m_InventoryService.GetFolder(folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -312,20 +319,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_InventoryService.HasInventoryForUser(userID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the root inventory folder for the given user.
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns>null if no root folder was found</returns>
|
||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return m_InventoryService.GetRootFolder(userID);
|
||||
}
|
||||
|
||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return m_InventoryService.GetActiveGestures(userId);
|
||||
}
|
||||
|
||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return m_InventoryService.GetAssetPermissions(userID, assetID);
|
||||
}
|
||||
#endregion IInventoryService
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Services.Connectors;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -48,6 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
private bool m_Enabled = false;
|
||||
private bool m_Initialized = false;
|
||||
private Scene m_Scene;
|
||||
private UserProfileCacheService m_UserProfileService;
|
||||
private InventoryServicesConnector m_RemoteConnector;
|
||||
|
||||
public Type ReplaceableInterface
|
||||
|
@ -104,12 +106,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_Scene = scene;
|
||||
// ugh!
|
||||
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
|
||||
scene.CommsManager.UserService.SetInventoryService(this);
|
||||
|
@ -130,6 +134,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
|
||||
if (m_UserProfileService != null)
|
||||
m_log.Debug("[XXXX] Set m_UserProfileService in " + m_Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
|
@ -273,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID);
|
||||
}
|
||||
|
||||
public override InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
|
@ -282,7 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
|
||||
}
|
||||
|
||||
public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (folder == null)
|
||||
return null;
|
||||
|
@ -296,25 +304,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return false;
|
||||
}
|
||||
|
||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
UUID sessionID = GetSessionID(userID);
|
||||
return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private UUID GetSessionID(UUID userID)
|
||||
{
|
||||
ScenePresence sp = m_Scene.GetScenePresence(userID);
|
||||
if (sp != null)
|
||||
return sp.ControllingClient.SessionId;
|
||||
if (m_Scene == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
|
||||
}
|
||||
|
||||
if (m_UserProfileService == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
return uinfo.SessionID;
|
||||
m_log.DebugFormat("[INVENTORY CONNECTOR]: user profile for {0} not found", userID);
|
||||
return UUID.Zero;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
// Temporary fix of wrong GroupPowers constants in OpenMetaverse library
|
||||
enum GroupPowers : long
|
||||
|
@ -964,19 +965,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
if (objectID == UUID.Zero) // User inventory
|
||||
{
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for edit notecard check", user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
return false;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard));
|
||||
if (assetRequestItem == null) // Library item
|
||||
{
|
||||
assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
|
||||
|
@ -1394,19 +1384,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
if (objectID == UUID.Zero) // User inventory
|
||||
{
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for administrator check", user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
return false;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(script);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script));
|
||||
if (assetRequestItem == null) // Library item
|
||||
{
|
||||
assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script);
|
||||
|
@ -1499,19 +1478,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
if (objectID == UUID.Zero) // User inventory
|
||||
{
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for view notecard check", user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
return false;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard));
|
||||
if (assetRequestItem == null) // Library item
|
||||
{
|
||||
assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
|
||||
|
|
|
@ -201,31 +201,31 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
}
|
||||
}
|
||||
|
||||
public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||
{
|
||||
InventoryClient invCli = null;
|
||||
string inventoryURL = UserInventoryURL(item.Owner);
|
||||
if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
|
||||
{
|
||||
m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
|
||||
invCli = new InventoryClient(inventoryURL);
|
||||
m_inventoryServers.Add(inventoryURL, invCli);
|
||||
}
|
||||
//public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||
//{
|
||||
// InventoryClient invCli = null;
|
||||
// string inventoryURL = UserInventoryURL(item.Owner);
|
||||
// if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
|
||||
// {
|
||||
// m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
|
||||
// invCli = new InventoryClient(inventoryURL);
|
||||
// m_inventoryServers.Add(inventoryURL, invCli);
|
||||
// }
|
||||
|
||||
item = invCli.GetInventoryItem(item);
|
||||
if (item != null)
|
||||
{
|
||||
// Change the folder, stick it in root folder, all items flattened out here in this region cache
|
||||
item.Folder = rootFolder;
|
||||
//userInfo.AddItem(item); don't use this, it calls back to the inventory server
|
||||
lock (userInfo.RootFolder.Items)
|
||||
{
|
||||
userInfo.RootFolder.Items[item.ID] = item;
|
||||
}
|
||||
// item = invCli.GetInventoryItem(item);
|
||||
// if (item != null)
|
||||
// {
|
||||
// // Change the folder, stick it in root folder, all items flattened out here in this region cache
|
||||
// item.Folder = rootFolder;
|
||||
// //userInfo.AddItem(item); don't use this, it calls back to the inventory server
|
||||
// lock (userInfo.RootFolder.Items)
|
||||
// {
|
||||
// userInfo.RootFolder.Items[item.ID] = item;
|
||||
// }
|
||||
|
||||
}
|
||||
return item;
|
||||
}
|
||||
// }
|
||||
// return item;
|
||||
//}
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID)
|
||||
{
|
||||
|
|
|
@ -117,25 +117,20 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
|
||||
if (fromTaskID.Equals(UUID.Zero))
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
InventoryItemBase item = new InventoryItemBase(itemID);
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item = InventoryService.GetItem(item);
|
||||
//if (item == null)
|
||||
//{ // Fetch the item
|
||||
// item = new InventoryItemBase();
|
||||
// item.Owner = remoteClient.AgentId;
|
||||
// item.ID = itemID;
|
||||
// item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
|
||||
//}
|
||||
if (item != null)
|
||||
{
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
if (item == null)
|
||||
{ // Fetch the item
|
||||
item = new InventoryItemBase();
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.ID = itemID;
|
||||
item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
m_assMapper.Get(item.AssetID, remoteClient.AgentId);
|
||||
m_assMapper.Get(item.AssetID, remoteClient.AgentId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -382,31 +382,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (userProfile.HasReceivedInventory)
|
||||
{
|
||||
InventoryItemBase item = null;
|
||||
if (userProfile.RootFolder == null)
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: User {0} {1} does not have a root folder.",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
else
|
||||
item = userProfile.RootFolder.FindItem(itemID);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||
}
|
||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||
}
|
||||
// else shouldn't we send an alert message?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -435,23 +417,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems);
|
||||
SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle the caps inventory descendents fetch.
|
||||
///
|
||||
/// Since the folder structure is sent to the client on login, I believe we only need to handle items.
|
||||
/// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="folderID"></param>
|
||||
|
@ -477,59 +450,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
return fold.RequestListOfItems();
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID);
|
||||
return null;
|
||||
}
|
||||
|
||||
// XXX: When a client crosses into a scene, their entire inventory is fetched
|
||||
// asynchronously. If the client makes a request before the inventory is received, we need
|
||||
// to give the inventory a chance to come in.
|
||||
//
|
||||
// This is a crude way of dealing with that by retrying the lookup. It's not quite as bad
|
||||
// in CAPS as doing this with the udp request, since here it won't hold up other packets.
|
||||
// In fact, here we'll be generous and try for longer.
|
||||
if (!userProfile.HasReceivedInventory)
|
||||
{
|
||||
int attempts = 0;
|
||||
while (attempts++ < 30)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}",
|
||||
attempts, folderID, agentID);
|
||||
InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID);
|
||||
return contents.Items;
|
||||
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (userProfile.HasReceivedInventory)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (userProfile.HasReceivedInventory)
|
||||
{
|
||||
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
|
||||
{
|
||||
return fold.RequestListOfItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Could not find folder {0} requested by user {1}",
|
||||
folderID, agentID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -543,19 +467,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType,
|
||||
string folderName, UUID parentID)
|
||||
{
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1);
|
||||
if (!InventoryService.AddFolder(folder))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
|
@ -598,36 +513,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle an inventory folder move request from the client.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="parentID"></param>
|
||||
public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
|
||||
{
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userProfile.MoveFolder(folderID, parentID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
|
||||
folderID, parentID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID);
|
||||
folder = InventoryService.QueryFolder(folder);
|
||||
folder = InventoryService.GetFolder(folder);
|
||||
if (folder != null)
|
||||
{
|
||||
folder.ParentID = parentID;
|
||||
|
@ -647,27 +536,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
|
||||
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
|
||||
{
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userProfile.PurgeFolder(folderID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID);
|
||||
|
||||
|
|
|
@ -1962,7 +1962,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat("[ATTACHMENT]: Received " +
|
||||
"attachment {0}, inworld asset id {1}",
|
||||
//grp.RootPart.LastOwnerID.ToString(),
|
||||
grp.GetFromAssetID(),
|
||||
grp.GetFromItemID(),
|
||||
grp.UUID.ToString());
|
||||
|
||||
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
||||
|
@ -3672,59 +3672,53 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
case 2: // Sell a copy
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
uint perms=group.GetEffectivePermissions();
|
||||
|
||||
if (userInfo != null)
|
||||
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
||||
{
|
||||
uint perms=group.GetEffectivePermissions();
|
||||
|
||||
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
||||
{
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
|
||||
return false;
|
||||
}
|
||||
|
||||
AssetBase asset = CreateAsset(
|
||||
group.GetPartName(localID),
|
||||
group.GetPartDescription(localID),
|
||||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml));
|
||||
AssetService.Store(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.CreatorId = part.CreatorID.ToString();
|
||||
|
||||
item.ID = UUID.Random();
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = categoryID;
|
||||
|
||||
uint nextPerms=(perms & 7) << 13;
|
||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
item.BasePermissions = perms & part.NextOwnerMask;
|
||||
item.CurrentPermissions = perms & part.NextOwnerMask;
|
||||
item.NextPermissions = part.NextOwnerMask;
|
||||
item.EveryOnePermissions = part.EveryoneMask &
|
||||
part.NextOwnerMask;
|
||||
item.GroupPermissions = part.GroupMask &
|
||||
part.NextOwnerMask;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
userInfo.AddItem(item);
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale");
|
||||
return false;
|
||||
}
|
||||
|
||||
AssetBase asset = CreateAsset(
|
||||
group.GetPartName(localID),
|
||||
group.GetPartDescription(localID),
|
||||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml));
|
||||
AssetService.Store(asset);
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.CreatorId = part.CreatorID.ToString();
|
||||
|
||||
item.ID = UUID.Random();
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = categoryID;
|
||||
|
||||
uint nextPerms=(perms & 7) << 13;
|
||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
|
||||
item.BasePermissions = perms & part.NextOwnerMask;
|
||||
item.CurrentPermissions = perms & part.NextOwnerMask;
|
||||
item.NextPermissions = part.NextOwnerMask;
|
||||
item.EveryOnePermissions = part.EveryoneMask &
|
||||
part.NextOwnerMask;
|
||||
item.GroupPermissions = part.GroupMask &
|
||||
part.NextOwnerMask;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (InventoryService.AddItem(item))
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
else
|
||||
{
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
|
||||
|
@ -3739,8 +3733,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
foreach (UUID invID in invList)
|
||||
{
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(invID);
|
||||
if ((item.CurrentPermissions &
|
||||
TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID);
|
||||
if ((item1.CurrentPermissions &
|
||||
(uint)PermissionMask.Transfer) == 0)
|
||||
{
|
||||
okToSell = false;
|
||||
|
|
|
@ -1086,11 +1086,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public bool WaitForCallback(UUID id)
|
||||
{
|
||||
int count = 20;
|
||||
int count = 200;
|
||||
while (m_agentsInTransit.Contains(id) && count-- > 0)
|
||||
{
|
||||
//m_log.Debug(" >>> Waiting... " + count);
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
|
@ -1207,16 +1207,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
pos = pos + (agent.Velocity);
|
||||
|
||||
CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
if (userInfo != null)
|
||||
{
|
||||
userInfo.DropInventory();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}",
|
||||
agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
//CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
//if (userInfo != null)
|
||||
//{
|
||||
// userInfo.DropInventory();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}",
|
||||
// agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName);
|
||||
//}
|
||||
|
||||
//bool crossingSuccessful =
|
||||
// CrossToNeighbouringRegion(neighbourHandle, agent.ControllingClient.AgentId, pos,
|
||||
|
@ -1315,11 +1315,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else // Not successful
|
||||
{
|
||||
CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
if (userInfo != null)
|
||||
{
|
||||
userInfo.FetchInventory();
|
||||
}
|
||||
//CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
//if (userInfo != null)
|
||||
//{
|
||||
// userInfo.FetchInventory();
|
||||
//}
|
||||
agent.RestoreInCurrentScene();
|
||||
}
|
||||
// In any case
|
||||
|
|
|
@ -442,7 +442,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (group != null)
|
||||
{
|
||||
//group.DetachToGround();
|
||||
m_parentScene.DetachSingleAttachmentToInv(group.GetFromAssetID(), remoteClient);
|
||||
m_parentScene.DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Calls attach with a Zero position
|
||||
//
|
||||
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromAssetID(), remoteClient.AgentId);
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
}
|
||||
|
||||
public SceneObjectGroup RezSingleAttachment(
|
||||
|
@ -536,14 +536,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (entity is SceneObjectGroup)
|
||||
{
|
||||
group = (SceneObjectGroup)entity;
|
||||
if (group.GetFromAssetID() == itemID)
|
||||
if (group.GetFromItemID() == itemID)
|
||||
{
|
||||
m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero);
|
||||
group.DetachToInventoryPrep();
|
||||
m_log.Debug("[DETACH]: Saving attachpoint: " +
|
||||
((uint)group.GetAttachmentPoint()).ToString());
|
||||
m_parentScene.updateKnownAsset(remoteClient, group,
|
||||
group.GetFromAssetID(), group.OwnerID);
|
||||
m_parentScene.UpdateKnownItem(remoteClient, group,
|
||||
group.GetFromItemID(), group.OwnerID);
|
||||
m_parentScene.DeleteSceneObject(group, false);
|
||||
return;
|
||||
}
|
||||
|
@ -588,13 +588,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Saves and gets assetID
|
||||
UUID itemId;
|
||||
|
||||
if (group.GetFromAssetID() == UUID.Zero)
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = group.GetFromAssetID();
|
||||
itemId = group.GetFromItemID();
|
||||
}
|
||||
|
||||
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
|
||||
|
@ -1307,7 +1307,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
group.UpdateGroupPosition(pos);
|
||||
group.RootPart.IsAttachment = false;
|
||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID);
|
||||
m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
|
||||
group.SetAttachmentPoint(attachmentPoint);
|
||||
|
||||
}
|
||||
|
|
|
@ -447,22 +447,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void SetFromAssetID(UUID AssetId)
|
||||
public void SetFromItemID(UUID AssetId)
|
||||
{
|
||||
lock (m_parts)
|
||||
{
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
part.FromAssetID = AssetId;
|
||||
part.FromItemID = AssetId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UUID GetFromAssetID()
|
||||
public UUID GetFromItemID()
|
||||
{
|
||||
if (m_rootPart != null)
|
||||
{
|
||||
return m_rootPart.FromAssetID;
|
||||
return m_rootPart.FromItemID;
|
||||
}
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
@ -3374,19 +3374,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public virtual string ExtraToXmlString()
|
||||
{
|
||||
return "<ExtraFromAssetID>" + GetFromAssetID().ToString() + "</ExtraFromAssetID>";
|
||||
return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>";
|
||||
}
|
||||
|
||||
public virtual void ExtraFromXmlString(string xmlstr)
|
||||
{
|
||||
string id = xmlstr.Substring(xmlstr.IndexOf("<ExtraFromAssetID>"));
|
||||
id = xmlstr.Replace("<ExtraFromAssetID>", "");
|
||||
id = id.Replace("</ExtraFromAssetID>", "");
|
||||
string id = xmlstr.Substring(xmlstr.IndexOf("<ExtraFromItemID>"));
|
||||
id = xmlstr.Replace("<ExtraFromItemID>", "");
|
||||
id = id.Replace("</ExtraFromItemID>", "");
|
||||
|
||||
UUID uuid = UUID.Zero;
|
||||
UUID.TryParse(id, out uuid);
|
||||
|
||||
SetFromAssetID(uuid);
|
||||
SetFromItemID(uuid);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public uint TimeStampTerse = 0;
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID FromAssetID = UUID.Zero;
|
||||
public UUID FromItemID = UUID.Zero;
|
||||
|
||||
/// <value>
|
||||
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
||||
|
@ -2389,7 +2389,7 @@ if (m_shape != null) {
|
|||
remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape,
|
||||
lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID,
|
||||
m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment,
|
||||
AttachmentPoint,FromAssetID, Sound, SoundGain, SoundFlags, SoundRadius);
|
||||
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3767,7 +3767,7 @@ if (m_shape != null) {
|
|||
(ushort)(m_parentGroup.GetTimeDilation() *
|
||||
(float)ushort.MaxValue), LocalId, lPos,
|
||||
RotationOffset, Velocity,
|
||||
RotationalVelocity, state, FromAssetID,
|
||||
RotationalVelocity, state, FromItemID,
|
||||
OwnerID, (int)AttachmentPoint);
|
||||
}
|
||||
|
||||
|
|
|
@ -833,11 +833,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_scene.SwapRootAgentCount(false);
|
||||
|
||||
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||
if (userInfo != null)
|
||||
userInfo.FetchInventory();
|
||||
else
|
||||
m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
//CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||
//if (userInfo != null)
|
||||
// userInfo.FetchInventory();
|
||||
//else
|
||||
// m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
|
||||
// On the next prim update, all objects will be sent
|
||||
//
|
||||
|
|
|
@ -2801,7 +2801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
||||
{
|
||||
SceneObjectGroup grp = m_host.ParentGroup;
|
||||
UUID itemID = grp.GetFromAssetID();
|
||||
UUID itemID = grp.GetFromItemID();
|
||||
|
||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||
|
||||
|
|
|
@ -110,11 +110,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
||||
"POST", "/QueryItem/", m_InventoryService.QueryItem, CheckAuthSession));
|
||||
"POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
|
||||
"POST", "/QueryFolder/", m_InventoryService.QueryFolder, CheckAuthSession));
|
||||
"POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, bool>(
|
||||
|
@ -153,6 +153,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
||||
("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<InventoryItemBase, int>
|
||||
("POST", "/AssetPermissions/", GetAssetPermissions, CheckTrustSource));
|
||||
|
||||
}
|
||||
|
||||
#region Wrappers for converting the Guid parameter
|
||||
|
@ -185,6 +190,8 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
||||
folders[(AssetType)folder.Type] = folder;
|
||||
}
|
||||
// Put the root folder there, as type Folder
|
||||
folders[AssetType.Folder] = root;
|
||||
return folders;
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +242,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
return m_InventoryService.GetInventorySkeleton(userID);
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(InventoryItemBase item)
|
||||
{
|
||||
return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.Inventory
|
|||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,21 +163,21 @@ namespace OpenSim.Services.Connectors
|
|||
/// <returns></returns>
|
||||
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
|
||||
{
|
||||
// !!! Not just yet.
|
||||
//try
|
||||
//{
|
||||
// List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||
// "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
// Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
|
||||
// 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<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
|
||||
Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
|
||||
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<AssetType, InventoryFolderBase>();
|
||||
}
|
||||
|
@ -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<InventoryItemBase, int>.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
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -176,5 +176,10 @@ namespace OpenSim.Services.Connectors
|
|||
return null;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,9 +149,19 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <returns>true if the item was successfully deleted</returns>
|
||||
bool DeleteItem(InventoryItemBase item);
|
||||
|
||||
InventoryItemBase QueryItem(InventoryItemBase item);
|
||||
/// <summary>
|
||||
/// Get an item, given by its UUID
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
InventoryItemBase GetItem(InventoryItemBase item);
|
||||
|
||||
InventoryFolderBase QueryFolder(InventoryFolderBase folder);
|
||||
/// <summary>
|
||||
/// Get a folder, given by its UUID
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
InventoryFolderBase GetFolder(InventoryFolderBase folder);
|
||||
|
||||
/// <summary>
|
||||
/// Does the given user have an inventory structure?
|
||||
|
@ -166,5 +176,15 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||
|
||||
/// <summary>
|
||||
/// Get the union of permissions of all inventory items
|
||||
/// that hold the given assetID.
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <param name="assetID"></param>
|
||||
/// <returns>The permissions or 0 if no such asset is found in
|
||||
/// the user's inventory</returns>
|
||||
int GetAssetPermissions(UUID userID, UUID assetID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,7 +398,7 @@ namespace OpenSim.Services.InventoryService
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public virtual InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
InventoryItemBase result = m_Database.queryInventoryItem(item.ID);
|
||||
if (result != null)
|
||||
|
@ -407,7 +407,7 @@ namespace OpenSim.Services.InventoryService
|
|||
return null;
|
||||
}
|
||||
|
||||
public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
|
||||
public virtual InventoryFolderBase GetFolder(InventoryFolderBase item)
|
||||
{
|
||||
InventoryFolderBase result = m_Database.queryInventoryFolder(item.ID);
|
||||
if (result != null)
|
||||
|
@ -465,6 +465,29 @@ namespace OpenSim.Services.InventoryService
|
|||
return null;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
InventoryFolderBase parent = GetRootFolder(userID);
|
||||
return FindAssetPerms(parent, assetID);
|
||||
}
|
||||
|
||||
private int FindAssetPerms(InventoryFolderBase folder, UUID assetID)
|
||||
{
|
||||
InventoryCollection contents = GetFolderContent(folder.Owner, folder.ID);
|
||||
|
||||
int perms = 0;
|
||||
foreach (InventoryItemBase item in contents.Items)
|
||||
{
|
||||
if (item.AssetID == assetID)
|
||||
perms = (int)item.CurrentPermissions | perms;
|
||||
}
|
||||
|
||||
foreach (InventoryFolderBase subfolder in contents.Folders)
|
||||
perms = perms | FindAssetPerms(subfolder, assetID);
|
||||
|
||||
return perms;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to create a new user inventory.
|
||||
/// </summary>
|
||||
|
|
|
@ -148,12 +148,12 @@ namespace OpenSim.Tests.Common.Mock
|
|||
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;
|
||||
}
|
||||
|
@ -171,5 +171,10 @@ namespace OpenSim.Tests.Common.Mock
|
|||
root.ParentID = UUID.Zero;
|
||||
return root;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue