Add save oar --tenant= option for saving stuff
This is mainly useful for multi tenancy sims where a user requests an oar of their stuff, and where you don't want to pass out other people's stuff.
This commit is contained in:
@@ -329,7 +329,7 @@ namespace OpenSim
|
||||
|
||||
m_console.Commands.AddCommand("Archiving", false, "save oar",
|
||||
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
|
||||
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [--all] [<OAR path>]",
|
||||
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [--all] [--tenant=<uuid>] [<OAR path>]",
|
||||
"Save a region's data to an OAR archive.",
|
||||
// "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
|
||||
"-h|--home=<url> adds the url of the profile service to the saved user information.\n"
|
||||
@@ -339,6 +339,7 @@ namespace OpenSim
|
||||
+ " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published\n"
|
||||
+ "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR.\n"
|
||||
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer\n"
|
||||
+ "--tenant=<uuid> only save objects owned by tenant with uuid.\n"
|
||||
+ "--all saves all the regions in the simulator, instead of just the current region.\n"
|
||||
+ "The OAR path must be a filesystem path."
|
||||
+ " If this is not given then the oar is saved to region.oar in the current directory.",
|
||||
|
||||
@@ -155,7 +155,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
if (options.TryGetValue("checkPermissions", out Object temp))
|
||||
FilterContent = (string)temp;
|
||||
|
||||
|
||||
// Find the regions to archive
|
||||
ArchiveScenesGroup scenesGroup = new ArchiveScenesGroup();
|
||||
if (MultiRegionFormat)
|
||||
@@ -189,7 +188,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
scenesGroup.ForEachScene(delegate(Scene scene)
|
||||
{
|
||||
string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : "";
|
||||
ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs, uncertainAssetsUUIDs);
|
||||
|
||||
UUID userId = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
if (options.TryGetValue("tenant", out Object temp))
|
||||
{
|
||||
if (!UUID.TryParse((string)temp, out userId) || userId.IsZero())
|
||||
userId = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
}
|
||||
|
||||
ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs, uncertainAssetsUUIDs, userId);
|
||||
});
|
||||
|
||||
// Archive the assets
|
||||
@@ -227,7 +234,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
}
|
||||
|
||||
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids,
|
||||
HashSet<UUID> failedIDs, HashSet<UUID> uncertainAssetsUUIDs)
|
||||
HashSet<UUID> failedIDs, HashSet<UUID> uncertainAssetsUUIDs, UUID userId)
|
||||
{
|
||||
m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name);
|
||||
|
||||
@@ -248,7 +255,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
if (!sceneObject.IsDeleted && !sceneObject.IsAttachment && !sceneObject.IsTemporary && !sceneObject.inTransit)
|
||||
{
|
||||
if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule))
|
||||
if (userId != scene.RegionInfo.EstateSettings.EstateOwner && sceneObject.OwnerID != userId)
|
||||
{
|
||||
// A tenant= option was specified, skip object if not owned by tenant with userid
|
||||
++numObjectsSkippedPermissions;
|
||||
}
|
||||
else if (!CanUserArchiveObject(userId, sceneObject, FilterContent, permissionsModule))
|
||||
{
|
||||
// The user isn't allowed to copy/transfer this object, so it will not be included in the OAR.
|
||||
++numObjectsSkippedPermissions;
|
||||
|
||||
@@ -280,6 +280,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
ops.Add("publish", v => options["wipe-owners"] = v != null);
|
||||
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
|
||||
ops.Add("all", delegate(string v) { options["all"] = v != null; });
|
||||
ops.Add("tenant=", delegate(string v) { options["tenant"] = v; });
|
||||
|
||||
List<string> mainParams = ops.Parse(cmdparams);
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
@dotnet build -c Release OpenSim.sln
|
||||
@dotnet build --configuration Release OpenSim.sln
|
||||
|
||||
@@ -6,7 +6,7 @@ dotnet bin\prebuild.dll /target vs2022 /targetframework net8_0 /excludedir = "ob
|
||||
|
||||
@echo Creating compile.bat
|
||||
rem To compile in release mode
|
||||
@echo dotnet build --configuration Release OpenSim.sln > compile.bat
|
||||
@echo @dotnet build --configuration Release OpenSim.sln > compile.bat
|
||||
rem To compile in debug mode comment line (add rem to start) above and uncomment next (remove rem)
|
||||
rem @echo dotnet build --configuration Debug OpenSim.sln > compile.bat
|
||||
:done
|
||||
|
||||
Reference in New Issue
Block a user