mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
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.
This commit is contained in:
committed by
Justin Clark-Casey (justincc)
parent
5bc3bbbcf3
commit
1e22091193
@@ -57,7 +57,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
public bool SaveAssets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut)
|
||||
@@ -287,7 +288,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// <returns>Whether the user is allowed to export the object to an IAR</returns>
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
+ "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine
|
||||
+ "-f|--excludefolder=<folder/uuid> 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=<permissions> stops items with insufficient permissions from being saved to the IAR.\n"
|
||||
+ " <permissions> 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<String>();
|
||||
((List<String>)options["excludefolders"]).Add(v);
|
||||
});
|
||||
ops.Add("perm=", delegate(string v) { options["perm"] = v; });
|
||||
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
|
||||
|
||||
List<string> mainParams = ops.Parse(cmdparams);
|
||||
|
||||
|
||||
@@ -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.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
/// <param name="objGroup">The object group</param>
|
||||
/// <param name="checkPermissions">Which permissions to check: "C" = Copy, "T" = Transfer</param>
|
||||
/// <param name="filterContent">Which permissions to check: "C" = Copy, "T" = Transfer</param>
|
||||
/// <param name="permissionsModule">The scene's permissions module</param>
|
||||
/// <returns>Whether the user is allowed to export the object to an OAR</returns>
|
||||
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
|
||||
|
||||
@@ -42,10 +42,10 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="invPath">The inventory path saved</param>
|
||||
/// <param name="savePath">The stream to which the archive was saved</param>
|
||||
/// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
|
||||
/// <param name="SaveCount">Number of inventory items saved to archive</param>
|
||||
/// <param name="FilterCount">Number of inventory items skipped due to perm filter option</param>
|
||||
/// <param name="saveCount">Number of inventory items saved to archive</param>
|
||||
/// <param name="filterCount">Number of inventory items skipped due to perm filter option</param>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// Used for the OnInventoryArchiveLoaded event.
|
||||
@@ -56,9 +56,9 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
/// <param name="invPath">The inventory path loaded</param>
|
||||
/// <param name="savePath">The stream from which the archive was loaded</param>
|
||||
/// <param name="reportedException">Contains the exception generated if the load did not succeed</param>
|
||||
/// <param name="LoadCount">Number of inventory items loaded from archive</param>
|
||||
/// <param name="loadCount">Number of inventory items loaded from archive</param>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user