diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 619550c..142567b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -97,6 +97,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | /// <summary> | ||
101 | /// Used to cache lookups for valid groups. | ||
102 | /// </summary> | ||
103 | private IDictionary<UUID, bool> m_validGroupUuids = new Dictionary<UUID, bool>(); | ||
104 | |||
105 | private IGroupsModule m_groupsModule; | ||
106 | |||
100 | public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId) | 107 | public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId) |
101 | { | 108 | { |
102 | m_scene = scene; | 109 | m_scene = scene; |
@@ -120,6 +127,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
120 | 127 | ||
121 | // Zero can never be a valid user id | 128 | // Zero can never be a valid user id |
122 | m_validUserUuids[UUID.Zero] = false; | 129 | m_validUserUuids[UUID.Zero] = false; |
130 | |||
131 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
123 | } | 132 | } |
124 | 133 | ||
125 | public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId) | 134 | public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId) |
@@ -132,6 +141,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
132 | 141 | ||
133 | // Zero can never be a valid user id | 142 | // Zero can never be a valid user id |
134 | m_validUserUuids[UUID.Zero] = false; | 143 | m_validUserUuids[UUID.Zero] = false; |
144 | |||
145 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
135 | } | 146 | } |
136 | 147 | ||
137 | /// <summary> | 148 | /// <summary> |
@@ -302,6 +313,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
302 | if (!ResolveUserUuid(part.LastOwnerID)) | 313 | if (!ResolveUserUuid(part.LastOwnerID)) |
303 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 314 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
304 | 315 | ||
316 | if (!ResolveGroupUuid(part.GroupID)) | ||
317 | part.GroupID = UUID.Zero; | ||
318 | |||
305 | // And zap any troublesome sit target information | 319 | // And zap any troublesome sit target information |
306 | // part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | 320 | // part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); |
307 | // part.SitTargetPosition = new Vector3(0, 0, 0); | 321 | // part.SitTargetPosition = new Vector3(0, 0, 0); |
@@ -335,13 +349,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
335 | { | 349 | { |
336 | kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 350 | kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
337 | } | 351 | } |
352 | |||
338 | if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty) | 353 | if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty) |
339 | { | 354 | { |
340 | if (!ResolveUserUuid(kvp.Value.CreatorID)) | 355 | if (!ResolveUserUuid(kvp.Value.CreatorID)) |
341 | kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 356 | kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
342 | } | 357 | } |
358 | |||
343 | if (UserManager != null) | 359 | if (UserManager != null) |
344 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | 360 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); |
361 | |||
362 | if (!ResolveGroupUuid(kvp.Value.GroupID)) | ||
363 | kvp.Value.GroupID = UUID.Zero; | ||
345 | } | 364 | } |
346 | part.TaskInventory.LockItemsForRead(false); | 365 | part.TaskInventory.LockItemsForRead(false); |
347 | } | 366 | } |
@@ -382,9 +401,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
382 | foreach (string serialisedParcel in serialisedParcels) | 401 | foreach (string serialisedParcel in serialisedParcels) |
383 | { | 402 | { |
384 | LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); | 403 | LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); |
404 | |||
405 | // Validate User and Group UUID's | ||
406 | |||
385 | if (!ResolveUserUuid(parcel.OwnerID)) | 407 | if (!ResolveUserUuid(parcel.OwnerID)) |
386 | parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 408 | parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
387 | 409 | ||
410 | if (!ResolveGroupUuid(parcel.GroupID)) | ||
411 | { | ||
412 | parcel.GroupID = UUID.Zero; | ||
413 | parcel.IsGroupOwned = false; | ||
414 | } | ||
415 | |||
416 | List<LandAccessEntry> accessList = new List<LandAccessEntry>(); | ||
417 | foreach (LandAccessEntry entry in parcel.ParcelAccessList) | ||
418 | { | ||
419 | if (ResolveUserUuid(entry.AgentID)) | ||
420 | accessList.Add(entry); | ||
421 | // else, drop this access rule | ||
422 | } | ||
423 | parcel.ParcelAccessList = accessList; | ||
424 | |||
388 | // m_log.DebugFormat( | 425 | // m_log.DebugFormat( |
389 | // "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", | 426 | // "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", |
390 | // parcel.Name, parcel.LocalID, parcel.Area); | 427 | // parcel.Name, parcel.LocalID, parcel.Area); |
@@ -419,6 +456,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
419 | } | 456 | } |
420 | 457 | ||
421 | /// <summary> | 458 | /// <summary> |
459 | /// Look up the given group id to check whether it's one that is valid for this grid. | ||
460 | /// </summary> | ||
461 | /// <param name="uuid"></param> | ||
462 | /// <returns></returns> | ||
463 | private bool ResolveGroupUuid(UUID uuid) | ||
464 | { | ||
465 | if (uuid == UUID.Zero) | ||
466 | return true; // this means the object has no group | ||
467 | |||
468 | if (!m_validGroupUuids.ContainsKey(uuid)) | ||
469 | { | ||
470 | bool exists; | ||
471 | |||
472 | if (m_groupsModule == null) | ||
473 | exists = false; | ||
474 | else | ||
475 | exists = (m_groupsModule.GetGroupRecord(uuid) != null); | ||
476 | |||
477 | m_validGroupUuids.Add(uuid, exists); | ||
478 | } | ||
479 | |||
480 | return m_validGroupUuids[uuid]; | ||
481 | } | ||
482 | |||
422 | /// Load an asset | 483 | /// Load an asset |
423 | /// </summary> | 484 | /// </summary> |
424 | /// <param name="assetFilename"></param> | 485 | /// <param name="assetFilename"></param> |