diff options
author | AliciaRaven | 2014-09-13 04:25:31 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-09-23 00:04:59 +0100 |
commit | 1e220911938ef3d16cee0112b81333a60b3e5d52 (patch) | |
tree | 8f7104983c4760c06b721ce4b0211ec4817b7b6e /OpenSim | |
parent | Add an event callback for loading IAR files. The callback for creating them a... (diff) | |
download | opensim-SC-1e220911938ef3d16cee0112b81333a60b3e5d52.zip opensim-SC-1e220911938ef3d16cee0112b81333a60b3e5d52.tar.gz opensim-SC-1e220911938ef3d16cee0112b81333a60b3e5d52.tar.bz2 opensim-SC-1e220911938ef3d16cee0112b81333a60b3e5d52.tar.xz |
Modifications to previous IAR commits to bring them more inline with existing OpenSim code conventions. Also include new IAR save switch in console help print out.
Diffstat (limited to 'OpenSim')
4 files changed, 24 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 401a238..9fb8aa5 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 | |||
57 | public bool SaveAssets { get; set; } | 57 | public bool SaveAssets { get; set; } |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Determine whether this archive will filter content based on inventory permissions. Default is false | 60 | /// Determines which items will be included in the archive, according to their permissions. |
61 | /// Default is null, meaning no permission checks. | ||
61 | /// </summary> | 62 | /// </summary> |
62 | public string FilterContent { get; set; } | 63 | public string FilterContent { get; set; } |
63 | 64 | ||
@@ -139,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); | 140 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); |
140 | 141 | ||
141 | SaveAssets = true; | 142 | SaveAssets = true; |
142 | FilterContent = string.Empty; | 143 | FilterContent = null; |
143 | } | 144 | } |
144 | 145 | ||
145 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut) | 146 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut) |
@@ -287,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
287 | /// <returns>Whether the user is allowed to export the object to an IAR</returns> | 288 | /// <returns>Whether the user is allowed to export the object to an IAR</returns> |
288 | private bool CanUserArchiveObject(UUID UserID, InventoryItemBase InvItem) | 289 | private bool CanUserArchiveObject(UUID UserID, InventoryItemBase InvItem) |
289 | { | 290 | { |
290 | if (FilterContent == string.Empty) | 291 | if (FilterContent == null) |
291 | return true;// Default To Allow Export | 292 | return true;// Default To Allow Export |
292 | 293 | ||
293 | bool permitted = true; | 294 | bool permitted = true; |
@@ -317,10 +318,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
317 | SaveAssets = false; | 318 | SaveAssets = false; |
318 | 319 | ||
319 | // Set Permission filter if flag is set | 320 | // Set Permission filter if flag is set |
320 | if (options.ContainsKey("perm")) | 321 | if (options.ContainsKey("checkPermissions")) |
321 | { | 322 | { |
322 | Object temp; | 323 | Object temp; |
323 | if (options.TryGetValue("perm", out temp)) | 324 | if (options.TryGetValue("checkPermissions", out temp)) |
324 | FilterContent = temp.ToString().ToUpper(); | 325 | FilterContent = temp.ToString().ToUpper(); |
325 | } | 326 | } |
326 | 327 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b85bbea..5b5987d 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 | |||
141 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine | 141 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine |
142 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine | 142 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine |
143 | + "-v|--verbose extra debug messages.\n" | 143 | + "-v|--verbose extra debug messages.\n" |
144 | + "--noassets stops assets being saved to the IAR.", | 144 | + "--noassets stops assets being saved to the IAR." |
145 | + "--perm=<permissions> stops items with insufficient permissions from being saved to the IAR.\n" | ||
146 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer, \"M\" = Modify.\n", | ||
145 | HandleSaveInvConsoleCommand); | 147 | HandleSaveInvConsoleCommand); |
146 | 148 | ||
147 | m_aScene = scene; | 149 | m_aScene = scene; |
@@ -455,7 +457,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
455 | options["excludefolders"] = new List<String>(); | 457 | options["excludefolders"] = new List<String>(); |
456 | ((List<String>)options["excludefolders"]).Add(v); | 458 | ((List<String>)options["excludefolders"]).Add(v); |
457 | }); | 459 | }); |
458 | ops.Add("perm=", delegate(string v) { options["perm"] = v; }); | 460 | ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); |
459 | 461 | ||
460 | List<string> mainParams = ops.Parse(cmdparams); | 462 | List<string> mainParams = ops.Parse(cmdparams); |
461 | 463 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 803f24e..924b999 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 | |||
80 | /// Determines which objects will be included in the archive, according to their permissions. | 80 | /// Determines which objects will be included in the archive, according to their permissions. |
81 | /// Default is null, meaning no permission checks. | 81 | /// Default is null, meaning no permission checks. |
82 | /// </summary> | 82 | /// </summary> |
83 | public string CheckPermissions { get; set; } | 83 | public string FilterContent { get; set; } |
84 | 84 | ||
85 | protected Scene m_rootScene; | 85 | protected Scene m_rootScene; |
86 | protected Stream m_saveStream; | 86 | protected Stream m_saveStream; |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
131 | 131 | ||
132 | MultiRegionFormat = false; | 132 | MultiRegionFormat = false; |
133 | SaveAssets = true; | 133 | SaveAssets = true; |
134 | CheckPermissions = null; | 134 | FilterContent = null; |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
@@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
150 | 150 | ||
151 | Object temp; | 151 | Object temp; |
152 | if (options.TryGetValue("checkPermissions", out temp)) | 152 | if (options.TryGetValue("checkPermissions", out temp)) |
153 | CheckPermissions = (string)temp; | 153 | FilterContent = (string)temp; |
154 | 154 | ||
155 | 155 | ||
156 | // Find the regions to archive | 156 | // Find the regions to archive |
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
238 | 238 | ||
239 | if (!sceneObject.IsDeleted && !sceneObject.IsAttachment) | 239 | if (!sceneObject.IsDeleted && !sceneObject.IsAttachment) |
240 | { | 240 | { |
241 | if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, CheckPermissions, permissionsModule)) | 241 | if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule)) |
242 | { | 242 | { |
243 | // The user isn't allowed to copy/transfer this object, so it will not be included in the OAR. | 243 | // The user isn't allowed to copy/transfer this object, so it will not be included in the OAR. |
244 | ++numObjectsSkippedPermissions; | 244 | ++numObjectsSkippedPermissions; |
@@ -296,12 +296,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
296 | /// </summary> | 296 | /// </summary> |
297 | /// <param name="user">The user</param> | 297 | /// <param name="user">The user</param> |
298 | /// <param name="objGroup">The object group</param> | 298 | /// <param name="objGroup">The object group</param> |
299 | /// <param name="checkPermissions">Which permissions to check: "C" = Copy, "T" = Transfer</param> | 299 | /// <param name="filterContent">Which permissions to check: "C" = Copy, "T" = Transfer</param> |
300 | /// <param name="permissionsModule">The scene's permissions module</param> | 300 | /// <param name="permissionsModule">The scene's permissions module</param> |
301 | /// <returns>Whether the user is allowed to export the object to an OAR</returns> | 301 | /// <returns>Whether the user is allowed to export the object to an OAR</returns> |
302 | private bool CanUserArchiveObject(UUID user, SceneObjectGroup objGroup, string checkPermissions, IPermissionsModule permissionsModule) | 302 | private bool CanUserArchiveObject(UUID user, SceneObjectGroup objGroup, string filterContent, IPermissionsModule permissionsModule) |
303 | { | 303 | { |
304 | if (checkPermissions == null) | 304 | if (filterContent == null) |
305 | return true; | 305 | return true; |
306 | 306 | ||
307 | if (permissionsModule == null) | 307 | if (permissionsModule == null) |
@@ -343,9 +343,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
343 | canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0; | 343 | canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0; |
344 | 344 | ||
345 | bool partPermitted = true; | 345 | bool partPermitted = true; |
346 | if (checkPermissions.Contains("C") && !canCopy) | 346 | if (filterContent.Contains("C") && !canCopy) |
347 | partPermitted = false; | 347 | partPermitted = false; |
348 | if (checkPermissions.Contains("T") && !canTransfer) | 348 | if (filterContent.Contains("T") && !canTransfer) |
349 | partPermitted = false; | 349 | partPermitted = false; |
350 | 350 | ||
351 | // If the user is the Creator of the object then it can always be included in the OAR | 351 | // 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 0795589..37e20c3 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs | |||
@@ -42,10 +42,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
42 | /// <param name="invPath">The inventory path saved</param> | 42 | /// <param name="invPath">The inventory path saved</param> |
43 | /// <param name="savePath">The stream to which the archive was saved</param> | 43 | /// <param name="savePath">The stream to which the archive was saved</param> |
44 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> | 44 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> |
45 | /// <param name="SaveCount">Number of inventory items saved to archive</param> | 45 | /// <param name="saveCount">Number of inventory items saved to archive</param> |
46 | /// <param name="FilterCount">Number of inventory items skipped due to perm filter option</param> | 46 | /// <param name="filterCount">Number of inventory items skipped due to perm filter option</param> |
47 | public delegate void InventoryArchiveSaved( | 47 | public delegate void InventoryArchiveSaved( |
48 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int SaveCount, int FilterCount); | 48 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException, int saveCount, int filterCount); |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Used for the OnInventoryArchiveLoaded event. | 51 | /// Used for the OnInventoryArchiveLoaded event. |
@@ -56,9 +56,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
56 | /// <param name="invPath">The inventory path loaded</param> | 56 | /// <param name="invPath">The inventory path loaded</param> |
57 | /// <param name="savePath">The stream from which the archive was loaded</param> | 57 | /// <param name="savePath">The stream from which the archive was loaded</param> |
58 | /// <param name="reportedException">Contains the exception generated if the load did not succeed</param> | 58 | /// <param name="reportedException">Contains the exception generated if the load did not succeed</param> |
59 | /// <param name="LoadCount">Number of inventory items loaded from archive</param> | 59 | /// <param name="loadCount">Number of inventory items loaded from archive</param> |
60 | public delegate void InventoryArchiveLoaded( | 60 | public delegate void InventoryArchiveLoaded( |
61 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int LoadCount); | 61 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, Exception reportedException, int loadCount); |
62 | 62 | ||
63 | 63 | ||
64 | public interface IInventoryArchiverModule | 64 | public interface IInventoryArchiverModule |