diff options
author | Melanie | 2010-12-13 20:19:52 +0100 |
---|---|---|
committer | Melanie | 2010-12-13 20:19:52 +0100 |
commit | 6b374fa54767a22c1d236470c8a19ee59b44d937 (patch) | |
tree | 489eb8847b445bd652b89683c55e3545fc7c6ad8 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |
parent | Change some lookups in he Land Management module to make group permissions (diff) | |
download | opensim-SC-6b374fa54767a22c1d236470c8a19ee59b44d937.zip opensim-SC-6b374fa54767a22c1d236470c8a19ee59b44d937.tar.gz opensim-SC-6b374fa54767a22c1d236470c8a19ee59b44d937.tar.bz2 opensim-SC-6b374fa54767a22c1d236470c8a19ee59b44d937.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/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 05a4170..835f274 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6653,16 +6653,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6653 | { | 6653 | { |
6654 | m_host.AddScriptLPS(1); | 6654 | m_host.AddScriptLPS(1); |
6655 | UUID key; | 6655 | UUID key; |
6656 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 6656 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6657 | if (land.OwnerID == m_host.OwnerID) | 6657 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) |
6658 | { | 6658 | { |
6659 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 6659 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
6660 | if (UUID.TryParse(avatar, out key)) | 6660 | if (UUID.TryParse(avatar, out key)) |
6661 | { | 6661 | { |
6662 | entry.AgentID = key; | 6662 | if (land.LandData.ParcelAccessList.FindIndex( |
6663 | entry.Flags = AccessList.Access; | 6663 | delegate(ParcelManager.ParcelAccessEntry e) |
6664 | entry.Time = DateTime.Now.AddHours(hours); | 6664 | { |
6665 | land.ParcelAccessList.Add(entry); | 6665 | if (e.AgentID == key && e.Flags == AccessList.Access) |
6666 | return true; | ||
6667 | return false; | ||
6668 | }) == -1) | ||
6669 | { | ||
6670 | entry.AgentID = key; | ||
6671 | entry.Flags = AccessList.Access; | ||
6672 | entry.Time = DateTime.Now.AddHours(hours); | ||
6673 | land.LandData.ParcelAccessList.Add(entry); | ||
6674 | } | ||
6666 | } | 6675 | } |
6667 | } | 6676 | } |
6668 | ScriptSleep(100); | 6677 | ScriptSleep(100); |
@@ -9493,7 +9502,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9493 | // according to the docs, this command only works if script owner and land owner are the same | 9502 | // according to the docs, this command only works if script owner and land owner are the same |
9494 | // lets add estate owners and gods, too, and use the generic permission check. | 9503 | // lets add estate owners and gods, too, and use the generic permission check. |
9495 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 9504 | ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9496 | if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return; | 9505 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return; |
9497 | 9506 | ||
9498 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? | 9507 | bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? |
9499 | byte loop = 0; | 9508 | byte loop = 0; |
@@ -9957,16 +9966,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9957 | { | 9966 | { |
9958 | m_host.AddScriptLPS(1); | 9967 | m_host.AddScriptLPS(1); |
9959 | UUID key; | 9968 | UUID key; |
9960 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 9969 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9961 | if (land.OwnerID == m_host.OwnerID) | 9970 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
9962 | { | 9971 | { |
9963 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 9972 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); |
9964 | if (UUID.TryParse(avatar, out key)) | 9973 | if (UUID.TryParse(avatar, out key)) |
9965 | { | 9974 | { |
9966 | entry.AgentID = key; | 9975 | if (land.LandData.ParcelAccessList.FindIndex( |
9967 | entry.Flags = AccessList.Ban; | 9976 | delegate(ParcelManager.ParcelAccessEntry e) |
9968 | entry.Time = DateTime.Now.AddHours(hours); | 9977 | { |
9969 | land.ParcelAccessList.Add(entry); | 9978 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9979 | return true; | ||
9980 | return false; | ||
9981 | }) == -1) | ||
9982 | { | ||
9983 | entry.AgentID = key; | ||
9984 | entry.Flags = AccessList.Ban; | ||
9985 | entry.Time = DateTime.Now.AddHours(hours); | ||
9986 | land.LandData.ParcelAccessList.Add(entry); | ||
9987 | } | ||
9970 | } | 9988 | } |
9971 | } | 9989 | } |
9972 | ScriptSleep(100); | 9990 | ScriptSleep(100); |
@@ -9976,19 +9994,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9976 | { | 9994 | { |
9977 | m_host.AddScriptLPS(1); | 9995 | m_host.AddScriptLPS(1); |
9978 | UUID key; | 9996 | UUID key; |
9979 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 9997 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9980 | if (land.OwnerID == m_host.OwnerID) | 9998 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) |
9981 | { | 9999 | { |
9982 | if (UUID.TryParse(avatar, out key)) | 10000 | if (UUID.TryParse(avatar, out key)) |
9983 | { | 10001 | { |
9984 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10002 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9985 | { | 10003 | delegate(ParcelManager.ParcelAccessEntry e) |
9986 | if (entry.AgentID == key && entry.Flags == AccessList.Access) | 10004 | { |
9987 | { | 10005 | if (e.AgentID == key && e.Flags == AccessList.Access) |
9988 | land.ParcelAccessList.Remove(entry); | 10006 | return true; |
9989 | break; | 10007 | return false; |
9990 | } | 10008 | }); |
9991 | } | 10009 | |
10010 | if (idx != -1) | ||
10011 | land.LandData.ParcelAccessList.RemoveAt(idx); | ||
9992 | } | 10012 | } |
9993 | } | 10013 | } |
9994 | ScriptSleep(100); | 10014 | ScriptSleep(100); |
@@ -9998,19 +10018,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9998 | { | 10018 | { |
9999 | m_host.AddScriptLPS(1); | 10019 | m_host.AddScriptLPS(1); |
10000 | UUID key; | 10020 | UUID key; |
10001 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10021 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
10002 | if (land.OwnerID == m_host.OwnerID) | 10022 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
10003 | { | 10023 | { |
10004 | if (UUID.TryParse(avatar, out key)) | 10024 | if (UUID.TryParse(avatar, out key)) |
10005 | { | 10025 | { |
10006 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10026 | int idx = land.LandData.ParcelAccessList.FindIndex( |
10007 | { | 10027 | delegate(ParcelManager.ParcelAccessEntry e) |
10008 | if (entry.AgentID == key && entry.Flags == AccessList.Ban) | 10028 | { |
10009 | { | 10029 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
10010 | land.ParcelAccessList.Remove(entry); | 10030 | return true; |
10011 | break; | 10031 | return false; |
10012 | } | 10032 | }); |
10013 | } | 10033 | |
10034 | if (idx != -1) | ||
10035 | land.LandData.ParcelAccessList.RemoveAt(idx); | ||
10014 | } | 10036 | } |
10015 | } | 10037 | } |
10016 | ScriptSleep(100); | 10038 | ScriptSleep(100); |