Added GetAssetPermissions. Few last bugs nixed. This is ready for testing.
parent
5246dc33dc
commit
034c9cf606
|
@ -575,5 +575,10 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
root.ParentID = UUID.Zero;
|
root.ParentID = UUID.Zero;
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2156,16 +2156,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
protected void SendBulkUpdateInventoryFolder(InventoryFolderBase folderBase)
|
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.
|
// We will use the same transaction id for all the separate packets to be sent out in this update.
|
||||||
UUID transactionId = UUID.Random();
|
UUID transactionId = UUID.Random();
|
||||||
|
|
||||||
List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks
|
List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks
|
||||||
= new List<BulkUpdateInventoryPacket.FolderDataBlock>();
|
= new List<BulkUpdateInventoryPacket.FolderDataBlock>();
|
||||||
|
|
||||||
SendBulkUpdateInventoryFolderRecursive(folder, ref folderDataBlocks, transactionId);
|
SendBulkUpdateInventoryFolderRecursive(folderBase, ref folderDataBlocks, transactionId);
|
||||||
|
|
||||||
if (folderDataBlocks.Count > 0)
|
if (folderDataBlocks.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -2191,17 +2188,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name="folderDataBlocks"></param>
|
/// <param name="folderDataBlocks"></param>
|
||||||
/// <param name="transactionId"></param>
|
/// <param name="transactionId"></param>
|
||||||
private void SendBulkUpdateInventoryFolderRecursive(
|
private void SendBulkUpdateInventoryFolderRecursive(
|
||||||
InventoryFolderImpl folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
|
InventoryFolderBase folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
|
||||||
UUID transactionId)
|
UUID transactionId)
|
||||||
{
|
{
|
||||||
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
||||||
|
|
||||||
const int MAX_ITEMS_PER_PACKET = 5;
|
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
|
// 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
|
// 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).
|
// 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)
|
while (items.Count > 0)
|
||||||
{
|
{
|
||||||
BulkUpdateInventoryPacket bulkUpdate
|
BulkUpdateInventoryPacket bulkUpdate
|
||||||
|
@ -2233,8 +2232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls();
|
List<InventoryFolderBase> subFolders = contents.Folders;
|
||||||
foreach (InventoryFolderImpl subFolder in subFolders)
|
foreach (InventoryFolderBase subFolder in subFolders)
|
||||||
{
|
{
|
||||||
SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId);
|
SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,8 +222,12 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
|
||||||
if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory
|
if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
|
// Diva 2009-08-13: this test doesn't make any sense to many devs
|
||||||
return;
|
//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");
|
m_log.Debug("Texture preview");
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
/// <returns>null if no root folder was found</returns>
|
/// <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);
|
public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
|
||||||
|
|
||||||
|
@ -202,5 +206,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
|
public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||||
|
|
||||||
|
public abstract int GetAssetPermissions(UUID userID, UUID assetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,6 +263,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
folders[(AssetType)folder.Type] = folder;
|
folders[(AssetType)folder.Type] = folder;
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count);
|
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;
|
return folders;
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
|
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
|
||||||
|
@ -422,16 +424,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||||
{
|
{
|
||||||
return new List<InventoryItemBase>();
|
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
|
#endregion
|
||||||
|
|
||||||
private UUID GetSessionID(UUID userID)
|
private UUID GetSessionID(UUID userID)
|
||||||
|
|
|
@ -201,8 +201,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
foreach (InventoryFolderBase folder in content.Folders)
|
foreach (InventoryFolderBase folder in content.Folders)
|
||||||
{
|
{
|
||||||
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
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;
|
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;
|
return folders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,20 +319,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return m_InventoryService.HasInventoryForUser(userID);
|
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)
|
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||||
{
|
{
|
||||||
return m_InventoryService.GetActiveGestures(userId);
|
return m_InventoryService.GetActiveGestures(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||||
|
{
|
||||||
|
return m_InventoryService.GetAssetPermissions(userID, assetID);
|
||||||
|
}
|
||||||
#endregion IInventoryService
|
#endregion IInventoryService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,16 +296,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||||
{
|
{
|
||||||
return new List<InventoryItemBase>();
|
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
|
#endregion
|
||||||
|
|
||||||
private UUID GetSessionID(UUID userID)
|
private UUID GetSessionID(UUID userID)
|
||||||
|
|
|
@ -153,6 +153,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
||||||
m_httpServer.AddStreamHandler(
|
m_httpServer.AddStreamHandler(
|
||||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
||||||
("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource));
|
("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource));
|
||||||
|
|
||||||
|
m_httpServer.AddStreamHandler(
|
||||||
|
new RestDeserialiseTrustedHandler<InventoryItemBase, int>
|
||||||
|
("POST", "/AssetPermissions/", GetAssetPermissions, CheckTrustSource));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Wrappers for converting the Guid parameter
|
#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))
|
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
||||||
folders[(AssetType)folder.Type] = folder;
|
folders[(AssetType)folder.Type] = folder;
|
||||||
}
|
}
|
||||||
|
// Put the root folder there, as type Folder
|
||||||
|
folders[AssetType.Folder] = root;
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,6 +242,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
||||||
return m_InventoryService.GetInventorySkeleton(userID);
|
return m_InventoryService.GetInventorySkeleton(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAssetPermissions(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.Inventory
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID)
|
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 url = string.Empty;
|
||||||
string userID = string.Empty;
|
string userID = string.Empty;
|
||||||
|
|
||||||
|
@ -279,5 +279,17 @@ namespace OpenSim.Services.Connectors.Inventory
|
||||||
return null;
|
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);
|
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>
|
/// <returns></returns>
|
||||||
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
|
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
|
||||||
{
|
{
|
||||||
// !!! Not just yet.
|
try
|
||||||
//try
|
{
|
||||||
//{
|
List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||||
// List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
"POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||||
// "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
|
||||||
// Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
|
Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
|
||||||
// foreach (InventoryFolderBase f in folders)
|
foreach (InventoryFolderBase f in folders)
|
||||||
// dFolders[(AssetType)f.Type] = f;
|
dFolders[(AssetType)f.Type] = f;
|
||||||
// return dFolders;
|
return dFolders;
|
||||||
//}
|
}
|
||||||
//catch (Exception e)
|
catch (Exception e)
|
||||||
//{
|
{
|
||||||
// m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}",
|
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}",
|
||||||
// e.Source, e.Message);
|
e.Source, e.Message);
|
||||||
//}
|
}
|
||||||
|
|
||||||
return new Dictionary<AssetType, InventoryFolderBase>();
|
return new Dictionary<AssetType, InventoryFolderBase>();
|
||||||
}
|
}
|
||||||
|
@ -348,6 +348,25 @@ namespace OpenSim.Services.Connectors
|
||||||
return null;
|
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
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -176,5 +176,10 @@ namespace OpenSim.Services.Connectors
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,8 +149,18 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <returns>true if the item was successfully deleted</returns>
|
/// <returns>true if the item was successfully deleted</returns>
|
||||||
bool DeleteItem(InventoryItemBase item);
|
bool DeleteItem(InventoryItemBase item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an item, given by its UUID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <returns></returns>
|
||||||
InventoryItemBase GetItem(InventoryItemBase item);
|
InventoryItemBase GetItem(InventoryItemBase item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a folder, given by its UUID
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
/// <returns></returns>
|
||||||
InventoryFolderBase GetFolder(InventoryFolderBase folder);
|
InventoryFolderBase GetFolder(InventoryFolderBase folder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -166,5 +176,15 @@ namespace OpenSim.Services.Interfaces
|
||||||
/// <param name="userId"></param>
|
/// <param name="userId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<InventoryItemBase> GetActiveGestures(UUID userId);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,6 +465,29 @@ namespace OpenSim.Services.InventoryService
|
||||||
return null;
|
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>
|
/// <summary>
|
||||||
/// Used to create a new user inventory.
|
/// Used to create a new user inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -171,5 +171,10 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
root.ParentID = UUID.Zero;
|
root.ParentID = UUID.Zero;
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue