diff options
author | Melanie | 2012-02-02 23:40:56 +0000 |
---|---|---|
committer | Melanie | 2012-02-02 23:40:56 +0000 |
commit | 447a66d66005c5ec54a786d1d0a532738729251c (patch) | |
tree | 78c286a7c43586e7ce0747bd71369c3a3be344df /OpenSim/Region/CoreModules | |
parent | OpenID: server connector had a copy-and-paste error that made identity querie... (diff) | |
download | opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.zip opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.tar.gz opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.tar.bz2 opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.tar.xz |
Replace ParcelAccessEntry with a new struct, LandAccessEntry, which more
accurately reflects the data sent by the viewer. Add times bans and the
expiration of timed bans.
Warning: Contains a Migration (and nuts)
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 84 |
2 files changed, 62 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 94bba83..1c503aa 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -550,7 +550,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
550 | 550 | ||
551 | public void ClientOnParcelAccessListUpdateRequest(UUID agentID, | 551 | public void ClientOnParcelAccessListUpdateRequest(UUID agentID, |
552 | uint flags, int landLocalID, UUID transactionID, int sequenceID, | 552 | uint flags, int landLocalID, UUID transactionID, int sequenceID, |
553 | int sections, List<ParcelManager.ParcelAccessEntry> entries, | 553 | int sections, List<LandAccessEntry> entries, |
554 | IClientAPI remote_client) | 554 | IClientAPI remote_client) |
555 | { | 555 | { |
556 | // Flags is the list to update, it can mean either the ban or | 556 | // Flags is the list to update, it can mean either the ban or |
@@ -1712,4 +1712,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1712 | MainConsole.Instance.Output(report.ToString()); | 1712 | MainConsole.Instance.Output(report.ToString()); |
1713 | } | 1713 | } |
1714 | } | 1714 | } |
1715 | } \ No newline at end of file | 1715 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 79b13c3..3b4336f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -418,13 +418,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
418 | 418 | ||
419 | public bool IsBannedFromLand(UUID avatar) | 419 | public bool IsBannedFromLand(UUID avatar) |
420 | { | 420 | { |
421 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 421 | ExpireAccessList(); |
422 | |||
423 | if (m_scene.Permissions.IsAdministrator(avatar)) | ||
424 | return false; | ||
425 | |||
426 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
427 | return false; | ||
428 | |||
429 | if (avatar == LandData.OwnerID) | ||
422 | return false; | 430 | return false; |
423 | 431 | ||
424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 432 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
425 | { | 433 | { |
426 | if (LandData.ParcelAccessList.FindIndex( | 434 | if (LandData.ParcelAccessList.FindIndex( |
427 | delegate(ParcelManager.ParcelAccessEntry e) | 435 | delegate(LandAccessEntry e) |
428 | { | 436 | { |
429 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) | 437 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) |
430 | return true; | 438 | return true; |
@@ -439,13 +447,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
439 | 447 | ||
440 | public bool IsRestrictedFromLand(UUID avatar) | 448 | public bool IsRestrictedFromLand(UUID avatar) |
441 | { | 449 | { |
442 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 450 | ExpireAccessList(); |
451 | |||
452 | if (m_scene.Permissions.IsAdministrator(avatar)) | ||
453 | return false; | ||
454 | |||
455 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
456 | return false; | ||
457 | |||
458 | if (avatar == LandData.OwnerID) | ||
443 | return false; | 459 | return false; |
444 | 460 | ||
445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 461 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
446 | { | 462 | { |
447 | if (LandData.ParcelAccessList.FindIndex( | 463 | if (LandData.ParcelAccessList.FindIndex( |
448 | delegate(ParcelManager.ParcelAccessEntry e) | 464 | delegate(LandAccessEntry e) |
449 | { | 465 | { |
450 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | 466 | if (e.AgentID == avatar && e.Flags == AccessList.Access) |
451 | return true; | 467 | return true; |
@@ -511,19 +527,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
511 | 527 | ||
512 | #region AccessList Functions | 528 | #region AccessList Functions |
513 | 529 | ||
514 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) | 530 | public List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag) |
515 | { | 531 | { |
516 | List<UUID> list = new List<UUID>(); | 532 | ExpireAccessList(); |
517 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) | 533 | |
534 | List<LandAccessEntry> list = new List<LandAccessEntry>(); | ||
535 | foreach (LandAccessEntry entry in LandData.ParcelAccessList) | ||
518 | { | 536 | { |
519 | if (entry.Flags == flag) | 537 | if (entry.Flags == flag) |
520 | { | 538 | list.Add(entry); |
521 | list.Add(entry.AgentID); | ||
522 | } | ||
523 | } | 539 | } |
524 | if (list.Count == 0) | 540 | if (list.Count == 0) |
525 | { | 541 | { |
526 | list.Add(UUID.Zero); | 542 | LandAccessEntry e = new LandAccessEntry(); |
543 | e.AgentID = UUID.Zero; | ||
544 | e.Flags = 0; | ||
545 | e.Expires = 0; | ||
546 | |||
547 | list.Add(e); | ||
527 | } | 548 | } |
528 | 549 | ||
529 | return list; | 550 | return list; |
@@ -535,20 +556,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
535 | 556 | ||
536 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) | 557 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) |
537 | { | 558 | { |
538 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); | 559 | List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Access); |
539 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); | 560 | remote_client.SendLandAccessListData(accessEntries,(uint) AccessList.Access,LandData.LocalID); |
540 | } | 561 | } |
541 | 562 | ||
542 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) | 563 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) |
543 | { | 564 | { |
544 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); | 565 | List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Ban); |
545 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | 566 | remote_client.SendLandAccessListData(accessEntries, (uint)AccessList.Ban, LandData.LocalID); |
546 | } | 567 | } |
547 | } | 568 | } |
548 | 569 | ||
549 | public void UpdateAccessList(uint flags, UUID transactionID, | 570 | public void UpdateAccessList(uint flags, UUID transactionID, |
550 | int sequenceID, int sections, | 571 | int sequenceID, int sections, |
551 | List<ParcelManager.ParcelAccessEntry> entries, | 572 | List<LandAccessEntry> entries, |
552 | IClientAPI remote_client) | 573 | IClientAPI remote_client) |
553 | { | 574 | { |
554 | LandData newData = LandData.Copy(); | 575 | LandData newData = LandData.Copy(); |
@@ -558,16 +579,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
558 | { | 579 | { |
559 | m_listTransactions[flags] = transactionID; | 580 | m_listTransactions[flags] = transactionID; |
560 | 581 | ||
561 | List<ParcelManager.ParcelAccessEntry> toRemove = | 582 | List<LandAccessEntry> toRemove = |
562 | new List<ParcelManager.ParcelAccessEntry>(); | 583 | new List<LandAccessEntry>(); |
563 | 584 | ||
564 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) | 585 | foreach (LandAccessEntry entry in newData.ParcelAccessList) |
565 | { | 586 | { |
566 | if (entry.Flags == (AccessList)flags) | 587 | if (entry.Flags == (AccessList)flags) |
567 | toRemove.Add(entry); | 588 | toRemove.Add(entry); |
568 | } | 589 | } |
569 | 590 | ||
570 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 591 | foreach (LandAccessEntry entry in toRemove) |
571 | { | 592 | { |
572 | newData.ParcelAccessList.Remove(entry); | 593 | newData.ParcelAccessList.Remove(entry); |
573 | } | 594 | } |
@@ -582,13 +603,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
582 | } | 603 | } |
583 | } | 604 | } |
584 | 605 | ||
585 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 606 | foreach (LandAccessEntry entry in entries) |
586 | { | 607 | { |
587 | ParcelManager.ParcelAccessEntry temp = | 608 | LandAccessEntry temp = |
588 | new ParcelManager.ParcelAccessEntry(); | 609 | new LandAccessEntry(); |
589 | 610 | ||
590 | temp.AgentID = entry.AgentID; | 611 | temp.AgentID = entry.AgentID; |
591 | temp.Time = entry.Time; | 612 | temp.Expires = entry.Expires; |
592 | temp.Flags = (AccessList)flags; | 613 | temp.Flags = (AccessList)flags; |
593 | 614 | ||
594 | newData.ParcelAccessList.Add(temp); | 615 | newData.ParcelAccessList.Add(temp); |
@@ -1105,5 +1126,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1105 | } | 1126 | } |
1106 | 1127 | ||
1107 | #endregion | 1128 | #endregion |
1129 | |||
1130 | private void ExpireAccessList() | ||
1131 | { | ||
1132 | List<LandAccessEntry> delete = new List<LandAccessEntry>(); | ||
1133 | |||
1134 | foreach (LandAccessEntry entry in LandData.ParcelAccessList) | ||
1135 | { | ||
1136 | if (entry.Expires != 0 && entry.Expires < Util.UnixTimeSinceEpoch()) | ||
1137 | delete.Add(entry); | ||
1138 | } | ||
1139 | foreach (LandAccessEntry entry in delete) | ||
1140 | LandData.ParcelAccessList.Remove(entry); | ||
1141 | |||
1142 | m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); | ||
1143 | } | ||
1108 | } | 1144 | } |
1109 | } | 1145 | } |