From 059f4b6a3a870fdbb246ed2a4109cbf28b58ca7d Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Tue, 25 Oct 2011 13:27:09 +0100 Subject: [PATCH 1/4] Implementing PRIM_LINK_TARGET, but only for setting params Signed-off-by: BlueWall --- .../Shared/Api/Implementation/LSL_Api.cs | 17 +++++++++++++---- .../Shared/Api/Runtime/LSL_Constants.cs | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b8e98784ca..fe8d358bae 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7014,10 +7014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - List parts = GetLinkParts(linknumber); - - foreach (SceneObjectPart part in parts) - SetPrimParams(part, rules); + setLinkPrimParams(linknumber, rules); ScriptSleep(200); } @@ -7026,6 +7023,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); + setLinkPrimParams(linknumber, rules); + } + + protected void setLinkPrimParams(int linknumber, LSL_List rules) + { List parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) @@ -7395,6 +7397,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation lr = rules.GetQuaternionItem(idx++); SetRot(part, Rot2Quaternion(lr)); break; + case (int)ScriptBaseClass.PRIM_LINK_TARGET: + if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. + return; + LSL_Integer new_linknumber = rules.GetLSLIntegerItem(idx++); + LSL_List new_rules = rules.GetSublist(idx, -1); + setLinkPrimParams((int)new_linknumber, new_rules); + return; } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 4b008a449e..50c18a8d57 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -321,6 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_NAME = 27; public const int PRIM_DESC = 28; public const int PRIM_ROT_LOCAL = 29; + public const int PRIM_LINK_TARGET = 34; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; From 66bdd2062812c5f2a3223395691df8c1034b8229 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 26 Oct 2011 08:33:17 -0400 Subject: [PATCH 2/4] Add some things to .gitignore to make the status cleaner --- .gitignore | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8d3f2b266f..0fd1e586cf 100644 --- a/.gitignore +++ b/.gitignore @@ -70,4 +70,20 @@ TAGS Makefile.local bin/.version compile.bat - +addon-modules +OpenSim/Data/Tests/test-results/ +OpenSim/Framework/Serialization/Tests/test-results/ +OpenSim/Framework/Servers/Tests/test-results/ +OpenSim/Framework/Tests/test-results/ +OpenSim/Region/ClientStack/Linden/Caps/test-results/ +OpenSim/Region/ClientStack/Linden/UDP/Tests/test-results/ +OpenSim/Region/CoreModules/test-results/ +OpenSim/Region/Framework/test-results/ +OpenSim/Region/OptionalModules/test-results/ +OpenSim/Region/Physics/BulletDotNETPlugin/ +OpenSim/Region/Physics/Manager/test-results/ +OpenSim/Region/Physics/OdePlugin/Tests/test-results/ +OpenSim/Region/ScriptEngine/test-results/ +OpenSim/Tests/Common/test-results/ +OpenSim/Tests/test-results/ +test-results/ From 9a28e7a4e0392ef0a5b890b4c1875a44af57a90c Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Wed, 26 Oct 2011 13:33:52 +0100 Subject: [PATCH 3/4] Implementation of PRIM_OMEGA, but only for setting Signed-off-by: BlueWall --- .../Shared/Api/Implementation/LSL_Api.cs | 21 +++++++++++++++---- .../Shared/Api/Runtime/LSL_Constants.cs | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fe8d358bae..82701ce636 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3325,12 +3325,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTargetOmega(LSL_Vector axis, double spinrate, double gain) { m_host.AddScriptLPS(1); - m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); - m_host.ScheduleTerseUpdate(); - m_host.SendTerseUpdateToAllClients(); - m_host.ParentGroup.HasGroupChanged = true; + TargetOmega(m_host, axis, spinrate, gain); } + protected void TargetOmega(SceneObjectPart part, LSL_Vector axis, double spinrate, double gain) + { + part.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); + part.ScheduleTerseUpdate(); + part.SendTerseUpdateToAllClients(); + part.ParentGroup.HasGroupChanged = true; + } + public LSL_Integer llGetStartParameter() { m_host.AddScriptLPS(1); @@ -7397,6 +7402,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Rotation lr = rules.GetQuaternionItem(idx++); SetRot(part, Rot2Quaternion(lr)); break; + case (int)ScriptBaseClass.PRIM_OMEGA: + if (remain < 3) + return; + LSL_Vector axis = rules.GetVector3Item(idx++); + LSL_Float spinrate = rules.GetLSLFloatItem(idx++); + LSL_Float gain = rules.GetLSLFloatItem(idx++); + TargetOmega(part, axis, (double)spinrate, (double)gain); + break; case (int)ScriptBaseClass.PRIM_LINK_TARGET: if (remain < 3) // setting to 3 on the basis that parsing any usage of PRIM_LINK_TARGET that has nothing following it is pointless. return; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 50c18a8d57..ce4661cf65 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -321,6 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PRIM_NAME = 27; public const int PRIM_DESC = 28; public const int PRIM_ROT_LOCAL = 29; + public const int PRIM_OMEGA = 32; public const int PRIM_LINK_TARGET = 34; public const int PRIM_TEXGEN_DEFAULT = 0; public const int PRIM_TEXGEN_PLANAR = 1; From 41395d544386fbee2d26909a590d4fa9720fdf5f Mon Sep 17 00:00:00 2001 From: Michelle Argus Date: Wed, 26 Oct 2011 15:03:10 +0200 Subject: [PATCH 4/4] Added optional owner classes to existing OSSL agent Permissions PARCEL_GROUP, PARCEL_OWNER, ESTATE_MANAGER and REGION_OWNER can be combined with the existing agent uuid option to limit ossl functions to agents and owner classes. Signed-off-by: BlueWall --- .../Shared/Api/Implementation/OSSL_Api.cs | 67 +++++++++++++++++-- bin/OpenSim.ini.example | 7 ++ bin/OpenSimDefaults.ini | 7 ++ 3 files changed, 75 insertions(+), 6 deletions(-) mode change 100644 => 100755 bin/OpenSim.ini.example diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 52d787db0c..3cfc3c94f1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -113,11 +113,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { public List AllowedCreators; public List AllowedOwners; + public List AllowedOwnerClasses; public FunctionPerms() { AllowedCreators = new List(); AllowedOwners = new List(); + AllowedOwnerClasses = new List(); } } @@ -245,6 +247,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Default behavior perms.AllowedOwners = null; perms.AllowedCreators = null; + perms.AllowedOwnerClasses = null; } else { @@ -265,12 +268,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (string id in ids) { string current = id.Trim(); - UUID uuid; - - if (UUID.TryParse(current, out uuid)) + if (current.ToUpper() == "PARCEL_GROUP_MEMBER" || current.ToUpper() == "PARCEL_OWNER" || current.ToUpper() == "ESTATE_MANAGER" || current.ToUpper() == "ESTATE_OWNER") { - if (uuid != UUID.Zero) - perms.AllowedOwners.Add(uuid); + if (!perms.AllowedOwnerClasses.Contains(current)) + perms.AllowedOwnerClasses.Add(current.ToUpper()); + } + else + { + UUID uuid; + + if (UUID.TryParse(current, out uuid)) + { + if (uuid != UUID.Zero) + perms.AllowedOwners.Add(uuid); + } } } @@ -326,11 +337,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api String.Format("{0} permission error. Can't find script in prim inventory.", function)); } + + UUID ownerID = ti.OwnerID; + + //OSSL only may be used if objet is in the same group as the parcel + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_GROUP_MEMBER")) + { + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.LandData.GroupID == ti.GroupID && land.LandData.GroupID != UUID.Zero) + { + return; + } + } + + //Only Parcelowners may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("PARCEL_OWNER")) + { + ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); + + if (land.LandData.OwnerID == ownerID) + { + return; + } + } + + //Only Estate Managers may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_MANAGER")) + { + //Only Estate Managers may use the function + if (World.RegionInfo.EstateSettings.IsEstateManager(ownerID) && World.RegionInfo.EstateSettings.EstateOwner != ownerID) + { + return; + } + } + + //Only regionowners may use the function + if (m_FunctionPerms[function].AllowedOwnerClasses.Contains("ESTATE_OWNER")) + { + if (World.RegionInfo.EstateSettings.EstateOwner == ownerID) + { + return; + } + } + if (!m_FunctionPerms[function].AllowedCreators.Contains(ti.CreatorID)) OSSLError( String.Format("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", function)); - if (ti.CreatorID != ti.OwnerID) + if (ti.CreatorID != ownerID) { if ((ti.CurrentPermissions & (uint)PermissionMask.Modify) != 0) OSSLError( diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example old mode 100644 new mode 100755 index 44da31cb86..80f4c0ed92 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -617,6 +617,13 @@ ; Comma separated list of UUIDS allows the function for that list of UUIDS ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb + + ; Comma separated list of owner classes that allow the function for a particular class of owners. Choices are + ; - PARCEL_GROUP_MEMBER: allow if objectgroup is the same group as the parcel + ; - PARCEL_OWNER: allow if the objectowner is parcelowner + ; - ESTATE_MANAGER: allow if the object owner is a estate manager + ; - ESTATE_OWNER: allow if objectowner is estateowner + ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb, PARCEL_OWNER, ESTATE_OWNER>, ... ; You can also use script creators as the uuid ; Creators_osSetRegionWaterHeight = , ... diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 7df4357800..16ce1256aa 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1196,6 +1196,13 @@ ; Comma separated list of UUIDS allows the function for that list of UUIDS ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb + + ; Comma separated list of owner classes that allow the function for a particular class of owners. Choices are + ; - PARCEL_GROUP_MEMBER: allow if objectgroup is the same group as the parcel + ; - PARCEL_OWNER: allow if the objectowner is parcelowner + ; - ESTATE_MANAGER: allow if the object owner is a estate manager + ; - ESTATE_OWNER: allow if objectowner is estateowner + ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb, PARCEL_OWNER, ESTATE_OWNER>, ... ; You can also use script creators as the uuid ; Creators_osSetRegionWaterHeight = , ...