diff options
author | Diva Canto | 2009-08-13 17:34:15 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-13 17:34:15 -0700 |
commit | 034c9cf606373bfa9d3f8040cd787f789e0efbf2 (patch) | |
tree | f586e4a8247fdf92e730bb7a8c296559e144d0a8 /OpenSim/Services/InventoryService | |
parent | Renamed QueryItem/QueryFolder to GetItem/GetFolder. The word 'query' starting... (diff) | |
download | opensim-SC-034c9cf606373bfa9d3f8040cd787f789e0efbf2.zip opensim-SC-034c9cf606373bfa9d3f8040cd787f789e0efbf2.tar.gz opensim-SC-034c9cf606373bfa9d3f8040cd787f789e0efbf2.tar.bz2 opensim-SC-034c9cf606373bfa9d3f8040cd787f789e0efbf2.tar.xz |
Added GetAssetPermissions. Few last bugs nixed. This is ready for testing.
Diffstat (limited to 'OpenSim/Services/InventoryService')
-rw-r--r-- | OpenSim/Services/InventoryService/InventoryService.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 3d706dc..65c2d96 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -465,6 +465,29 @@ namespace OpenSim.Services.InventoryService | |||
465 | return null; | 465 | return null; |
466 | } | 466 | } |
467 | 467 | ||
468 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
469 | { | ||
470 | InventoryFolderBase parent = GetRootFolder(userID); | ||
471 | return FindAssetPerms(parent, assetID); | ||
472 | } | ||
473 | |||
474 | private int FindAssetPerms(InventoryFolderBase folder, UUID assetID) | ||
475 | { | ||
476 | InventoryCollection contents = GetFolderContent(folder.Owner, folder.ID); | ||
477 | |||
478 | int perms = 0; | ||
479 | foreach (InventoryItemBase item in contents.Items) | ||
480 | { | ||
481 | if (item.AssetID == assetID) | ||
482 | perms = (int)item.CurrentPermissions | perms; | ||
483 | } | ||
484 | |||
485 | foreach (InventoryFolderBase subfolder in contents.Folders) | ||
486 | perms = perms | FindAssetPerms(subfolder, assetID); | ||
487 | |||
488 | return perms; | ||
489 | } | ||
490 | |||
468 | /// <summary> | 491 | /// <summary> |
469 | /// Used to create a new user inventory. | 492 | /// Used to create a new user inventory. |
470 | /// </summary> | 493 | /// </summary> |