osSetParcelDetails: place hard restrictions on change owner,claimdate (both estate owner or manager) and group (same plus parcel owner that also needes to be a member of the new group); add PARCEL_DETAILS_SEE_AVATARS, PARCEL_DETAILS_ANY_AVATAR_SOUNDS and PARCEL_DETAILS_GROUP_SOUNDS

0.9.0-post-fixes
UbitUmarov 2017-07-12 01:44:34 +01:00
parent f5324833ee
commit c8a9b0321f
3 changed files with 103 additions and 19 deletions

View File

@ -1606,13 +1606,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false))
{ {
OSSLShoutError("You do not have permission to modify the parcel"); OSSLShoutError("script owner does not have permission to modify the parcel");
return; return;
} }
// Create a new land data object we can modify // Create a new land data object we can modify
LandData newLand = startLandObject.LandData.Copy(); LandData newLand = startLandObject.LandData.Copy();
UUID uuid; UUID uuid;
EstateSettings es = World.RegionInfo.EstateSettings;
bool changed = false;
// Process the rules, not sure what the impact would be of changing owner or group // Process the rules, not sure what the impact would be of changing owner or group
for (int idx = 0; idx < rules.Length;) for (int idx = 0; idx < rules.Length;)
@ -1622,34 +1625,114 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
switch (code) switch (code)
{ {
case ScriptBaseClass.PARCEL_DETAILS_NAME: case ScriptBaseClass.PARCEL_DETAILS_NAME:
if(newLand.Name != arg)
{
newLand.Name = arg; newLand.Name = arg;
changed = true;
}
break; break;
case ScriptBaseClass.PARCEL_DETAILS_DESC: case ScriptBaseClass.PARCEL_DETAILS_DESC:
if(newLand.Description != arg)
{
newLand.Description = arg; newLand.Description = arg;
changed = true;
}
break; break;
case ScriptBaseClass.PARCEL_DETAILS_OWNER: case ScriptBaseClass.PARCEL_DETAILS_OWNER:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName); if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID))
{
OSSLError("script owner does not have permission to modify the parcel owner");
}
else
{
if (UUID.TryParse(arg, out uuid)) if (UUID.TryParse(arg, out uuid))
{
if(newLand.OwnerID != uuid)
{
changed = true;
newLand.OwnerID = uuid; newLand.OwnerID = uuid;
newLand.GroupID = UUID.Zero;
}
}
}
break; break;
case ScriptBaseClass.PARCEL_DETAILS_GROUP: case ScriptBaseClass.PARCEL_DETAILS_GROUP:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName); if(m_host.OwnerID == newLand.OwnerID || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID))
{
if (UUID.TryParse(arg, out uuid)) if (UUID.TryParse(arg, out uuid))
{
if(newLand.GroupID != uuid)
{
IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>();
GroupMembershipData member = null;
if (groupsModule != null)
member = groupsModule.GetMembershipData(uuid, newLand.OwnerID);
if (member == null)
OSSLError(string.Format("land owner is not member of the new group for parcel"));
else
{
changed = true;
newLand.GroupID = uuid; newLand.GroupID = uuid;
}
}
}
}
else
{
OSSLError("script owner does not have permission to modify the parcel group");
}
break; break;
case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE: case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE:
CheckThreatLevel(ThreatLevel.VeryHigh, functionName); if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID))
newLand.ClaimDate = Convert.ToInt32(arg); {
if (newLand.ClaimDate == 0) OSSLError("script owner does not have permission to modify the parcel CLAIM DATE");
newLand.ClaimDate = Util.UnixTimeSinceEpoch(); }
else
{
int date = Convert.ToInt32(arg);
if (date == 0)
date = Util.UnixTimeSinceEpoch();
if(newLand.ClaimDate != date)
{
changed = true;
newLand.ClaimDate = date;
}
}
break;
case ScriptBaseClass.PARCEL_DETAILS_SEE_AVATARS:
bool newavs = (Convert.ToInt32(arg) != 0);
if(newLand.SeeAVs != newavs)
{
changed = true;
newLand.SeeAVs = newavs;
}
break;
case ScriptBaseClass.PARCEL_DETAILS_ANY_AVATAR_SOUNDS:
bool newavsounds = (Convert.ToInt32(arg) != 0);
if(newLand.AnyAVSounds != newavsounds)
{
changed = true;
newLand.AnyAVSounds = newavsounds;
}
break;
case ScriptBaseClass.PARCEL_DETAILS_GROUP_SOUNDS:
bool newgrpsounds = (Convert.ToInt32(arg) != 0);
if(newLand.GroupAVSounds != newgrpsounds)
{
changed = true;
newLand.GroupAVSounds = newgrpsounds;
}
break; break;
} }
} }
if(changed)
World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); World.LandChannel.UpdateLandObject(newLand.LocalID,newLand);
} }

View File

@ -697,7 +697,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PARCEL_DETAILS_GROUP = 3; public const int PARCEL_DETAILS_GROUP = 3;
public const int PARCEL_DETAILS_AREA = 4; public const int PARCEL_DETAILS_AREA = 4;
public const int PARCEL_DETAILS_ID = 5; public const int PARCEL_DETAILS_ID = 5;
public const int PARCEL_DETAILS_SEE_AVATARS = 6; // not implemented public const int PARCEL_DETAILS_SEE_AVATARS = 6;
public const int PARCEL_DETAILS_ANY_AVATAR_SOUNDS = 7;
public const int PARCEL_DETAILS_GROUP_SOUNDS = 8;
//osSetParcelDetails //osSetParcelDetails
public const int PARCEL_DETAILS_CLAIMDATE = 10; public const int PARCEL_DETAILS_CLAIMDATE = 10;

View File

@ -39,7 +39,6 @@ using OMV_Quaternion = OpenMetaverse.Quaternion;
namespace OpenSim.Region.ScriptEngine.Shared namespace OpenSim.Region.ScriptEngine.Shared
{ {
[Serializable]
public partial class LSL_Types public partial class LSL_Types
{ {
// Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain // Types are kept is separate .dll to avoid having to add whatever .dll it is in it to script AppDomain
@ -526,7 +525,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
} }
[Serializable] [Serializable]
public class list public class list: MarshalByRefObject
{ {
private object[] m_data; private object[] m_data;