Added GetAssetPermissions. Few last bugs nixed. This is ready for testing.

This commit is contained in:
Diva Canto
2009-08-13 17:34:15 -07:00
parent 5246dc33dc
commit 034c9cf606
15 changed files with 171 additions and 47 deletions

View File

@@ -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>