aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land
diff options
context:
space:
mode:
authorMelanie2010-12-13 20:35:56 +0000
committerMelanie2010-12-13 20:35:56 +0000
commit9bd7f3b03a315d713d53451a36fd64c419ce5f35 (patch)
tree2c56939c277504a6b9997b825255a70df6b37cf2 /OpenSim/Region/CoreModules/World/Land
parentChange some lookups in he Land Management module to make group permissions (diff)
downloadopensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.zip
opensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.tar.gz
opensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.tar.bz2
opensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.tar.xz
Revamp the viewer -> banlist packet processing so fix a number of bugs.
Remove the too coarse CanEditParcel method in favor of a CanEditParcelProperties method that takes a GroupPowers argument to specify what action is to be taken. Also, make the method to set parcel data much more granular. Permissions in a deeded setting should now work.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs200
2 files changed, 167 insertions, 67 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 695202f..ac4705c 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Land
159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects; 159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects;
160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest; 160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest;
161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest; 161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest;
162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessUpdateListRequest; 162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessListUpdateRequest;
163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest; 163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest;
164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
165 client.OnParcelReclaim += ClientOnParcelReclaim; 165 client.OnParcelReclaim += ClientOnParcelReclaim;
@@ -508,14 +508,22 @@ namespace OpenSim.Region.CoreModules.World.Land
508 508
509 if (land != null) 509 if (land != null)
510 { 510 {
511 m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client); 511 land.SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
512 } 512 }
513 } 513 }
514 514
515 public void ClientOnParcelAccessUpdateListRequest(UUID agentID, UUID sessionID, uint flags, int landLocalID, 515 public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
516 List<ParcelManager.ParcelAccessEntry> entries, 516 uint flags, int landLocalID, UUID transactionID, int sequenceID,
517 IClientAPI remote_client) 517 int sections, List<ParcelManager.ParcelAccessEntry> entries,
518 IClientAPI remote_client)
518 { 519 {
520 // Flags is the list to update, it can mean either the ban or
521 // the access list (WTH is a pass list? Mentioned in ParcelFlags)
522 //
523 // There may be multiple packets, because these can get LONG.
524 // Use transactionID to determine a new chain of packets since
525 // packets may have come in out of sequence and that would be
526 // a big mess if using the sequenceID
519 ILandObject land; 527 ILandObject land;
520 lock (m_landList) 528 lock (m_landList)
521 { 529 {
@@ -524,9 +532,15 @@ namespace OpenSim.Region.CoreModules.World.Land
524 532
525 if (land != null) 533 if (land != null)
526 { 534 {
527 if (agentID == land.LandData.OwnerID) 535 GroupPowers requiredPowers = GroupPowers.LandManageAllowed;
536 if (flags == (uint)AccessList.Ban)
537 requiredPowers = GroupPowers.LandManageBanned;
538
539 if (m_scene.Permissions.CanEditParcelProperties(agentID,
540 land, requiredPowers))
528 { 541 {
529 land.UpdateAccessList(flags, entries, remote_client); 542 land.UpdateAccessList(flags, transactionID, sequenceID,
543 sections, entries, remote_client);
530 } 544 }
531 } 545 }
532 else 546 else
@@ -854,7 +868,7 @@ namespace OpenSim.Region.CoreModules.World.Land
854 868
855 //If we are still here, then they are subdividing within one piece of land 869 //If we are still here, then they are subdividing within one piece of land
856 //Check owner 870 //Check owner
857 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, startLandObject)) 871 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin))
858 { 872 {
859 return; 873 return;
860 } 874 }
@@ -922,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Land
922 { 936 {
923 return; 937 return;
924 } 938 }
925 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, masterLandObject)) 939 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin))
926 { 940 {
927 return; 941 return;
928 } 942 }
@@ -1570,7 +1584,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1570 1584
1571 if (land == null) return; 1585 if (land == null) return;
1572 1586
1573 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) 1587 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions))
1574 return; 1588 return;
1575 1589
1576 land.LandData.OtherCleanTime = otherCleanTime; 1590 land.LandData.OtherCleanTime = otherCleanTime;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index d87352f..801d3a4 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.World.Land
54 protected LandData m_landData = new LandData(); 54 protected LandData m_landData = new LandData();
55 protected Scene m_scene; 55 protected Scene m_scene;
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
57 58
58 public bool[,] LandBitmap 59 public bool[,] LandBitmap
59 { 60 {
@@ -199,36 +200,81 @@ namespace OpenSim.Region.CoreModules.World.Land
199 200
200 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 201 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
201 { 202 {
202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 203 //Needs later group support
204 bool snap_selection = false;
205 LandData newData = LandData.Copy();
206
207 uint allowedDelta = 0;
208
209 // These two are always blocked as no client can set them anyway
210 // ParcelFlags.ForSaleObjects
211 // ParcelFlags.LindenHome
212
213 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
203 { 214 {
204 //Needs later group support 215 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
205 bool snap_selection = false; 216 ParcelFlags.AllowTerraform |
206 LandData newData = LandData.Copy(); 217 ParcelFlags.AllowDamage |
218 ParcelFlags.CreateObjects |
219 ParcelFlags.RestrictPushObject |
220 ParcelFlags.AllowGroupScripts |
221 ParcelFlags.CreateGroupObjects |
222 ParcelFlags.AllowAPrimitiveEntry |
223 ParcelFlags.AllowGroupObjectEntry);
224 }
207 225
208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 226 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale))
227 {
228 if (args.AuthBuyerID != newData.AuthBuyerID ||
229 args.SalePrice != newData.SalePrice)
209 { 230 {
210 if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) 231 snap_selection = true;
211 { 232 }
212 newData.AuthBuyerID = args.AuthBuyerID; 233
213 newData.SalePrice = args.SalePrice; 234 newData.AuthBuyerID = args.AuthBuyerID;
214 snap_selection = true; 235 newData.SalePrice = args.SalePrice;
215 } 236
237 if (!LandData.IsGroupOwned)
238 {
239 newData.GroupID = args.GroupID;
240
241 allowedDelta |= (uint)(ParcelFlags.AllowDeedToGroup |
242 ParcelFlags.ContributeWithDeed |
243 ParcelFlags.SellParcelObjects);
216 } 244 }
245
246 allowedDelta |= (uint)ParcelFlags.ForSale;
247 }
248
249 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces))
250 {
217 newData.Category = args.Category; 251 newData.Category = args.Category;
252
253 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
254 ParcelFlags.AllowPublish |
255 ParcelFlags.MaturePublish);
256 }
257
258 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity))
259 {
218 newData.Description = args.Desc; 260 newData.Description = args.Desc;
219 newData.GroupID = args.GroupID; 261 newData.Name = args.Name;
262 newData.SnapshotID = args.SnapshotID;
263 }
264
265 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint))
266 {
220 newData.LandingType = args.LandingType; 267 newData.LandingType = args.LandingType;
268 newData.UserLocation = args.UserLocation;
269 newData.UserLookAt = args.UserLookAt;
270 }
271
272 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia))
273 {
221 newData.MediaAutoScale = args.MediaAutoScale; 274 newData.MediaAutoScale = args.MediaAutoScale;
222 newData.MediaID = args.MediaID; 275 newData.MediaID = args.MediaID;
223 newData.MediaURL = args.MediaURL; 276 newData.MediaURL = args.MediaURL;
224 newData.MusicURL = args.MusicURL; 277 newData.MusicURL = args.MusicURL;
225 newData.Name = args.Name;
226 newData.Flags = args.ParcelFlags;
227 newData.PassHours = args.PassHours;
228 newData.PassPrice = args.PassPrice;
229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType; 278 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription; 279 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth; 280 newData.MediaWidth = args.MediaWidth;
@@ -237,10 +283,40 @@ namespace OpenSim.Region.CoreModules.World.Land
237 newData.ObscureMusic = args.ObscureMusic; 283 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia; 284 newData.ObscureMedia = args.ObscureMedia;
239 285
240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 286 allowedDelta |= (uint)(ParcelFlags.SoundLocal |
287 ParcelFlags.UrlWebPage |
288 ParcelFlags.UrlRawHtml |
289 ParcelFlags.AllowVoiceChat |
290 ParcelFlags.UseEstateVoiceChan);
291 }
292
293 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses))
294 {
295 newData.PassHours = args.PassHours;
296 newData.PassPrice = args.PassPrice;
297
298 allowedDelta |= (uint)ParcelFlags.UsePassList;
299 }
300
301 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed))
302 {
303 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
304 ParcelFlags.UseAccessList);
305 }
241 306
242 SendLandUpdateToAvatarsOverMe(snap_selection); 307 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned))
308 {
309 allowedDelta |= (uint)(ParcelFlags.UseBanList |
310 ParcelFlags.DenyAnonymous |
311 ParcelFlags.DenyAgeUnverified);
243 } 312 }
313
314 uint preserve = LandData.Flags & ~allowedDelta;
315 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
316
317 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
318
319 SendLandUpdateToAvatarsOverMe(snap_selection);
244 } 320 }
245 321
246 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 322 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -295,14 +371,14 @@ namespace OpenSim.Region.CoreModules.World.Land
295 371
296 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 372 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
297 { 373 {
298 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 374 if (LandData.ParcelAccessList.FindIndex(
299 entry.AgentID = avatar; 375 delegate(ParcelManager.ParcelAccessEntry e)
300 entry.Flags = AccessList.Ban; 376 {
301 entry.Time = new DateTime(); 377 if (e.AgentID == avatar && e.Flags == AccessList.Ban)
302 //See if they are on the list, but make sure the owner isn't banned 378 return true;
303 if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 379 return false;
380 }) != -1 && LandData.OwnerID != avatar)
304 { 381 {
305 //They are banned, so lets send them a notice about this parcel
306 return true; 382 return true;
307 } 383 }
308 } 384 }
@@ -316,15 +392,14 @@ namespace OpenSim.Region.CoreModules.World.Land
316 392
317 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 393 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
318 { 394 {
319 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 395 if (LandData.ParcelAccessList.FindIndex(
320 entry.AgentID = avatar; 396 delegate(ParcelManager.ParcelAccessEntry e)
321 entry.Flags = AccessList.Access; 397 {
322 entry.Time = new DateTime(); 398 if (e.AgentID == avatar && e.Flags == AccessList.Access)
323 399 return true;
324 //If they are not on the access list and are not the owner 400 return false;
325 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 401 }) == -1 && LandData.OwnerID != avatar)
326 { 402 {
327 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
328 return true; 403 return true;
329 } 404 }
330 } 405 }
@@ -421,39 +496,50 @@ namespace OpenSim.Region.CoreModules.World.Land
421 } 496 }
422 } 497 }
423 498
424 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 499 public void UpdateAccessList(uint flags, UUID transactionID,
500 int sequenceID, int sections,
501 List<ParcelManager.ParcelAccessEntry> entries,
502 IClientAPI remote_client)
425 { 503 {
426 LandData newData = LandData.Copy(); 504 LandData newData = LandData.Copy();
427 505
428 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 506 if ((!m_listTransactions.ContainsKey(flags)) ||
507 m_listTransactions[flags] != transactionID)
429 { 508 {
430 entries.Clear(); 509 m_listTransactions[flags] = transactionID;
431 }
432 510
433 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 511 List<ParcelManager.ParcelAccessEntry> toRemove =
434 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) 512 new List<ParcelManager.ParcelAccessEntry>();
435 { 513
436 if (entry.Flags == (AccessList)flags) 514 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
437 { 515 {
438 toRemove.Add(entry); 516 if (entry.Flags == (AccessList)flags)
517 toRemove.Add(entry);
439 } 518 }
440 }
441 519
442 foreach (ParcelManager.ParcelAccessEntry entry in toRemove) 520 foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
443 { 521 {
444 newData.ParcelAccessList.Remove(entry); 522 newData.ParcelAccessList.Remove(entry);
523 }
524
525 // Checked here because this will always be the first
526 // and only packet in a transaction
527 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
528 {
529 return;
530 }
445 } 531 }
532
446 foreach (ParcelManager.ParcelAccessEntry entry in entries) 533 foreach (ParcelManager.ParcelAccessEntry entry in entries)
447 { 534 {
448 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); 535 ParcelManager.ParcelAccessEntry temp =
536 new ParcelManager.ParcelAccessEntry();
537
449 temp.AgentID = entry.AgentID; 538 temp.AgentID = entry.AgentID;
450 temp.Time = new DateTime(); //Pointless? Yes. 539 temp.Time = entry.Time;
451 temp.Flags = (AccessList)flags; 540 temp.Flags = (AccessList)flags;
452 541
453 if (!newData.ParcelAccessList.Contains(temp)) 542 newData.ParcelAccessList.Add(temp);
454 {
455 newData.ParcelAccessList.Add(temp);
456 }
457 } 543 }
458 544
459 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 545 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
@@ -711,7 +797,7 @@ namespace OpenSim.Region.CoreModules.World.Land
711 797
712 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 798 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
713 { 799 {
714 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 800 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
715 { 801 {
716 List<uint> resultLocalIDs = new List<uint>(); 802 List<uint> resultLocalIDs = new List<uint>();
717 try 803 try
@@ -761,7 +847,7 @@ namespace OpenSim.Region.CoreModules.World.Land
761 /// </param> 847 /// </param>
762 public void SendLandObjectOwners(IClientAPI remote_client) 848 public void SendLandObjectOwners(IClientAPI remote_client)
763 { 849 {
764 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 850 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
765 { 851 {
766 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 852 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
767 List<UUID> groups = new List<UUID>(); 853 List<UUID> groups = new List<UUID>();