Merge branch 'master' of ssh://3dhosting.de/var/git/careminster

avinationmerge
Melanie 2012-01-28 03:22:36 +01:00
commit 6db9109b3f
11 changed files with 130 additions and 29 deletions

View File

@ -291,12 +291,16 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "save oar",
//"save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
"save oar [-h|--home=<url>] [--noassets] [--perm=<permissions>] [<OAR path>]",
"save oar [-h|--home=<url>] [--noassets] [--publish] [--perm=<permissions>] [<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." + Environment.NewLine
+ "--noassets stops assets being saved to the OAR." + Environment.NewLine
+ "--perm stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
+ "--publish saves an OAR stripped of owner and last owner information." + Environment.NewLine
+ " on reload, the estate owner will be the owner of all objects" + Environment.NewLine
+ " this is useful if you're making oars generally available that might be reloaded to the same grid from which you published" + Environment.NewLine
+ " this option is EXPERIMENTAL" + Environment.NewLine
+ "--perm=<permissions> stops objects with insufficient permissions from being saved to the OAR." + Environment.NewLine
+ " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer" + Environment.NewLine
+ "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.",

View File

@ -116,6 +116,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_merge = merge;
m_skipAssets = skipAssets;
m_requestId = requestId;
// Zero can never be a valid user id
m_validUserUuids[UUID.Zero] = false;
}
public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
@ -125,6 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_merge = merge;
m_skipAssets = skipAssets;
m_requestId = requestId;
// Zero can never be a valid user id
m_validUserUuids[UUID.Zero] = false;
}
/// <summary>
@ -386,16 +392,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (!m_validUserUuids.ContainsKey(uuid))
{
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
if (account != null)
m_validUserUuids.Add(uuid, true);
else
m_validUserUuids.Add(uuid, false);
m_validUserUuids.Add(uuid, account != null);
}
if (m_validUserUuids[uuid])
return true;
else
return false;
return m_validUserUuids[uuid];
}
/// <summary>

View File

@ -282,10 +282,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// always (incorrectly) includes the Copy bit set in this case. But that's a mistake: the viewer
// does NOT show that the object has Everyone-Copy permissions, and doesn't allow it to be copied.
if (permissionClass != PermissionClass.Owner)
{
canTransfer |= (obj.EveryoneMask & (uint)PermissionMask.Copy) != 0;
}
bool partPermitted = true;
if (checkPermissions.Contains("C") && !canCopy)

View File

@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
ops.Add("h|home=", delegate(string v) { options["home"] = v; });
ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; });
ops.Add("publish", v => options["wipe-owners"] = v != null);
ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; });
List<string> mainParams = ops.Parse(cmdparams);

View File

@ -248,9 +248,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Dictionary<string, Object> options = new Dictionary<string, Object>();
options.Add("noassets", true);
m_archiverModule.ArchiveRegion(archiveWriteStream, requestId, options);
//AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
//while (assetServer.HasWaitingRequests())
// assetServer.ProcessNextRequest();
// Don't wait for completion - with --noassets save oar happens synchronously
// Monitor.Wait(this, 60000);
@ -409,6 +406,86 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
/// <summary>
/// Test loading an OpenSim Region Archive saved with the --publish option.
/// </summary>
[Test]
public void TestLoadPublishedOar()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SceneObjectPart part1 = CreateSceneObjectPart1();
SceneObjectGroup sog1 = new SceneObjectGroup(part1);
m_scene.AddNewSceneObject(sog1, false);
SceneObjectPart part2 = CreateSceneObjectPart2();
AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
m_scene.AssetService.Store(ncAsset);
SceneObjectGroup sog2 = new SceneObjectGroup(part2);
TaskInventoryItem ncItem
= new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
part2.Inventory.AddInventoryItem(ncItem, true);
m_scene.AddNewSceneObject(sog2, false);
MemoryStream archiveWriteStream = new MemoryStream();
m_scene.EventManager.OnOarFileSaved += SaveCompleted;
Guid requestId = new Guid("00000000-0000-0000-0000-808080808080");
lock (this)
{
m_archiverModule.ArchiveRegion(
archiveWriteStream, requestId, new Dictionary<string, Object>() { { "wipe-owners", Boolean.TrueString } });
Monitor.Wait(this, 60000);
}
Assert.That(m_lastRequestId, Is.EqualTo(requestId));
byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive);
{
UUID estateOwner = TestHelpers.ParseTail(0x4747);
UUID objectOwner = TestHelpers.ParseTail(0x15);
// Reload to new scene
ArchiverModule archiverModule = new ArchiverModule();
SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule();
TestScene scene2 = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
// Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
// behaving correctly
UserAccountHelpers.CreateUserWithInventory(scene2, objectOwner);
scene2.RegionInfo.EstateSettings.EstateOwner = estateOwner;
lock (this)
{
scene2.EventManager.OnOarFileLoaded += LoadCompleted;
archiverModule.DearchiveRegion(archiveReadStream);
}
Assert.That(m_lastErrorMessage, Is.Null);
SceneObjectGroup loadedSog = scene2.GetSceneObjectGroup(part1.Name);
Assert.That(loadedSog.OwnerID, Is.EqualTo(estateOwner));
Assert.That(loadedSog.LastOwnerID, Is.EqualTo(estateOwner));
}
}
/// <summary>
/// Test loading the region settings of an OpenSim Region Archive.
/// </summary>

View File

@ -1491,14 +1491,12 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
// currentItem.Name, part.Name);
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null)
{
agentTransactions.HandleTaskItemUpdateFromTransaction(
remoteClient, part, transactionID, currentItem);
}
// Base ALWAYS has move
currentItem.BasePermissions |= (uint)PermissionMask.Move;

View File

@ -538,6 +538,12 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public UUID LastOwnerID
{
get { return m_rootPart.LastOwnerID; }
set { m_rootPart.LastOwnerID = value; }
}
public UUID OwnerID
{
get { return m_rootPart.OwnerID; }

View File

@ -4579,10 +4579,18 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Update the texture entry for this part.
/// </summary>
/// <param name="textureEntry"></param>
public void UpdateTextureEntry(byte[] textureEntry)
/// <param name="serializedTextureEntry"></param>
public void UpdateTextureEntry(byte[] serializedTextureEntry)
{
UpdateTextureEntry(new Primitive.TextureEntry(serializedTextureEntry, 0, serializedTextureEntry.Length));
}
/// <summary>
/// Update the texture entry for this part.
/// </summary>
/// <param name="newTex"></param>
public void UpdateTextureEntry(Primitive.TextureEntry newTex)
{
Primitive.TextureEntry newTex = new Primitive.TextureEntry(textureEntry, 0, textureEntry.Length);
Primitive.TextureEntry oldTex = Shape.Textures;
Changed changeFlags = 0;
@ -4614,7 +4622,7 @@ namespace OpenSim.Region.Framework.Scenes
break;
}
m_shape.TextureEntry = textureEntry;
m_shape.TextureEntry = newTex.GetBytes();
if (changeFlags != 0)
TriggerScriptChangedEvent(changeFlags);
UpdateFlag = UpdateRequired.FULL;

View File

@ -1205,8 +1205,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
WriteUUID(writer, "GroupID", sop.GroupID, options);
WriteUUID(writer, "OwnerID", sop.OwnerID, options);
WriteUUID(writer, "LastOwnerID", sop.LastOwnerID, options);
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
WriteUUID(writer, "OwnerID", ownerID, options);
UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID;
WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
@ -1293,7 +1298,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
writer.WriteElementString("CreationDate", item.CreationDate.ToString());
WriteUUID(writer, "CreatorID", item.CreatorID, options);
if (item.CreatorData != null && item.CreatorData != string.Empty)
@ -1314,10 +1318,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("InvType", item.InvType.ToString());
WriteUUID(writer, "ItemID", item.ItemID, options);
WriteUUID(writer, "OldItemID", item.OldItemID, options);
WriteUUID(writer, "LastOwnerID", item.LastOwnerID, options);
UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
WriteUUID(writer, "LastOwnerID", lastOwnerID, options);
writer.WriteElementString("Name", item.Name);
writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());
WriteUUID(writer, "OwnerID", item.OwnerID, options);
UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
WriteUUID(writer, "OwnerID", ownerID, options);
writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
WriteUUID(writer, "ParentID", item.ParentID, options);
WriteUUID(writer, "ParentPartID", item.ParentPartID, options);

View File

@ -251,7 +251,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
SRV_HomeURI = "http://127.0.0.1:8002"
SRV_InventoryServerURI = "http://127.0.0.1:8002"
SRV_AssetServerURI = "http://127.0.0.1:8002"
SRV_ProfileServerURI = "http://127.0.0.1:8002/user"
SRV_ProfileServerURI = "http://127.0.0.1:8002"
SRV_FriendsServerURI = "http://127.0.0.1:8002"
SRV_IMServerURI = "http://127.0.0.1:8002"

View File

@ -129,7 +129,7 @@
; Change this to your server
; accessible from other grids
;
HomeURI = "http://mygridserver.com:8002/user"
HomeURI = "http://mygridserver.com:8002"
Gatekeeper = "http://mygridserver.com:8002"
;; If you want to protect your assets from being copied by foreign visitors
;; uncomment the next line. You may want to do this on sims that have licensed content.