aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs63
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 2b61800..433166d 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);
@@ -318,13 +332,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
318 { 332 {
319 kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 333 kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
320 } 334 }
335
321 if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty) 336 if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty)
322 { 337 {
323 if (!ResolveUserUuid(kvp.Value.CreatorID)) 338 if (!ResolveUserUuid(kvp.Value.CreatorID))
324 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 339 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
325 } 340 }
341
326 if (UserManager != null) 342 if (UserManager != null)
327 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); 343 UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
344
345 if (!ResolveGroupUuid(kvp.Value.GroupID))
346 kvp.Value.GroupID = UUID.Zero;
328 } 347 }
329 } 348 }
330 } 349 }
@@ -364,9 +383,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
364 foreach (string serialisedParcel in serialisedParcels) 383 foreach (string serialisedParcel in serialisedParcels)
365 { 384 {
366 LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); 385 LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
386
387 // Validate User and Group UUID's
388
367 if (!ResolveUserUuid(parcel.OwnerID)) 389 if (!ResolveUserUuid(parcel.OwnerID))
368 parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 390 parcel.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
369 391
392 if (!ResolveGroupUuid(parcel.GroupID))
393 {
394 parcel.GroupID = UUID.Zero;
395 parcel.IsGroupOwned = false;
396 }
397
398 List<LandAccessEntry> accessList = new List<LandAccessEntry>();
399 foreach (LandAccessEntry entry in parcel.ParcelAccessList)
400 {
401 if (ResolveUserUuid(entry.AgentID))
402 accessList.Add(entry);
403 // else, drop this access rule
404 }
405 parcel.ParcelAccessList = accessList;
406
370// m_log.DebugFormat( 407// m_log.DebugFormat(
371// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", 408// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}",
372// parcel.Name, parcel.LocalID, parcel.Area); 409// parcel.Name, parcel.LocalID, parcel.Area);
@@ -401,6 +438,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver
401 } 438 }
402 439
403 /// <summary> 440 /// <summary>
441 /// Look up the given group id to check whether it's one that is valid for this grid.
442 /// </summary>
443 /// <param name="uuid"></param>
444 /// <returns></returns>
445 private bool ResolveGroupUuid(UUID uuid)
446 {
447 if (uuid == UUID.Zero)
448 return true; // this means the object has no group
449
450 if (!m_validGroupUuids.ContainsKey(uuid))
451 {
452 bool exists;
453
454 if (m_groupsModule == null)
455 exists = false;
456 else
457 exists = (m_groupsModule.GetGroupRecord(uuid) != null);
458
459 m_validGroupUuids.Add(uuid, exists);
460 }
461
462 return m_validGroupUuids[uuid];
463 }
464
404 /// Load an asset 465 /// Load an asset
405 /// </summary> 466 /// </summary>
406 /// <param name="assetFilename"></param> 467 /// <param name="assetFilename"></param>