diff options
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/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 88 |
1 files changed, 55 insertions, 33 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3c5f2d0..30fb252 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6287,16 +6287,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6287 | { | 6287 | { |
6288 | m_host.AddScriptLPS(1); | 6288 | m_host.AddScriptLPS(1); |
6289 | UUID key; | 6289 | UUID key; |
6290 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 6290 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6291 | if (land.OwnerID == m_host.OwnerID) | 6291 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) |
6292 | { | 6292 | { |
6293 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 6293 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
6294 | if (UUID.TryParse(avatar, out key)) | 6294 | if (UUID.TryParse(avatar, out key)) |
6295 | { | 6295 | { |
6296 | entry.AgentID = key; | 6296 | if (land.LandData.ParcelAccessList.FindIndex( |
6297 | entry.Flags = AccessList.Access; | 6297 | delegate(ParcelManager.ParcelAccessEntry e) |
6298 | entry.Time = DateTime.Now.AddHours(hours); | 6298 | { |
6299 | land.ParcelAccessList.Add(entry); | 6299 | if (e.AgentID == key && e.Flags == AccessList.Access) |
6300 | return true; | ||
6301 | return false; | ||
6302 | }) == -1) | ||
6303 | { | ||
6304 | entry.AgentID = key; | ||
6305 | entry.Flags = AccessList.Access; | ||
6306 | entry.Time = DateTime.Now.AddHours(hours); | ||
6307 | land.LandData.ParcelAccessList.Add(entry); | ||
6308 | } | ||
6300 | } | 6309 | } |
6301 | } | 6310 | } |
6302 | ScriptSleep(100); | 6311 | ScriptSleep(100); |
@@ -9023,7 +9032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9023 | // according to the docs, this command only works if script owner and land owner are the same | 9032 | // according to the docs, this command only works if script owner and land owner are the same |
9024 | // lets add estate owners and gods, too, and use the generic permission check. | 9033 | // lets add estate owners and gods, too, and use the generic permission check. |
9025 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 9034 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9026 | if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return; | 9035 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; |
9027 | 9036 | ||
9028 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? | 9037 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? |
9029 | byte loop = 0; | 9038 | byte loop = 0; |
@@ -9466,16 +9475,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9466 | { | 9475 | { |
9467 | m_host.AddScriptLPS(1); | 9476 | m_host.AddScriptLPS(1); |
9468 | UUID key; | 9477 | UUID key; |
9469 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 9478 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9470 | if (land.OwnerID == m_host.OwnerID) | 9479 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
9471 | { | 9480 | { |
9472 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 9481 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
9473 | if (UUID.TryParse(avatar, out key)) | 9482 | if (UUID.TryParse(avatar, out key)) |
9474 | { | 9483 | { |
9475 | entry.AgentID = key; | 9484 | if (land.LandData.ParcelAccessList.FindIndex( |
9476 | entry.Flags = AccessList.Ban; | 9485 | delegate(ParcelManager.ParcelAccessEntry e) |
9477 | entry.Time = DateTime.Now.AddHours(hours); | 9486 | { |
9478 | land.ParcelAccessList.Add(entry); | 9487 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9488 | return true; | ||
9489 | return false; | ||
9490 | }) == -1) | ||
9491 | { | ||
9492 | entry.AgentID = key; | ||
9493 | entry.Flags = AccessList.Ban; | ||
9494 | entry.Time = DateTime.Now.AddHours(hours); | ||
9495 | land.LandData.ParcelAccessList.Add(entry); | ||
9496 | } | ||
9479 | } | 9497 | } |
9480 | } | 9498 | } |
9481 | ScriptSleep(100); | 9499 | ScriptSleep(100); |
@@ -9485,19 +9503,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9485 | { | 9503 | { |
9486 | m_host.AddScriptLPS(1); | 9504 | m_host.AddScriptLPS(1); |
9487 | UUID key; | 9505 | UUID key; |
9488 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 9506 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9489 | if (land.OwnerID == m_host.OwnerID) | 9507 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) |
9490 | { | 9508 | { |
9491 | if (UUID.TryParse(avatar, out key)) | 9509 | if (UUID.TryParse(avatar, out key)) |
9492 | { | 9510 | { |
9493 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 9511 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9494 | { | 9512 | delegate(ParcelManager.ParcelAccessEntry e) |
9495 | if (entry.AgentID == key && entry.Flags == AccessList.Access) | 9513 | { |
9496 | { | 9514 | if (e.AgentID == key && e.Flags == AccessList.Access) |
9497 | land.ParcelAccessList.Remove(entry); | 9515 | return true; |
9498 | break; | 9516 | return false; |
9499 | } | 9517 | }); |
9500 | } | 9518 | |
9519 | if (idx != -1) | ||
9520 | land.LandData.ParcelAccessList.RemoveAt(idx); | ||
9501 | } | 9521 | } |
9502 | } | 9522 | } |
9503 | ScriptSleep(100); | 9523 | ScriptSleep(100); |
@@ -9507,19 +9527,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9507 | { | 9527 | { |
9508 | m_host.AddScriptLPS(1); | 9528 | m_host.AddScriptLPS(1); |
9509 | UUID key; | 9529 | UUID key; |
9510 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 9530 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9511 | if (land.OwnerID == m_host.OwnerID) | 9531 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
9512 | { | 9532 | { |
9513 | if (UUID.TryParse(avatar, out key)) | 9533 | if (UUID.TryParse(avatar, out key)) |
9514 | { | 9534 | { |
9515 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 9535 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9516 | { | 9536 | delegate(ParcelManager.ParcelAccessEntry e) |
9517 | if (entry.AgentID == key && entry.Flags == AccessList.Ban) | 9537 | { |
9518 | { | 9538 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9519 | land.ParcelAccessList.Remove(entry); | 9539 | return true; |
9520 | break; | 9540 | return false; |
9521 | } | 9541 | }); |
9522 | } | 9542 | |
9543 | if (idx != -1) | ||
9544 | land.LandData.ParcelAccessList.RemoveAt(idx); | ||
9523 | } | 9545 | } |
9524 | } | 9546 | } |
9525 | ScriptSleep(100); | 9547 | ScriptSleep(100); |