diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 401a238674..9fb8aa58de 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -57,7 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver public bool SaveAssets { get; set; } /// - /// Determine whether this archive will filter content based on inventory permissions. Default is false + /// Determines which items will be included in the archive, according to their permissions. + /// Default is null, meaning no permission checks. /// public string FilterContent { get; set; } @@ -139,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_assetGatherer = new UuidGatherer(m_scene.AssetService); SaveAssets = true; - FilterContent = string.Empty; + FilterContent = null; } protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids, bool timedOut) @@ -287,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Whether the user is allowed to export the object to an IAR private bool CanUserArchiveObject(UUID UserID, InventoryItemBase InvItem) { - if (FilterContent == string.Empty) + if (FilterContent == null) return true;// Default To Allow Export bool permitted = true; @@ -317,10 +318,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver SaveAssets = false; // Set Permission filter if flag is set - if (options.ContainsKey("perm")) + if (options.ContainsKey("checkPermissions")) { Object temp; - if (options.TryGetValue("perm", out temp)) + if (options.TryGetValue("checkPermissions", out temp)) FilterContent = temp.ToString().ToUpper(); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b85bbea463..5b5987d696 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -141,7 +141,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver + "-e|--exclude= don't save the inventory item in archive" + Environment.NewLine + "-f|--excludefolder= don't save contents of the folder in archive" + Environment.NewLine + "-v|--verbose extra debug messages.\n" - + "--noassets stops assets being saved to the IAR.", + + "--noassets stops assets being saved to the IAR." + + "--perm= stops items with insufficient permissions from being saved to the IAR.\n" + + " can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer, \"M\" = Modify.\n", HandleSaveInvConsoleCommand); m_aScene = scene; @@ -455,7 +457,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver options["excludefolders"] = new List(); ((List)options["excludefolders"]).Add(v); }); - ops.Add("perm=", delegate(string v) { options["perm"] = v; }); + ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); List mainParams = ops.Parse(cmdparams); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 803f24e2a9..924b999b5f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// Determines which objects will be included in the archive, according to their permissions. /// Default is null, meaning no permission checks. /// - public string CheckPermissions { get; set; } + public string FilterContent { get; set; } protected Scene m_rootScene; protected Stream m_saveStream; @@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver MultiRegionFormat = false; SaveAssets = true; - CheckPermissions = null; + FilterContent = null; } /// @@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver Object temp; if (options.TryGetValue("checkPermissions", out temp)) - CheckPermissions = (string)temp; + FilterContent = (string)temp; // Find the regions to archive @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (!sceneObject.IsDeleted && !sceneObject.IsAttachment) { - if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, CheckPermissions, permissionsModule)) + if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule)) { // The user isn't allowed to copy/transfer this object, so it will not be included in the OAR. ++numObjectsSkippedPermissions; @@ -296,12 +296,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// /// The user /// The object group - /// Which permissions to check: "C" = Copy, "T" = Transfer + /// Which permissions to check: "C" = Copy, "T" = Transfer /// The scene's permissions module /// Whether the user is allowed to export the object to an OAR - private bool CanUserArchiveObject(UUID user, SceneObjectGroup objGroup, string checkPermissions, IPermissionsModule permissionsModule) + private bool CanUserArchiveObject(UUID user, SceneObjectGroup objGroup, string filterContent, IPermissionsModule permissionsModule) { - if (checkPermissions == null) + if (filterContent == null) return true; if (permissionsModule == null) @@ -343,9 +343,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0; bool partPermitted = true; - if (checkPermissions.Contains("C") && !canCopy) + if (filterContent.Contains("C") && !canCopy) partPermitted = false; - if (checkPermissions.Contains("T") && !canTransfer) + if (filterContent.Contains("T") && !canTransfer) partPermitted = false; // If the user is the Creator of the object then it can always be included in the OAR diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index 0795589e13..37e20c3f9a 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs @@ -42,10 +42,10 @@ namespace OpenSim.Region.Framework.Interfaces /// The inventory path saved /// The stream to which the archive was saved /// Contains the exception generated if the save did not succeed - /// Number of inventory items saved to archive - /// Number of inventory items skipped due to perm filter option + /// Number of inventory items saved to archive + /// Number of inventory items skipped due to perm filter option public delegate void InventoryArchiveSaved( - UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int SaveCount, int FilterCount); + UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int saveCount, int filterCount); /// /// Used for the OnInventoryArchiveLoaded event. @@ -56,9 +56,9 @@ namespace OpenSim.Region.Framework.Interfaces /// The inventory path loaded /// The stream from which the archive was loaded /// Contains the exception generated if the load did not succeed - /// Number of inventory items loaded from archive + /// Number of inventory items loaded from archive public delegate void InventoryArchiveLoaded( - UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int LoadCount); + UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int loadCount); public interface IInventoryArchiverModule