From fb42845bee508e5d411af78263262fe5fd677d82 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 8 Jan 2017 11:15:39 +0000
Subject: mantis 8117: fix llSetPhysicsMaterial, using proper LSL_float type
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++---
OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +-
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ad7fc6c..45bdb41 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8849,10 +8849,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
public void llSetPhysicsMaterial(int material_bits,
- float material_gravity_modifier, float material_restitution,
- float material_friction, float material_density)
+ LSL_Float material_gravity_modifier, LSL_Float material_restitution,
+ LSL_Float material_friction, LSL_Float material_density)
{
- SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier);
+ SetPhysicsMaterial(m_host, material_bits, (float)material_density, (float)material_friction, (float)material_restitution, (float)material_gravity_modifier);
}
// vector up using libomv (c&p from sop )
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index cc52403..9766f77 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -434,7 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llXorBase64Strings(string str1, string str2);
LSL_String llXorBase64StringsCorrect(string str1, string str2);
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
- void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density);
+ void llSetPhysicsMaterial(int material, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density);
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
void llSetKeyframedMotion(LSL_List frames, LSL_List options);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 1a42c3a..8d8ec08 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -2036,9 +2036,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetKeyframedMotion(frames, options);
}
- public void llSetPhysicsMaterial(int material_bits, float material_gravity_modifier, float material_restitution, float material_friction, float material_density)
+ public void llSetPhysicsMaterial(int material, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density)
{
- m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density);
+ m_LSL_Functions.llSetPhysicsMaterial(material, material_gravity_modifier, material_restitution, material_friction, material_density);
}
public LSL_List llGetPhysicsMaterial()
--
cgit v1.1
From da69bc5da6703e8d907c486d65ac60eb68cdb6db Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 8 Jan 2017 11:28:34 +0000
Subject: restore argument name material_bits
---
OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +-
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 9766f77..17c977f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -434,7 +434,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String llXorBase64Strings(string str1, string str2);
LSL_String llXorBase64StringsCorrect(string str1, string str2);
LSL_Integer llGetLinkNumberOfSides(LSL_Integer link);
- void llSetPhysicsMaterial(int material, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density);
+ void llSetPhysicsMaterial(int material_bits, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density);
void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules, string originFunc);
void llSetKeyframedMotion(LSL_List frames, LSL_List options);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 8d8ec08..c39248b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -2036,9 +2036,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_LSL_Functions.llSetKeyframedMotion(frames, options);
}
- public void llSetPhysicsMaterial(int material, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density)
+ public void llSetPhysicsMaterial(int material_bits, LSL_Float material_gravity_modifier, LSL_Float material_restitution, LSL_Float material_friction, LSL_Float material_density)
{
- m_LSL_Functions.llSetPhysicsMaterial(material, material_gravity_modifier, material_restitution, material_friction, material_density);
+ m_LSL_Functions.llSetPhysicsMaterial(material_bits, material_gravity_modifier, material_restitution, material_friction, material_density);
}
public LSL_List llGetPhysicsMaterial()
--
cgit v1.1
From 90dee2fce6a90cb38a5a9f08b5f739db53aa277c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 8 Jan 2017 12:30:50 +0000
Subject: try to improve option automatic_gods processing
---
OpenSim/Region/Framework/Scenes/GodController.cs | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs
index 7ed80f6..9372366 100644
--- a/OpenSim/Region/Framework/Scenes/GodController.cs
+++ b/OpenSim/Region/Framework/Scenes/GodController.cs
@@ -246,17 +246,14 @@ namespace OpenSim.Region.Framework.Scenes
{
bool newstate = false;
if(m_forceGodModeAlwaysOn)
- newstate = true;
- else
+ newstate = m_viewergodlevel >= 200;
+ if(state != null)
{
- if(state != null)
- {
- OSDMap s = (OSDMap)state;
+ OSDMap s = (OSDMap)state;
- if (s.ContainsKey("ViewerUiIsGod"))
- newstate = s["ViewerUiIsGod"].AsBoolean();
- m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default
- }
+ if (s.ContainsKey("ViewerUiIsGod"))
+ newstate = s["ViewerUiIsGod"].AsBoolean();
+ m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default
}
UpdateGodLevels(newstate);
}
@@ -264,6 +261,11 @@ namespace OpenSim.Region.Framework.Scenes
public void HasMovedAway()
{
m_lastLevelToViewer = 0;
+ if(m_forceGodModeAlwaysOn)
+ {
+ m_viewergodlevel = m_rightsGodLevel;
+ m_godlevel = m_rightsGodLevel;
+ }
}
public int UserLevel
--
cgit v1.1
From e3f7c27c93823fca19d1513e94f03e3e2e1b3a5b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 10 Jan 2017 23:45:19 +0000
Subject: remove obsolete PrimFlags.ObjectYouOfficer; rearrange
GenerateClientFlags(...) with changes: allow estatemanager to move other ppl
objects to help solve placement disputes; exclude attachments on that and
from same group members
---
.../World/Permissions/PermissionsModule.cs | 111 ++++++++++-----------
.../Region/Framework/Scenes/Scene.Permissions.cs | 3 +-
2 files changed, 52 insertions(+), 62 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 75d90f3..1bb5181 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -605,19 +605,28 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
#region Object Permissions
+#pragma warning disable 0612
+ const uint NOT_DEFAULT_FLAGS = (uint)~(
+ PrimFlags.ObjectCopy | // Tells client you can copy the object
+ PrimFlags.ObjectModify | // tells client you can modify the object
+ PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
+ PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
+ PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
+ PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
+ PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
+ );
+#pragma warning restore 0612
+
+ const uint EXTRAOWNERMASK = (uint)(
+ PrimFlags.ObjectYouOwner |
+ PrimFlags.ObjectAnyOwner |
+ PrimFlags.ObjectOwnerModify
+ );
public uint GenerateClientFlags(UUID user, UUID objID)
{
- // Here's the way this works,
// ObjectFlags and Permission flags are two different enumerations
- // ObjectFlags, however, tells the client to change what it will allow the user to do.
- // So, that means that all of the permissions type ObjectFlags are /temporary/ and only
- // supposed to be set when customizing the objectflags for the client.
-
- // These temporary objectflags get computed and added in this function based on the
- // Permission mask that's appropriate!
- // Outside of this method, they should never be added to objectflags!
- // -teravus
+ // ObjectFlags, tells the client what it will allow the user to do.
SceneObjectPart task = m_scene.GetSceneObjectPart(objID);
@@ -626,52 +635,46 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return (uint)0;
uint objflags = task.GetEffectiveObjectFlags();
- UUID objectOwner = task.OwnerID;
-
-
+
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
- // libomv will moan about PrimFlags.ObjectYouOfficer being
- // deprecated
-#pragma warning disable 0612
- objflags &= (uint)
- ~(PrimFlags.ObjectCopy | // Tells client you can copy the object
- PrimFlags.ObjectModify | // tells client you can modify the object
- PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
- PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
- PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
- PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
- PrimFlags.ObjectOwnerModify | // Tells client that you're the owner of the object
- PrimFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
- );
-#pragma warning restore 0612
-
- // Creating the three ObjectFlags options for this method to choose from.
- // Customize the OwnerMask
- uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
- objectOwnerMask |= (uint)PrimFlags.ObjectYouOwner | (uint)PrimFlags.ObjectAnyOwner | (uint)PrimFlags.ObjectOwnerModify;
-
- // Customize the GroupMask
- uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
-
- // Customize the EveryoneMask
- uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
- if (objectOwner != UUID.Zero)
- objectEveryoneMask |= (uint)PrimFlags.ObjectAnyOwner;
+ objflags &= NOT_DEFAULT_FLAGS;
+ // get a relevant class for current user on task
PermissionClass permissionClass = GetPermissionClass(user, task);
+ // handle acording
+ uint returnMask = 0;
switch (permissionClass)
{
case PermissionClass.Owner:
- return objectOwnerMask;
+ // Customize the OwnerMask
+ // on next line EveryoneMask possible is redundant
+ // but then it should also be on GroupMask
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask | task.EveryoneMask, objflags);
+ returnMask |= EXTRAOWNERMASK;
+ break;
+
case PermissionClass.Group:
- return objectGroupMask | objectEveryoneMask;
+ // Customize the GroupMask
+ returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags);
+ if (task.OwnerID != UUID.Zero)
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ break;
+
case PermissionClass.Everyone:
default:
- return objectEveryoneMask;
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ if (task.OwnerID != UUID.Zero)
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+
+ // allow estatemanagers to move prims to help solve disputes
+ if(!task.ParentGroup.IsAttachment && IsEstateManager(user))
+ returnMask |= (uint)PrimFlags.ObjectMove;
+ break;
}
+ return returnMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
@@ -715,31 +718,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (user == objectOwner)
return PermissionClass.Owner;
- if (IsFriendWithPerms(user, objectOwner) && !obj.ParentGroup.IsAttachment)
- return PermissionClass.Owner;
-
- // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set
- if (m_RegionOwnerIsGod && IsEstateManager(user) && !IsAdministrator(objectOwner))
- return PermissionClass.Owner;
-
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
return PermissionClass.Owner;
-/* to review later
- // Users should be able to edit what is over their land.
- Vector3 taskPos = obj.AbsolutePosition;
- ILandObject parcel = m_scene.LandChannel.GetLandObject(taskPos.X, taskPos.Y);
- if (parcel != null && parcel.LandData.OwnerID == user && m_ParcelOwnerIsGod)
+ if(!obj.ParentGroup.IsAttachment)
{
- // Admin objects should not be editable by the above
- if (!IsAdministrator(objectOwner))
+ if (IsFriendWithPerms(user, objectOwner) )
return PermissionClass.Owner;
+
+ // Group permissions
+ if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0))
+ return PermissionClass.Group;
}
-*/
- // Group permissions
- if ((obj.GroupID != UUID.Zero) && IsGroupMember(obj.GroupID, user, 0))
- return PermissionClass.Group;
return PermissionClass.Everyone;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 893b38c..e97e494 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -179,8 +179,7 @@ namespace OpenSim.Region.Framework.Scenes
PrimFlags.ObjectTransfer |
PrimFlags.ObjectYouOwner |
PrimFlags.ObjectAnyOwner |
- PrimFlags.ObjectOwnerModify |
- PrimFlags.ObjectYouOfficer;
+ PrimFlags.ObjectOwnerModify;
#pragma warning restore 0612
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
--
cgit v1.1
From e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 11 Jan 2017 01:02:57 +0000
Subject: change GenerateClientFlags(...) to work with a scenepresence; make
use of the new IsGod to check its God rights; remove the non standard estate
manager right to move other ppl prims i added on last commits; coment out a
test method i added sometime ago
---
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 23 +++++++-----
.../World/Permissions/PermissionsModule.cs | 43 ++++++++++++++++++----
.../Region/Framework/Scenes/Scene.Permissions.cs | 6 +--
3 files changed, 53 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index df34668..8ba1ba3 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4126,14 +4126,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Vector3 mycamera = Vector3.Zero;
Vector3 mypos = Vector3.Zero;
ScenePresence mysp = (ScenePresence)SceneAgent;
- if(mysp != null && !mysp.IsDeleted)
+
+ // we should have a presence
+ if(mysp == null)
+ return;
+
+ if(doCulling)
{
cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
// mycamera = mysp.CameraPosition;
mypos = mysp.AbsolutePosition;
}
- else
- doCulling = false;
while (maxUpdatesBytes > 0)
{
@@ -4330,7 +4333,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (update.Entity is ScenePresence)
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
else
- ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
+ ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
objectUpdateBlocks.Add(ablock);
objectUpdates.Value.Add(update);
maxUpdatesBytes -= ablock.Length;
@@ -4462,6 +4465,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// hack.. dont use
+/*
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
{
if (ent is SceneObjectPart)
@@ -4472,7 +4476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
- ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId);
+ ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
if (parentID.HasValue)
{
blk.ParentID = parentID.Value;
@@ -4488,7 +4492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
//
}
-
+*/
public void ReprioritizeUpdates()
{
lock (m_entityUpdates.SyncRoot)
@@ -5726,7 +5730,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return update;
}
- protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
+// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
+ protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, ScenePresence sp)
{
byte[] objectData = new byte[60];
data.RelativePosition.ToBytes(objectData, 0);
@@ -5826,12 +5831,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region PrimFlags
- PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(recipientID, data.UUID);
+ PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(sp, data.UUID);
// Don't send the CreateSelected flag to everyone
flags &= ~PrimFlags.CreateSelected;
- if (recipientID == data.OwnerID)
+ if (sp.UUID == data.OwnerID)
{
if (data.CreateSelected)
{
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 1bb5181..495da8b 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -623,7 +623,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectOwnerModify
);
- public uint GenerateClientFlags(UUID user, UUID objID)
+ public uint GenerateClientFlags(ScenePresence sp, UUID objID)
{
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, tells the client what it will allow the user to do.
@@ -641,8 +641,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
objflags &= NOT_DEFAULT_FLAGS;
- // get a relevant class for current user on task
- PermissionClass permissionClass = GetPermissionClass(user, task);
+ // get a relevant class for current presence on task
+ PermissionClass permissionClass = GetPermissionClass(sp, task);
// handle acording
uint returnMask = 0;
@@ -668,10 +668,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
if (task.OwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
-
- // allow estatemanagers to move prims to help solve disputes
- if(!task.ParentGroup.IsAttachment && IsEstateManager(user))
- returnMask |= (uint)PrimFlags.ObjectMove;
break;
}
return returnMask;
@@ -705,6 +701,39 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return objectFlagsMask;
}
+ private PermissionClass GetPermissionClass(ScenePresence sp, SceneObjectPart obj)
+ {
+ if (obj == null || sp == null)
+ return PermissionClass.Everyone;
+
+ if (m_bypassPermissions)
+ return PermissionClass.Owner;
+
+
+ if (sp.IsGod)
+ return PermissionClass.Owner;
+
+ UUID user = sp.UUID;
+
+ // Object owners should be able to edit their own content
+ UUID objectOwner = obj.OwnerID;
+ if (user == objectOwner)
+ return PermissionClass.Owner;
+
+ if(!obj.ParentGroup.IsAttachment)
+ {
+ if (IsFriendWithPerms(user, objectOwner) )
+ return PermissionClass.Owner;
+
+ // Group permissions
+ if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0))
+ return PermissionClass.Group;
+ }
+
+ return PermissionClass.Everyone;
+ }
+
+ // OARs need this method that handles offline users
public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj)
{
if (obj == null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e97e494..c4cb6c7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes
{
#region Delegates
- public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID);
+ public delegate uint GenerateClientFlagsHandler(ScenePresence sp, UUID objectID);
public delegate void SetBypassPermissionsHandler(bool value);
public delegate bool BypassPermissionsHandler();
public delegate bool PropagatePermissionsHandler();
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Object Permission Checks
- public uint GenerateClientFlags(UUID userID, UUID objectID)
+ public uint GenerateClientFlags(ScenePresence sp, UUID objectID)
{
// libomv will moan about PrimFlags.ObjectYouOfficer being
// obsolete...
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
foreach (GenerateClientFlagsHandler check in list)
{
- perms &= check(userID, objectID);
+ perms &= check(sp, objectID);
}
}
return perms;
--
cgit v1.1
From 1253f193251d65da24ea081cbe207c9cbd1318ac Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 11 Jan 2017 17:10:29 +0000
Subject: more changes to GenerateClientFlags(), use already cached presence
group information, let it be aware of groups roles. (not exactly as the other
grid)
---
.../World/Permissions/PermissionsModule.cs | 68 +++++++++++++++++++---
.../Region/Framework/Scenes/Scene.Permissions.cs | 4 +-
2 files changed, 62 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 495da8b..8fcf44f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -480,6 +480,31 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
+ private bool CheckGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask)
+ {
+ if(sp == null || sp.ControllingClient == null)
+ return false;
+
+ ulong grpPowers = sp.ControllingClient.GetGroupPowers(groupID);
+
+ return (grpPowers & powersMask) != 0;
+ }
+
+ private bool CheckActiveGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask)
+ {
+ if(sp == null || sp.ControllingClient == null)
+ return false;
+
+ if(sp.ControllingClient.ActiveGroupId != groupID)
+ return false;
+ // activeGroupPowers only get current selected role powers, at least with xmlgroups.
+ // lets get any role avoiding the extra burden of user also having to change role
+ // ulong grpPowers = sp.ControllingClient.ActiveGroupPowers(groupID);
+ ulong grpPowers = sp.ControllingClient.GetGroupPowers(groupID);
+
+ return (grpPowers & powersMask) != 0;
+ }
+
///
/// Parse a user set configuration setting
///
@@ -623,7 +648,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectOwnerModify
);
- public uint GenerateClientFlags(ScenePresence sp, UUID objID)
+ public uint GenerateClientFlags(ScenePresence sp, uint curEffectivePerms, UUID objID)
{
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, tells the client what it will allow the user to do.
@@ -634,12 +659,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (task == null)
return (uint)0;
- uint objflags = task.GetEffectiveObjectFlags();
+ if(curEffectivePerms == 0)
+ return 0;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
-
- objflags &= NOT_DEFAULT_FLAGS;
+ uint objflags = curEffectivePerms & NOT_DEFAULT_FLAGS ;
// get a relevant class for current presence on task
PermissionClass permissionClass = GetPermissionClass(sp, task);
@@ -658,9 +683,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions
case PermissionClass.Group:
// Customize the GroupMask
- returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags);
- if (task.OwnerID != UUID.Zero)
- returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ if(task.GroupID == task.OwnerID)
+ {
+ // object is owned by group, owner rights do apply
+ // we are not limiting to group owned parcel so this work anywhere
+ if(CheckGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
+ // instead forcing active group can be safeguard againts casual mistakes ??
+ //if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
+ {
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask | task.EveryoneMask, objflags);
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectAnyOwner;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ }
+ else
+ {
+ // no special rights
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ }
+ }
+ else
+ {
+ // not group owned, group sharing rights apply
+ returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags);
+ if (task.OwnerID != UUID.Zero)
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ }
break;
case PermissionClass.Everyone:
@@ -726,7 +777,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return PermissionClass.Owner;
// Group permissions
- if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0))
+ // in future group membership must leave llclentViewer, but for now it is there.
+ if (obj.GroupID != UUID.Zero && sp.ControllingClient != null && sp.ControllingClient.IsGroupMember(obj.GroupID))
return PermissionClass.Group;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index c4cb6c7..e045c43 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes
{
#region Delegates
- public delegate uint GenerateClientFlagsHandler(ScenePresence sp, UUID objectID);
+ public delegate uint GenerateClientFlagsHandler(ScenePresence sp, uint curEffectivePerms, UUID objectID);
public delegate void SetBypassPermissionsHandler(bool value);
public delegate bool BypassPermissionsHandler();
public delegate bool PropagatePermissionsHandler();
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
foreach (GenerateClientFlagsHandler check in list)
{
- perms &= check(sp, objectID);
+ perms &= check(sp, perms, objectID);
}
}
return perms;
--
cgit v1.1
From 386a8136c916a14c4d484da03bbfe86bf946ee1b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 11 Jan 2017 18:41:06 +0000
Subject: don't let object lastowner be its group
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5928764..bf991c6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2233,7 +2233,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part.OwnerID != userId)
{
- part.LastOwnerID = part.OwnerID;
+ if(part.GroupID != part.OwnerID)
+ part.LastOwnerID = part.OwnerID;
part.OwnerID = userId;
}
});
--
cgit v1.1
From 0d538cb24ce9d9e05e721eedd9761106a45d1fdb Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 11 Jan 2017 22:47:31 +0000
Subject: stop using a GetPermissionClass() in GenerateClientFlags since it is
not good enough, just process the several cases inline
---
.../World/Permissions/PermissionsModule.cs | 213 +++++++++++----------
1 file changed, 116 insertions(+), 97 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 8fcf44f..094da2b 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -479,7 +479,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
-
+/*
private bool CheckGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask)
{
if(sp == null || sp.ControllingClient == null)
@@ -504,7 +504,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return (grpPowers & powersMask) != 0;
}
-
+*/
///
/// Parse a user set configuration setting
///
@@ -631,96 +631,148 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#region Object Permissions
#pragma warning disable 0612
- const uint NOT_DEFAULT_FLAGS = (uint)~(
- PrimFlags.ObjectCopy | // Tells client you can copy the object
- PrimFlags.ObjectModify | // tells client you can modify the object
- PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
- PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
- PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
- PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
- PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
- );
+ const uint DEFAULT_FLAGS = (uint)~(
+ PrimFlags.ObjectCopy | // Tells client you can copy the object
+ PrimFlags.ObjectModify | // tells client you can modify the object
+ PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
+ PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
+ PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
+ PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
+ PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
+ );
+
+ const uint NOT_DEFAULT_FLAGS = (uint)~(
+ PrimFlags.ObjectCopy | // Tells client you can copy the object
+ PrimFlags.ObjectModify | // tells client you can modify the object
+ PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
+ PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
+ PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
+ PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
+ PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
+ );
#pragma warning restore 0612
- const uint EXTRAOWNERMASK = (uint)(
+ const uint EXTRAOWNERMASK = (uint)(
+ PrimFlags.ObjectYouOwner |
+ PrimFlags.ObjectAnyOwner
+ );
+
+ const uint EXTRAGODMASK = (uint)(
PrimFlags.ObjectYouOwner |
PrimFlags.ObjectAnyOwner |
- PrimFlags.ObjectOwnerModify
+ PrimFlags.ObjectOwnerModify |
+ PrimFlags.ObjectModify |
+ PrimFlags.ObjectMove
);
public uint GenerateClientFlags(ScenePresence sp, uint curEffectivePerms, UUID objID)
{
- // ObjectFlags and Permission flags are two different enumerations
- // ObjectFlags, tells the client what it will allow the user to do.
+ if(sp == null || curEffectivePerms == 0)
+ return (uint)0;
SceneObjectPart task = m_scene.GetSceneObjectPart(objID);
// this shouldn't ever happen.. return no permissions/objectflags.
if (task == null)
return (uint)0;
-
- if(curEffectivePerms == 0)
- return 0;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
- // in the next bit of code
uint objflags = curEffectivePerms & NOT_DEFAULT_FLAGS ;
- // get a relevant class for current presence on task
- PermissionClass permissionClass = GetPermissionClass(sp, task);
+ uint returnMask;
- // handle acording
- uint returnMask = 0;
- switch (permissionClass)
+ // gods have owner rights with Modify and Move always on
+ if(sp.IsGod)
{
- case PermissionClass.Owner:
- // Customize the OwnerMask
- // on next line EveryoneMask possible is redundant
- // but then it should also be on GroupMask
- returnMask = ApplyObjectModifyMasks(task.OwnerMask | task.EveryoneMask, objflags);
- returnMask |= EXTRAOWNERMASK;
- break;
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask |= EXTRAGODMASK;
+ return returnMask;
+ }
+
+ //bypass option == owner rights
+ if (m_bypassPermissions)
+ {
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask |= EXTRAOWNERMASK;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ return returnMask;
+ }
+
+ UUID taskOwnerID = task.OwnerID;
+ UUID spID = sp.UUID;
- case PermissionClass.Group:
- // Customize the GroupMask
- if(task.GroupID == task.OwnerID)
+ // owner
+ if (spID == taskOwnerID)
+ {
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask |= EXTRAOWNERMASK;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ return returnMask;
+ }
+
+ // if not god or owner, do attachments as everyone
+ if(task.ParentGroup.IsAttachment)
+ {
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ if (taskOwnerID != UUID.Zero)
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ return returnMask;
+ }
+
+ // if friends with rights then owner
+ if (IsFriendWithPerms(spID, taskOwnerID))
+ {
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask |= EXTRAOWNERMASK;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ return returnMask;
+ }
+
+ // group owned or shared ?
+ UUID taskGroupID = task.GroupID;
+ IClientAPI client = sp.ControllingClient;
+ if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID))
+ {
+ if(taskGroupID == taskOwnerID)
+ {
+ // object is owned by group, owner rights and group role powers do apply
+ if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0)
+ // instead forcing active group can be safeguard againts casual mistakes ??
+ //if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
{
- // object is owned by group, owner rights do apply
- // we are not limiting to group owned parcel so this work anywhere
- if(CheckGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
- // instead forcing active group can be safeguard againts casual mistakes ??
- //if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
- {
- returnMask = ApplyObjectModifyMasks(task.OwnerMask | task.EveryoneMask, objflags);
- returnMask |=
- (uint)PrimFlags.ObjectGroupOwned |
- (uint)PrimFlags.ObjectAnyOwner;
- if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
- returnMask |= (uint)PrimFlags.ObjectOwnerModify;
- }
- else
- {
- // no special rights
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
- returnMask |= (uint)PrimFlags.ObjectAnyOwner;
- }
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectAnyOwner;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ return returnMask;
}
else
{
- // not group owned, group sharing rights apply
- returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags);
- if (task.OwnerID != UUID.Zero)
- returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ // no special rights
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ return returnMask;
}
- break;
-
- case PermissionClass.Everyone:
- default:
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
- if (task.OwnerID != UUID.Zero)
+ }
+ else
+ {
+ // group sharing
+ returnMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
+ if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
- break;
+ return returnMask;
+ }
}
+
+ // fallback is everyone rights
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ if (taskOwnerID != UUID.Zero)
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
@@ -752,39 +804,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return objectFlagsMask;
}
- private PermissionClass GetPermissionClass(ScenePresence sp, SceneObjectPart obj)
- {
- if (obj == null || sp == null)
- return PermissionClass.Everyone;
-
- if (m_bypassPermissions)
- return PermissionClass.Owner;
-
-
- if (sp.IsGod)
- return PermissionClass.Owner;
-
- UUID user = sp.UUID;
-
- // Object owners should be able to edit their own content
- UUID objectOwner = obj.OwnerID;
- if (user == objectOwner)
- return PermissionClass.Owner;
-
- if(!obj.ParentGroup.IsAttachment)
- {
- if (IsFriendWithPerms(user, objectOwner) )
- return PermissionClass.Owner;
-
- // Group permissions
- // in future group membership must leave llclentViewer, but for now it is there.
- if (obj.GroupID != UUID.Zero && sp.ControllingClient != null && sp.ControllingClient.IsGroupMember(obj.GroupID))
- return PermissionClass.Group;
- }
-
- return PermissionClass.Everyone;
- }
-
// OARs need this method that handles offline users
public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj)
{
--
cgit v1.1
From 3e0a61915fef715c0c89ab5ec233dc217c335429 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 12 Jan 2017 16:58:59 +0000
Subject: GenerateClientFlags: consider locked state, change object group;
CanRezObject: remove odd elses and group roles are only for group owned land
---
.../World/Permissions/PermissionsModule.cs | 97 ++++++++++++----------
1 file changed, 52 insertions(+), 45 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 094da2b..b60cd93 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -592,10 +592,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
protected bool IsFriendWithPerms(UUID user, UUID objectOwner)
{
- if (user == UUID.Zero)
+ if (FriendsModule == null)
return false;
- if (FriendsModule == null)
+ if (user == UUID.Zero)
return false;
int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner);
@@ -684,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// gods have owner rights with Modify and Move always on
if(sp.IsGod)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
returnMask |= EXTRAGODMASK;
return returnMask;
}
@@ -692,20 +692,22 @@ namespace OpenSim.Region.CoreModules.World.Permissions
//bypass option == owner rights
if (m_bypassPermissions)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
return returnMask;
}
+ bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
+
UUID taskOwnerID = task.OwnerID;
UUID spID = sp.UUID;
// owner
if (spID == taskOwnerID)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
@@ -715,16 +717,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// if not god or owner, do attachments as everyone
if(task.ParentGroup.IsAttachment)
{
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
+ UUID taskGroupID = task.GroupID;
+ bool groupdOwned = taskOwnerID == taskGroupID;
+
// if friends with rights then owner
- if (IsFriendWithPerms(spID, taskOwnerID))
+ if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
@@ -732,18 +737,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
// group owned or shared ?
- UUID taskGroupID = task.GroupID;
IClientAPI client = sp.ControllingClient;
if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID))
{
- if(taskGroupID == taskOwnerID)
+ if(groupdOwned)
{
- // object is owned by group, owner rights and group role powers do apply
+ // object is owned by group, check role powers
if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0)
- // instead forcing active group can be safeguard againts casual mistakes ??
- //if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
returnMask |=
(uint)PrimFlags.ObjectGroupOwned |
(uint)PrimFlags.ObjectAnyOwner;
@@ -753,16 +755,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else
{
- // no special rights
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
- returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ // group sharing or everyone
+ returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
}
else
{
- // group sharing
- returnMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
+ // group sharing or everyone
+ returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
@@ -770,13 +774,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
// fallback is everyone rights
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
+ returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
- private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
+ private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool unlocked)
{
// We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client.
@@ -786,14 +790,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
objectFlagsMask |= (uint)PrimFlags.ObjectCopy;
}
- if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
+ if (unlocked)
{
- objectFlagsMask |= (uint)PrimFlags.ObjectMove;
- }
+ if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
+ {
+ objectFlagsMask |= (uint)PrimFlags.ObjectMove;
+ }
- if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
- {
- objectFlagsMask |= (uint)PrimFlags.ObjectModify;
+ if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
+ {
+ objectFlagsMask |= (uint)PrimFlags.ObjectModify;
+ }
}
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
@@ -1559,35 +1566,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
- if (m_bypassPermissions) return m_bypassPermissionsValue;
+ if (m_bypassPermissions)
+ return m_bypassPermissionsValue;
// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
- if (parcel == null)
+ if (parcel == null || parcel.LandData == null)
return false;
- if ((parcel.LandData.Flags & (uint)ParcelFlags.CreateObjects) != 0)
- {
- return true;
- }
- else if ((owner == parcel.LandData.OwnerID) || IsAdministrator(owner))
- {
+ LandData landdata = parcel.LandData;
+ if ((owner == landdata.OwnerID))
return true;
- }
- else if (((parcel.LandData.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
- && (parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, owner, 0))
- {
+
+ if ((landdata.Flags & (uint)ParcelFlags.CreateObjects) != 0)
return true;
- }
- else if (parcel.LandData.GroupID != UUID.Zero && IsGroupMember(parcel.LandData.GroupID, owner, (ulong)GroupPowers.AllowRez))
- {
+
+ if(IsAdministrator(owner))
return true;
- }
- else
+
+ if(landdata.GroupID != UUID.Zero)
{
- return false;
+ if ((landdata.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
+ return IsGroupMember(landdata.GroupID, owner, 0);
+
+ if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, owner, (ulong)GroupPowers.AllowRez))
+ return true;
}
+
+ return false;
}
private bool CanRunConsoleCommand(UUID user, Scene requestFromScene)
--
cgit v1.1
From 1984f316fc125d793ccf6cbea4f6ea7df9711d17 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 12 Jan 2017 17:15:36 +0000
Subject: Add permission CanChangeSelectedState replacing 2 calls to check Move
and Modify/edit. As those calls did, this controls changes to objects
selected state for edition (simulation hold etc).
---
OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 6 ++----
OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 14 ++++++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 2d62b50..e611897 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -183,8 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
part.SendFullUpdate(remoteClient);
// A prim is only tainted if it's allowed to be edited by the person clicking it.
- if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)
- || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId))
+ if (Permissions.CanChangeSelectedState(sog.UUID, (ScenePresence)remoteClient.SceneAgent))
{
part.IsSelected = true;
EventManager.TriggerParcelPrimCountTainted();
@@ -250,8 +249,7 @@ namespace OpenSim.Region.Framework.Scenes
// handled by group, but by prim. Legacy cruft.
// TODO: Make selection flagging per prim!
//
- if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)
- || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId))
+ if (Permissions.CanChangeSelectedState(part.ParentGroup.UUID, (ScenePresence)remoteClient.SceneAgent))
{
part.IsSelected = false;
if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e045c43..8f32b03 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -404,6 +404,20 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
+ #region persence EDIT or MOVE OBJECT
+ private const uint CANSELECTMASK = (uint)(
+ PrimFlags.ObjectMove |
+ PrimFlags.ObjectModify |
+ PrimFlags.ObjectOwnerModify
+ );
+
+ public bool CanChangeSelectedState(UUID objectID, ScenePresence sp)
+ {
+ uint perms = GenerateClientFlags(sp , objectID);
+ return (perms & CANSELECTMASK) != 0;
+ }
+
+ #endregion
#region EDIT OBJECT
public bool CanEditObject(UUID objectID, UUID editorID)
{
--
cgit v1.1
From da51edb5fe117b96d2a3761a3b735776c8cb05cb Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 13 Jan 2017 23:47:26 +0000
Subject: Fix the new permissions error introduced with the inventory fix
The fix to allow setting perms in inventory accidentally caused folded
permissions to be used as a mask for the next owner perms. The current
solution isn't optimal but better than anything else we have had.
Legacy objects may experience a net loss of permissions if trying to
set their perms in inventory, this is deemed preferable to the prior
privilege escalation possibility. New items will handle properly.
---
.../InventoryAccess/InventoryAccessModule.cs | 29 +++++++++++++-----
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 34 +++++++++++++++-------
2 files changed, 46 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 0104823..f8a2c2e 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -1124,7 +1124,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
if ((rootPart.OwnerID != item.Owner) ||
- (item.CurrentPermissions & 16) != 0 ||
+ (item.CurrentPermissions & 8) != 0 ||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
{
//Need to kill the for sale here
@@ -1142,22 +1142,37 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
part.RezzerID = item.Owner;
part.Inventory.ChangeInventoryOwner(item.Owner);
- // This applies the base mask from the item as the next
- // permissions for the object. This is correct because the
- // giver's base mask was masked by the giver's next owner
- // mask, so the base mask equals the original next owner mask.
- part.NextOwnerMask = item.BasePermissions;
+ // Reconstruct the original item's base permissions. They
+ // can be found in the lower (folded) bits.
+ if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0)
+ {
+ // We have permissions stored there so use them
+ part.NextOwnerMask = ((item.BasePermissions & 7) << 13);
+ if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0)
+ part.NextOwnerMask |= (uint)PermissionMask.Export;
+ part.NextOwnerMask |= (uint)PermissionMask.Move;
+ }
+ else
+ {
+ // This is a legacy object and we can't avoid the issues that
+ // caused perms loss or escalation before, treat it the legacy
+ // way.
+ part.NextOwnerMask = item.NextPermissions;
+ }
}
so.ApplyNextOwnerPermissions();
// In case the user has changed flags on a received item
// we have to apply those changes after the slam. Else we
- // get a net loss of permissions
+ // get a net loss of permissions.
+ // On legacy objects, this opts for a loss of permissions rather
+ // than the previous handling that allowed escalation.
foreach (SceneObjectPart part in so.Parts)
{
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
{
+ part.GroupMask = item.GroupPermissions & part.BaseMask;
part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index cb06540..0d09cef 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -647,7 +647,8 @@ namespace OpenSim.Region.Framework.Scenes
// Modify
uint permsMask = ~ ((uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer |
- (uint)PermissionMask.Modify);
+ (uint)PermissionMask.Modify |
+ (uint)PermissionMask.Export);
// Now, reduce the next perms to the mask bits
// relevant to the operation
@@ -677,6 +678,23 @@ namespace OpenSim.Region.Framework.Scenes
(uint)PermissionMask.Move;
uint ownerPerms = item.CurrentPermissions;
+ // These will be applied to the root prim at next rez.
+ // The legacy slam bit (bit 3) and folded permission (bits 0-2)
+ // are preserved due to the above mangling
+ ownerPerms &= nextPerms;
+
+ // Mask the base permissions. This is a conservative
+ // approach altering only the three main perms
+ basePerms &= nextPerms;
+
+ // Mask out the folded portion of the base mask.
+ // While the owner mask carries the actual folded
+ // permissions, the base mask carries the original
+ // base mask, before masking with the folded perms.
+ // We need this later for rezzing.
+ basePerms &= ~(uint)PermissionMask.FoldedMask;
+ basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
+
// If this is an object, root prim perms may be more
// permissive than folded perms. Use folded perms as
// a mask
@@ -684,6 +702,9 @@ namespace OpenSim.Region.Framework.Scenes
{
// Create a safe mask for the current perms
uint foldedPerms = (item.CurrentPermissions & 7) << 13;
+ if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0)
+ foldedPerms |= (uint)PermissionMask.Export;
+
foldedPerms |= permsMask;
bool isRootMod = (item.CurrentPermissions &
@@ -691,6 +712,8 @@ namespace OpenSim.Region.Framework.Scenes
true : false;
// Mask the owner perms to the folded perms
+ // Note that this is only to satisfy the viewer.
+ // The effect of this will be reversed on rez.
ownerPerms &= foldedPerms;
basePerms &= foldedPerms;
@@ -705,15 +728,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- // These will be applied to the root prim at next rez.
- // The slam bit (bit 3) and folded permission (bits 0-2)
- // are preserved due to the above mangling
- ownerPerms &= nextPerms;
-
- // Mask the base permissions. This is a conservative
- // approach altering only the three main perms
- basePerms &= nextPerms;
-
// Assign to the actual item. Make sure the slam bit is
// set, if it wasn't set before.
itemCopy.BasePermissions = basePerms;
--
cgit v1.1
From e263730ada2d42190143187ac037bbaeeb6d8df4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 14 Jan 2017 11:25:44 +0000
Subject: fix: send viewers the Everyone permitions of items inside other
objects
---
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 6557003..02b94ce 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1170,7 +1170,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (TaskInventoryItem item in m_items.Values)
{
UUID ownerID = item.OwnerID;
- uint everyoneMask = 0;
+ uint everyoneMask = item.EveryonePermissions;
uint baseMask = item.BasePermissions;
uint ownerMask = item.CurrentPermissions;
uint groupMask = item.GroupPermissions;
--
cgit v1.1
From fb86e415615ddfd917485daf5e4a4f2f0486359f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 14 Jan 2017 14:19:58 +0000
Subject: fix incoerent definition of Slam bit (bits 3 and 4 used in diferent
places.) this may still be wrong on other places; Do not loose folded
permitions, WARNING MASTER IS NOW UNSTABLE. permissions are still broken"
---
.../Framework/InventoryAccess/InventoryAccessModule.cs | 11 +++++++----
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index f8a2c2e..6fe7e89 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -605,15 +605,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
perms &= ~(uint)PermissionMask.Transfer;
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
perms &= ~(uint)PermissionMask.Modify;
-
- item.BasePermissions = perms & so.RootPart.NextOwnerMask;
+
+// item.BasePermissions = perms & so.RootPart.NextOwnerMask;
+
+ uint nextp = so.RootPart.NextOwnerMask | 0x0f;
+ item.BasePermissions = perms & nextp;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
// apply next owner perms on rez
- item.CurrentPermissions |= SceneObjectGroup.SLAM;
+ item.CurrentPermissions |= (uint)PermissionMask.Slam;
}
else
{
@@ -1124,7 +1127,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
if ((rootPart.OwnerID != item.Owner) ||
- (item.CurrentPermissions & 8) != 0 ||
+ (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 ||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
{
//Need to kill the for sale here
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bf991c6..3f531be 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -117,9 +117,6 @@ namespace OpenSim.Region.Framework.Scenes
NOT_STATUS_ROTATE_Z = 0xF7
}
- // This flag has the same purpose as InventoryItemFlags.ObjectSlamPerm
- public static readonly uint SLAM = 16;
-
// private PrimCountTaintedDelegate handlerPrimCountTainted = null;
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b8ac089..557b55e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -5181,7 +5181,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
/// The scene the prim is being rezzed into
public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
{
- if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
+ if ((OwnerID != item.Owner) || ((item.CurrentPermissions & (uint)PermissionMask.Slam) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
{
if (scene.Permissions.PropagatePermissions())
{
--
cgit v1.1
From 24d12dfba4b00e0a2e83f46646255793829dfca4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 14 Jan 2017 22:19:20 +0000
Subject: permissions GenerateClientFlags() also needs group
GetEffectivePermissions() for the everyone case. Current naive uncached
GetEffectivePermissions() must be improved since its now a lot more used.
---
.../CoreModules/World/Permissions/PermissionsModule.cs | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b60cd93..4d2bfe5 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -631,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#region Object Permissions
#pragma warning disable 0612
- const uint DEFAULT_FLAGS = (uint)~(
+ const uint DEFAULT_FLAGS = (uint)(
PrimFlags.ObjectCopy | // Tells client you can copy the object
PrimFlags.ObjectModify | // tells client you can modify the object
PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
@@ -701,6 +701,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
+ uint effectivePerms;
UUID taskOwnerID = task.OwnerID;
UUID spID = sp.UUID;
@@ -718,6 +719,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(task.ParentGroup.IsAttachment)
{
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
+ effectivePerms = task.ParentGroup.GetEffectivePermissions();
+ returnMask &= effectivePerms;
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
@@ -726,6 +729,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
UUID taskGroupID = task.GroupID;
bool groupdOwned = taskOwnerID == taskGroupID;
+
// if friends with rights then owner
if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{
@@ -753,9 +757,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
return returnMask;
}
- else
+ else if(task.GroupMask != 0)
{
- // group sharing or everyone
+ // group sharing
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
returnMask |=
(uint)PrimFlags.ObjectGroupOwned |
@@ -763,9 +767,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask;
}
}
- else
+ else if(task.GroupMask != 0)
{
- // group sharing or everyone
+ // group sharing
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
@@ -774,7 +778,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
// fallback is everyone rights
+ effectivePerms = task.ParentGroup.GetEffectivePermissions();
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
+ returnMask &= effectivePerms;
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
--
cgit v1.1
From 6eaa8948a6a10009d32730e93acfc4bf0097733f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 14 Jan 2017 23:23:56 +0000
Subject: bad move.. revert
---
.../CoreModules/World/Permissions/PermissionsModule.cs | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 4d2bfe5..b60cd93 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -631,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#region Object Permissions
#pragma warning disable 0612
- const uint DEFAULT_FLAGS = (uint)(
+ const uint DEFAULT_FLAGS = (uint)~(
PrimFlags.ObjectCopy | // Tells client you can copy the object
PrimFlags.ObjectModify | // tells client you can modify the object
PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
@@ -701,7 +701,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
- uint effectivePerms;
UUID taskOwnerID = task.OwnerID;
UUID spID = sp.UUID;
@@ -719,8 +718,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(task.ParentGroup.IsAttachment)
{
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
- effectivePerms = task.ParentGroup.GetEffectivePermissions();
- returnMask &= effectivePerms;
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
@@ -729,7 +726,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
UUID taskGroupID = task.GroupID;
bool groupdOwned = taskOwnerID == taskGroupID;
-
// if friends with rights then owner
if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{
@@ -757,9 +753,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
return returnMask;
}
- else if(task.GroupMask != 0)
+ else
{
- // group sharing
+ // group sharing or everyone
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
returnMask |=
(uint)PrimFlags.ObjectGroupOwned |
@@ -767,9 +763,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask;
}
}
- else if(task.GroupMask != 0)
+ else
{
- // group sharing
+ // group sharing or everyone
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
@@ -778,9 +774,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
// fallback is everyone rights
- effectivePerms = task.ParentGroup.GetEffectivePermissions();
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
- returnMask &= effectivePerms;
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
--
cgit v1.1
From b9e2606c2ff820369659940e4aafbcb55390794a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 15 Jan 2017 16:15:40 +0000
Subject: add code for fixing effective permitions. This is a test, and
currently too slow for prodution. just finding our way home
---
.../World/Permissions/PermissionsModule.cs | 39 +++--
.../Framework/Interfaces/IEntityInventory.cs | 5 +
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 177 +++++++++++++++++++++
.../Framework/Scenes/SceneObjectPartInventory.cs | 46 +++++-
4 files changed, 252 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b60cd93..dcf0c00 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -631,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#region Object Permissions
#pragma warning disable 0612
- const uint DEFAULT_FLAGS = (uint)~(
+ const uint DEFAULT_FLAGS = (uint)(
PrimFlags.ObjectCopy | // Tells client you can copy the object
PrimFlags.ObjectModify | // tells client you can modify the object
PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
@@ -665,6 +665,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectMove
);
+ const uint GOD_FLAGS = (uint)(
+ PrimFlags.ObjectCopy | // Tells client you can copy the object
+ PrimFlags.ObjectModify | // tells client you can modify the object
+ PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
+ PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
+ PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
+ PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
+ PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
+ );
+
public uint GenerateClientFlags(ScenePresence sp, uint curEffectivePerms, UUID objID)
{
if(sp == null || curEffectivePerms == 0)
@@ -684,22 +694,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// gods have owner rights with Modify and Move always on
if(sp.IsGod)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
- returnMask |= EXTRAGODMASK;
- return returnMask;
+// returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
+// returnMask |= EXTRAGODMASK;
+// return returnMask;
+ return objflags | GOD_FLAGS;
}
+ SceneObjectGroup grp = task.ParentGroup;
+ bool unlocked = (grp.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
+
//bypass option == owner rights
if (m_bypassPermissions)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
+ returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true); //??
returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
return returnMask;
}
- bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
UUID taskOwnerID = task.OwnerID;
UUID spID = sp.UUID;
@@ -707,7 +720,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// owner
if (spID == taskOwnerID)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
@@ -717,7 +730,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// if not god or owner, do attachments as everyone
if(task.ParentGroup.IsAttachment)
{
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveEveryOnePerms, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
@@ -729,7 +742,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// if friends with rights then owner
if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
@@ -745,7 +758,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// object is owned by group, check role powers
if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0)
{
- returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
returnMask |=
(uint)PrimFlags.ObjectGroupOwned |
(uint)PrimFlags.ObjectAnyOwner;
@@ -756,7 +769,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else
{
// group sharing or everyone
- returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
returnMask |=
(uint)PrimFlags.ObjectGroupOwned |
(uint)PrimFlags.ObjectAnyOwner;
@@ -766,7 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else
{
// group sharing or everyone
- returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
@@ -774,7 +787,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
// fallback is everyone rights
- returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveEveryOnePerms, objflags, unlocked);
if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 0c4017e..2af6ff0 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -278,6 +278,11 @@ namespace OpenSim.Region.Framework.Interfaces
///
void ProcessInventoryBackup(ISimulationDataService datastore);
+ void AggregateEveryOnePerms(ref uint current);
+ void AggregateGroupOrEveryonePerms(ref uint current);
+ void AggregateGroupPerms(ref uint current);
+ void AggregateOwnerPerms(ref uint current);
+
uint MaskEffectivePermissions();
void ApplyNextOwnerPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 9f98554..f44604b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -248,6 +248,183 @@ namespace OpenSim.Region.Framework.Scenes
return -1;
}
+ // new test code, to place in better place later
+ private object PermissionsLock = new object();
+
+ private uint m_EffectiveEveryOnePerms;
+ public uint EffectiveEveryOnePerms
+ {
+ get
+ {
+ // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
+ // bc this is on heavy duty code paths
+ // but for now we need to test the concept
+ AggregateEveryOnePerms();
+ return m_EffectiveEveryOnePerms;
+ }
+ }
+
+ public void AggregateEveryOnePerms()
+ {
+ lock(PermissionsLock)
+ {
+ // get object everyone permissions
+ uint baseperms = RootPart.EveryoneMask & (uint)PermissionMask.All;
+
+ if(baseperms == 0)
+ {
+ m_EffectiveEveryOnePerms = 0;
+ return;
+ }
+
+ uint current = baseperms;
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ {
+ SceneObjectPart part = parts[i];
+ part.Inventory.AggregateEveryOnePerms(ref current);
+ if( current == 0)
+ break;
+ }
+ // recover move
+ baseperms &= (uint)PermissionMask.Move;
+ current |= baseperms;
+ current &= (uint)PermissionMask.All;
+ m_EffectiveEveryOnePerms = current;
+ }
+ }
+
+ private uint m_EffectiveGroupPerms;
+ public uint EffectiveGroupPerms
+ {
+ get
+ {
+ // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
+ // bc this is on heavy duty code paths
+ // but for now we need to test the concept
+ AggregateGroupPerms();
+ return m_EffectiveGroupPerms;
+ }
+ }
+
+ public void AggregateGroupPerms()
+ {
+ lock(PermissionsLock)
+ {
+ // get object everyone permissions
+ uint baseperms = RootPart.GroupMask & (uint)PermissionMask.All;
+
+ if(baseperms == 0)
+ {
+ m_EffectiveGroupPerms = 0;
+ return;
+ }
+
+ uint current = baseperms;
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ {
+ SceneObjectPart part = parts[i];
+ part.Inventory.AggregateGroupPerms(ref current);
+ if( current == 0)
+ break;
+ }
+ // recover modify and move
+ baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
+ current |= baseperms;
+ current &= (uint)PermissionMask.All;
+ m_EffectiveGroupPerms = current;
+ }
+ }
+
+ private uint m_EffectiveGroupOrEveryOnePerms;
+ public uint EffectiveGroupOrEveryOnePerms
+ {
+ get
+ {
+ // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
+ // bc this is on heavy duty code paths
+ // but for now we need to test the concept
+ AggregateGroupOrEveryOnePerms();
+ return m_EffectiveGroupOrEveryOnePerms;
+ }
+ }
+
+ public void AggregateGroupOrEveryOnePerms()
+ {
+ lock(PermissionsLock)
+ {
+ // get object everyone permissions
+ uint baseperms = (RootPart.EveryoneMask | RootPart.GroupMask) & (uint)PermissionMask.All;
+
+ if(baseperms == 0)
+ {
+ m_EffectiveGroupOrEveryOnePerms = 0;
+ return;
+ }
+
+ uint current = baseperms;
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ {
+ SceneObjectPart part = parts[i];
+ part.Inventory.AggregateGroupOrEveryonePerms(ref current);
+ if( current == 0)
+ break;
+ }
+ // recover modify and move
+ baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
+ current |= baseperms;
+ current &= (uint)PermissionMask.All;
+ m_EffectiveGroupOrEveryOnePerms = current;
+ }
+ }
+
+ private uint m_EffectiveOwnerPerms;
+ public uint EffectiveOwnerPerms
+ {
+ get
+ {
+ // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
+ // bc this is on heavy duty code paths
+ // but for now we need to test the concept
+ AggregateOwnerPerms();
+ return m_EffectiveOwnerPerms;
+ }
+ }
+
+ public void AggregateOwnerPerms()
+ {
+ lock(PermissionsLock)
+ {
+ // get object everyone permissions
+ uint baseperms = RootPart.OwnerMask & (uint)PermissionMask.All;
+
+ if(baseperms == 0)
+ {
+ m_EffectiveOwnerPerms = 0;
+ return;
+ }
+
+ uint current = baseperms;
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ {
+ SceneObjectPart part = parts[i];
+ part.Inventory.AggregateOwnerPerms(ref current);
+ if( current == 0)
+ break;
+ }
+ // recover modify and move
+ baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
+ current |= baseperms;
+ current &= (uint)PermissionMask.All;
+ if((current & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0)
+ current |= (uint)PermissionMask.Transfer;
+ m_EffectiveOwnerPerms = current;
+ }
+ }
+
public uint GetEffectivePermissions()
{
return GetEffectivePermissions(false);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 02b94ce..48ae39e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -944,7 +944,7 @@ namespace OpenSim.Region.Framework.Scenes
group.SetGroup(m_part.GroupID, null);
// TODO: Remove magic number badness
- if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
+ if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
{
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
{
@@ -965,7 +965,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in partList)
{
// TODO: Remove magic number badness
- if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
+ if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
@@ -1319,6 +1319,48 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ // reduce to minimal set
+ public void AggregateEveryOnePerms(ref uint current)
+ {
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ current &= item.EveryonePermissions;
+ if(current == 0)
+ break;
+ }
+ }
+
+ public void AggregateGroupPerms(ref uint current)
+ {
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ current &= item.GroupPermissions;
+ if(current == 0)
+ break;
+ }
+ }
+
+ public void AggregateGroupOrEveryonePerms(ref uint current)
+ {
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ current &= (item.GroupPermissions | item.EveryonePermissions);
+ if(current == 0)
+ break;
+ }
+ }
+
+ public void AggregateOwnerPerms(ref uint current)
+ {
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ current &= item.CurrentPermissions;
+ if(current == 0)
+ break;
+ }
+ }
+
+
public uint MaskEffectivePermissions()
{
uint mask=0x7fffffff;
--
cgit v1.1
From 568614af2cee0c9e6cd86dd682c7bc768afe655b Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 16 Jan 2017 14:53:42 +0000
Subject: Remove the last instance of the legacy slam but being set
New objects now get only the real slam bit.
---
.../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++--
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++++-
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 6 ++----
3 files changed, 9 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 6fe7e89..b37744d 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -608,7 +608,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// item.BasePermissions = perms & so.RootPart.NextOwnerMask;
- uint nextp = so.RootPart.NextOwnerMask | 0x0f;
+ uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask;
item.BasePermissions = perms & nextp;
item.CurrentPermissions = item.BasePermissions;
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
@@ -616,7 +616,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
// apply next owner perms on rez
- item.CurrentPermissions |= (uint)PermissionMask.Slam;
+ item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
}
else
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 0d09cef..c1faf21 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1258,6 +1258,10 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.InvType = taskItem.InvType;
agentItem.Flags = taskItem.Flags;
+ // The code below isn't OK. It doesn't account for flags being changed
+ // in the object inventory, so it will break when you do it. That
+ // is the previous behaviour, so no matter at this moment. However, there is a lot
+ // TODO: Fix this after the inventory fixer exists and has beenr run
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
{
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
@@ -1266,7 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes
else
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
- agentItem.CurrentPermissions = agentItem.BasePermissions;
+ agentItem.BasePermissions = agentItem.CurrentPermissions;
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 02b94ce..bf56de2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -943,8 +943,7 @@ namespace OpenSim.Region.Framework.Scenes
group.SetGroup(m_part.GroupID, null);
- // TODO: Remove magic number badness
- if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
+ if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
{
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
{
@@ -964,8 +963,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart part in partList)
{
- // TODO: Remove magic number badness
- if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) // Magic number
+ if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
--
cgit v1.1
From 733072b6a371f52d5c13f61d4b2a145a370370f5 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 16 Jan 2017 19:01:41 +0000
Subject: chance new effective permissions code to ease aggregation on demand(
ie on changes). But still doing full aggregation on checks, so still heavy
---
.../Framework/Interfaces/IEntityInventory.cs | 5 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 198 +++++++++------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 27 +++
.../Framework/Scenes/SceneObjectPartInventory.cs | 40 +----
4 files changed, 121 insertions(+), 149 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 2af6ff0..e7c2428 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -278,10 +278,7 @@ namespace OpenSim.Region.Framework.Interfaces
///
void ProcessInventoryBackup(ISimulationDataService datastore);
- void AggregateEveryOnePerms(ref uint current);
- void AggregateGroupOrEveryonePerms(ref uint current);
- void AggregateGroupPerms(ref uint current);
- void AggregateOwnerPerms(ref uint current);
+ void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone);
uint MaskEffectivePermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f44604b..7b9ea8b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -259,41 +259,11 @@ namespace OpenSim.Region.Framework.Scenes
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateEveryOnePerms();
+ AggregateDeepPerms();
return m_EffectiveEveryOnePerms;
}
}
- public void AggregateEveryOnePerms()
- {
- lock(PermissionsLock)
- {
- // get object everyone permissions
- uint baseperms = RootPart.EveryoneMask & (uint)PermissionMask.All;
-
- if(baseperms == 0)
- {
- m_EffectiveEveryOnePerms = 0;
- return;
- }
-
- uint current = baseperms;
- SceneObjectPart[] parts = m_parts.GetArray();
- for (int i = 0; i < parts.Length; i++)
- {
- SceneObjectPart part = parts[i];
- part.Inventory.AggregateEveryOnePerms(ref current);
- if( current == 0)
- break;
- }
- // recover move
- baseperms &= (uint)PermissionMask.Move;
- current |= baseperms;
- current &= (uint)PermissionMask.All;
- m_EffectiveEveryOnePerms = current;
- }
- }
-
private uint m_EffectiveGroupPerms;
public uint EffectiveGroupPerms
{
@@ -302,126 +272,136 @@ namespace OpenSim.Region.Framework.Scenes
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateGroupPerms();
+ AggregateDeepPerms();
return m_EffectiveGroupPerms;
}
}
- public void AggregateGroupPerms()
+ public uint EffectiveGroupOrEveryOnePerms
{
- lock(PermissionsLock)
+ get
{
- // get object everyone permissions
- uint baseperms = RootPart.GroupMask & (uint)PermissionMask.All;
-
- if(baseperms == 0)
- {
- m_EffectiveGroupPerms = 0;
- return;
- }
-
- uint current = baseperms;
- SceneObjectPart[] parts = m_parts.GetArray();
- for (int i = 0; i < parts.Length; i++)
- {
- SceneObjectPart part = parts[i];
- part.Inventory.AggregateGroupPerms(ref current);
- if( current == 0)
- break;
- }
- // recover modify and move
- baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
- current |= baseperms;
- current &= (uint)PermissionMask.All;
- m_EffectiveGroupPerms = current;
+ // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
+ // bc this is on heavy duty code paths
+ // but for now we need to test the concept
+ AggregateDeepPerms();
+ return m_EffectiveEveryOnePerms | m_EffectiveGroupPerms;
}
}
- private uint m_EffectiveGroupOrEveryOnePerms;
- public uint EffectiveGroupOrEveryOnePerms
+ private uint m_EffectiveOwnerPerms;
+ public uint EffectiveOwnerPerms
{
get
{
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateGroupOrEveryOnePerms();
- return m_EffectiveGroupOrEveryOnePerms;
+ AggregateDeepPerms();
+ return m_EffectiveOwnerPerms;
}
}
- public void AggregateGroupOrEveryOnePerms()
+ // aggregates perms scanning parts and their contents
+ public void AggregateDeepPerms()
{
lock(PermissionsLock)
{
- // get object everyone permissions
- uint baseperms = (RootPart.EveryoneMask | RootPart.GroupMask) & (uint)PermissionMask.All;
+ // aux
+ const uint allmask = (uint)PermissionMask.AllEffective;
+ const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
+ const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
+
+ uint baseOwnerPerms = RootPart.OwnerMask;
+ uint owner = baseOwnerPerms;
+ uint baseGroupPerms = RootPart.GroupMask;
+ uint group = baseGroupPerms;
+ uint baseEveryonePerms = RootPart.EveryoneMask;
+ uint everyone = baseEveryonePerms;
- if(baseperms == 0)
- {
- m_EffectiveGroupOrEveryOnePerms = 0;
- return;
- }
-
- uint current = baseperms;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
- part.Inventory.AggregateGroupOrEveryonePerms(ref current);
- if( current == 0)
- break;
+ part.AggregateInnerPerms();
+ owner &= part.AggregatedInnerOwnerPerms;
+ group &= part.AggregatedInnerGroupPerms;
+ everyone &= part.AggregatedInnerEveryonePerms;
}
// recover modify and move
- baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
- current |= baseperms;
- current &= (uint)PermissionMask.All;
- m_EffectiveGroupOrEveryOnePerms = current;
- }
- }
+ baseOwnerPerms &= movemodmask;
+ owner |= baseOwnerPerms;
+ if((owner & copytransfermast) == 0)
+ owner |= (uint)PermissionMask.Transfer;
+ owner &= allmask;
+ m_EffectiveOwnerPerms = owner;
- private uint m_EffectiveOwnerPerms;
- public uint EffectiveOwnerPerms
- {
- get
- {
- // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
- // bc this is on heavy duty code paths
- // but for now we need to test the concept
- AggregateOwnerPerms();
- return m_EffectiveOwnerPerms;
+ // recover modify and move
+ baseGroupPerms &= movemodmask;
+ group |= baseGroupPerms;
+ if((group & copytransfermast) == 0)
+ group |= (uint)PermissionMask.Transfer;
+ group &= allmask;
+ m_EffectiveGroupPerms = group;
+
+ // recover move
+ baseEveryonePerms &= (uint)PermissionMask.Move;
+ everyone |= baseEveryonePerms;
+ if((everyone & copytransfermast) == 0) // not much sense but as sl
+ everyone |= (uint)PermissionMask.Transfer;
+ everyone &= allmask;
+ m_EffectiveEveryOnePerms = everyone;
}
}
- public void AggregateOwnerPerms()
+ // aggregates perms scanning parts, assuming their contents was already aggregated
+ public void AggregatePerms()
{
lock(PermissionsLock)
{
- // get object everyone permissions
- uint baseperms = RootPart.OwnerMask & (uint)PermissionMask.All;
+ // aux
+ const uint allmask = (uint)PermissionMask.AllEffective;
+ const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
+ const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
+
+ uint baseOwnerPerms = RootPart.OwnerMask;
+ uint owner = baseOwnerPerms;
+ uint baseGroupPerms = RootPart.GroupMask;
+ uint group = baseGroupPerms;
+ uint baseEveryonePerms = RootPart.EveryoneMask;
+ uint everyone = baseEveryonePerms;
- if(baseperms == 0)
- {
- m_EffectiveOwnerPerms = 0;
- return;
- }
-
- uint current = baseperms;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
- part.Inventory.AggregateOwnerPerms(ref current);
- if( current == 0)
- break;
+ owner &= part.AggregatedInnerOwnerPerms;
+ group &= part.AggregatedInnerGroupPerms;
+ everyone &= part.AggregatedInnerEveryonePerms;
}
// recover modify and move
- baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify );
- current |= baseperms;
- current &= (uint)PermissionMask.All;
- if((current & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0)
- current |= (uint)PermissionMask.Transfer;
- m_EffectiveOwnerPerms = current;
+ baseOwnerPerms &= movemodmask;
+ owner |= baseOwnerPerms;
+ if((owner & copytransfermast) == 0)
+ owner |= (uint)PermissionMask.Transfer;
+ owner &= allmask;
+ m_EffectiveOwnerPerms = owner;
+
+ // recover modify and move
+ baseGroupPerms &= movemodmask;
+ group |= baseGroupPerms;
+ if((group & copytransfermast) == 0)
+ group |= (uint)PermissionMask.Transfer;
+ group &= allmask;
+ m_EffectiveGroupPerms = group;
+
+ // recover move
+ baseEveryonePerms &= (uint)PermissionMask.Move;
+ everyone |= baseEveryonePerms;
+ if((everyone & copytransfermast) == 0) // not much sense but as sl
+ everyone |= (uint)PermissionMask.Transfer;
+ everyone &= allmask;
+ m_EffectiveEveryOnePerms = everyone;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 557b55e..9f99665 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2537,6 +2537,33 @@ namespace OpenSim.Region.Framework.Scenes
return (uint)Flags | (uint)LocalFlags;
}
+ // some of this lines need be moved to other place later
+
+ // effective permitions considering only this part inventory contents perms
+ public uint AggregatedInnerOwnerPerms {get; private set; }
+ public uint AggregatedInnerGroupPerms {get; private set; }
+ public uint AggregatedInnerEveryonePerms {get; private set; }
+ private object InnerPermsLock = new object();
+
+ public void AggregateInnerPerms()
+ {
+ const uint mask = (uint)PermissionMask.AllEffective;
+
+ uint owner = mask;
+ uint group = mask;
+ uint everyone = mask;
+
+ lock(InnerPermsLock) // do we really need this?
+ {
+ if(Inventory != null)
+ Inventory.AggregateInnerPerms(ref owner, ref group, ref everyone);
+
+ AggregatedInnerOwnerPerms = owner & mask;
+ AggregatedInnerGroupPerms = group & mask;
+ AggregatedInnerEveryonePerms = everyone & mask;
+ }
+ }
+
public Vector3 GetGeometricCenter()
{
// this is not real geometric center but a average of positions relative to root prim acording to
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 636afac..a55936f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1317,48 +1317,16 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- // reduce to minimal set
- public void AggregateEveryOnePerms(ref uint current)
+ public void AggregateInnerPerms(ref uint owner, ref uint group, ref uint everyone)
{
foreach (TaskInventoryItem item in m_items.Values)
{
- current &= item.EveryonePermissions;
- if(current == 0)
- break;
- }
- }
-
- public void AggregateGroupPerms(ref uint current)
- {
- foreach (TaskInventoryItem item in m_items.Values)
- {
- current &= item.GroupPermissions;
- if(current == 0)
- break;
+ owner &= item.CurrentPermissions;
+ group &= item.GroupPermissions;
+ everyone &= item.EveryonePermissions;
}
}
- public void AggregateGroupOrEveryonePerms(ref uint current)
- {
- foreach (TaskInventoryItem item in m_items.Values)
- {
- current &= (item.GroupPermissions | item.EveryonePermissions);
- if(current == 0)
- break;
- }
- }
-
- public void AggregateOwnerPerms(ref uint current)
- {
- foreach (TaskInventoryItem item in m_items.Values)
- {
- current &= item.CurrentPermissions;
- if(current == 0)
- break;
- }
- }
-
-
public uint MaskEffectivePermissions()
{
uint mask=0x7fffffff;
--
cgit v1.1
From ffa6c7aae2266708884ec16d75d7b8b5bae638e5 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 16 Jan 2017 19:22:39 +0000
Subject: avoid lastOwner beeing the group
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 +++++++--
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 3 ++-
3 files changed, 11 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3f531be..4d1e564 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2751,7 +2751,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
{
- part.LastOwnerID = part.OwnerID;
+ if(part.GroupID != part.OwnerID && cGroupID != part.OwnerID)
+ part.LastOwnerID = part.OwnerID;
part.OwnerID = cAgentID;
part.GroupID = cGroupID;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 9f99665..87ce0b7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2228,7 +2228,11 @@ namespace OpenSim.Region.Framework.Scenes
dupe.LocalId = plocalID;
// This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
- dupe.LastOwnerID = OwnerID;
+ if(OwnerID != GroupID)
+ dupe.LastOwnerID = OwnerID;
+ else
+ dupe.LastOwnerID = LastOwnerID; // redundant ?
+
dupe.RezzerID = RezzerID;
byte[] extraP = new byte[Shape.ExtraParams.Length];
@@ -5246,7 +5250,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
//LogPermissions("After ApplyNextOwnerPermissions");
- LastOwnerID = OwnerID;
+ if(OwnerID != GroupID)
+ LastOwnerID = OwnerID;
OwnerID = item.Owner;
Inventory.ChangeInventoryOwner(item.Owner);
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index a55936f..4dd8eb1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -965,7 +965,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & (uint)PermissionMask.Slam) != 0 || (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
{
- part.LastOwnerID = part.OwnerID;
+ if(part.GroupID != part.OwnerID)
+ part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
part.Inventory.ChangeInventoryOwner(item.OwnerID);
}
--
cgit v1.1
From 6735d3496cb93c68011ae5e0e45e0b73b5e729d8 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 16 Jan 2017 19:49:07 +0000
Subject: fix EffectiveGroupOrEveryOnePerms C&T == 0 case
---
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 32 ++++++++++++++++++----
1 file changed, 27 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 7b9ea8b..399e341 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -277,6 +277,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ private uint m_EffectiveGroupOrEveryOnePerms;
public uint EffectiveGroupOrEveryOnePerms
{
get
@@ -285,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes
// bc this is on heavy duty code paths
// but for now we need to test the concept
AggregateDeepPerms();
- return m_EffectiveEveryOnePerms | m_EffectiveGroupPerms;
+ return m_EffectiveGroupOrEveryOnePerms;
}
}
@@ -339,18 +340,28 @@ namespace OpenSim.Region.Framework.Scenes
// recover modify and move
baseGroupPerms &= movemodmask;
group |= baseGroupPerms;
+ group &= allmask;
+
+ uint groupOrEveryone = group;
+
if((group & copytransfermast) == 0)
group |= (uint)PermissionMask.Transfer;
- group &= allmask;
m_EffectiveGroupPerms = group;
// recover move
baseEveryonePerms &= (uint)PermissionMask.Move;
everyone |= baseEveryonePerms;
+ everyone &= allmask;
+
+ groupOrEveryone |= everyone;
+
if((everyone & copytransfermast) == 0) // not much sense but as sl
everyone |= (uint)PermissionMask.Transfer;
- everyone &= allmask;
m_EffectiveEveryOnePerms = everyone;
+
+ if((groupOrEveryone & copytransfermast) == 0) // not much sense but as sl
+ groupOrEveryone |= (uint)PermissionMask.Transfer;
+ m_EffectiveGroupOrEveryOnePerms = groupOrEveryone;
}
}
@@ -375,6 +386,7 @@ namespace OpenSim.Region.Framework.Scenes
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
+ part.AggregateInnerPerms();
owner &= part.AggregatedInnerOwnerPerms;
group &= part.AggregatedInnerGroupPerms;
everyone &= part.AggregatedInnerEveryonePerms;
@@ -390,18 +402,28 @@ namespace OpenSim.Region.Framework.Scenes
// recover modify and move
baseGroupPerms &= movemodmask;
group |= baseGroupPerms;
+ group &= allmask;
+
+ uint groupOrEveryone = group;
+
if((group & copytransfermast) == 0)
group |= (uint)PermissionMask.Transfer;
- group &= allmask;
m_EffectiveGroupPerms = group;
// recover move
baseEveryonePerms &= (uint)PermissionMask.Move;
everyone |= baseEveryonePerms;
+ everyone &= allmask;
+
+ groupOrEveryone |= everyone;
+
if((everyone & copytransfermast) == 0) // not much sense but as sl
everyone |= (uint)PermissionMask.Transfer;
- everyone &= allmask;
m_EffectiveEveryOnePerms = everyone;
+
+ if((groupOrEveryone & copytransfermast) == 0) // not much sense but as sl
+ groupOrEveryone |= (uint)PermissionMask.Transfer;
+ m_EffectiveGroupOrEveryOnePerms = groupOrEveryone;
}
}
--
cgit v1.1
From 180add745cea4a7e076afd1cfe1c922df1bf7e0b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 16 Jan 2017 20:27:39 +0000
Subject: replace calls to SetOwnerId and SetRootPartOwner by a single new
SetOwner() so owner is not changed twice on rootpart
---
.../World/Objects/BuySell/BuySellModule.cs | 3 +--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +--
.../Region/Framework/Scenes/SceneObjectGroup.cs | 24 ++++++++++++++++++++++
.../Avatar/Attachments/TempAttachmentsModule.cs | 3 +--
4 files changed, 27 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 2837358..2a7bfb0 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -136,8 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
return false;
}
- group.SetOwnerId(remoteClient.AgentId);
- group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
+ group.SetOwner(remoteClient.AgentId, remoteClient.ActiveGroupId);
if (m_scene.Permissions.PropagatePermissions())
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 2f65ce2..602ac4b 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -2103,8 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes
if (original.OwnerID != AgentID)
{
- copy.SetOwnerId(AgentID);
- copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
+ copy.SetOwner(AgentID, GroupID);
SceneObjectPart[] partList = copy.Parts;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4d1e564..924b61f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2766,6 +2766,30 @@ namespace OpenSim.Region.Framework.Scenes
part.ScheduleFullUpdate();
}
+ public void SetOwner(UUID cAgentID, UUID cGroupID)
+ {
+ SceneObjectPart rpart = RootPart;
+ UUID oldowner = rpart.OwnerID;
+ ForEachPart(delegate(SceneObjectPart part)
+ {
+ if(part.GroupID != part.OwnerID)
+ part.LastOwnerID = part.OwnerID;
+ part.OwnerID = cAgentID;
+ part.GroupID = cGroupID;
+ });
+
+ if (oldowner != cAgentID)
+ {
+ // Apply Next Owner Permissions if we're not bypassing permissions
+ if (!m_scene.Permissions.BypassPermissions())
+ ApplyNextOwnerPermissions();
+ }
+
+ rpart.ScheduleFullUpdate();
+ }
+
+
+
///
/// Make a copy of the given part.
///
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index ed27385..1d5e4fb 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -163,8 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
return 0;
- hostPart.ParentGroup.SetOwnerId(target.UUID);
- hostPart.ParentGroup.SetRootPartOwner(hostPart.ParentGroup.RootPart, target.UUID, target.ControllingClient.ActiveGroupId);
+ hostPart.ParentGroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
if (m_scene.Permissions.PropagatePermissions())
{
--
cgit v1.1
From 2b5ef892720c7dfd65e20104cf9ba9bd701463c1 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 16 Jan 2017 20:37:04 +0000
Subject: remove now unused SetRootPartOwner()
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 924b61f..639c8dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2744,28 +2744,10 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Set the owner of the root part.
+ /// Set the owner of all linkset.
///
- ///
///
///
- public void SetRootPartOwner(SceneObjectPart part, UUID cAgentID, UUID cGroupID)
- {
- if(part.GroupID != part.OwnerID && cGroupID != part.OwnerID)
- part.LastOwnerID = part.OwnerID;
- part.OwnerID = cAgentID;
- part.GroupID = cGroupID;
-
- if (part.OwnerID != cAgentID)
- {
- // Apply Next Owner Permissions if we're not bypassing permissions
- if (!m_scene.Permissions.BypassPermissions())
- ApplyNextOwnerPermissions();
- }
-
- part.ScheduleFullUpdate();
- }
-
public void SetOwner(UUID cAgentID, UUID cGroupID)
{
SceneObjectPart rpart = RootPart;
@@ -2788,8 +2770,6 @@ namespace OpenSim.Region.Framework.Scenes
rpart.ScheduleFullUpdate();
}
-
-
///
/// Make a copy of the given part.
///
--
cgit v1.1
From a5c693e302c941be69b7eedaead72bdd3ce7aa59 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Jan 2017 00:41:30 +0000
Subject: start adding calls to effective permissions aggregation on changes;
rearrange code in DuplicateObject();
---
.../World/Objects/BuySell/BuySellModule.cs | 1 +
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 --
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 27 +++++++++-------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 11 ++++-----
.../Avatar/Attachments/TempAttachmentsModule.cs | 24 ++++++++++---------
5 files changed, 29 insertions(+), 36 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 2a7bfb0..4542bbf 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -146,6 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
child.TriggerScriptChangedEvent(Changed.OWNER);
child.ApplyNextOwnerPermissions();
}
+ group.AggregatePerms();
}
part.ObjectSaleType = 0;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index c1faf21..ea100ae 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2766,8 +2766,6 @@ namespace OpenSim.Region.Framework.Scenes
child.Inventory.ChangeInventoryOwner(groupID);
child.TriggerScriptChangedEvent(Changed.OWNER);
}
-
-
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 602ac4b..dad8cac 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -2101,20 +2101,23 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup copy = original.Copy(true);
copy.AbsolutePosition = copy.AbsolutePosition + offset;
+ SceneObjectPart[] parts = copy.Parts;
+
+ m_numTotalPrim += parts.Length;
+
if (original.OwnerID != AgentID)
{
copy.SetOwner(AgentID, GroupID);
- SceneObjectPart[] partList = copy.Parts;
-
if (m_parentScene.Permissions.PropagatePermissions())
{
- foreach (SceneObjectPart child in partList)
+ foreach (SceneObjectPart child in parts)
{
child.Inventory.ChangeInventoryOwner(AgentID);
child.TriggerScriptChangedEvent(Changed.OWNER);
child.ApplyNextOwnerPermissions();
}
+ copy.AggregatePerms();
}
}
@@ -2124,10 +2127,6 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID[copy.UUID] = copy;
- SceneObjectPart[] parts = copy.Parts;
-
- m_numTotalPrim += parts.Length;
-
foreach (SceneObjectPart part in parts)
{
if (part.GetPrimType() == PrimType.SCULPT)
@@ -2150,21 +2149,17 @@ namespace OpenSim.Region.Framework.Scenes
// think it's selected, so it will never send a deselect...
copy.IsSelected = false;
- m_numPrim += copy.Parts.Length;
-
if (rot != Quaternion.Identity)
- {
copy.UpdateGroupRotationR(rot);
- }
+
+ // required for physics to update it's position
+ copy.ResetChildPrimPhysicsPositions();
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1);
- copy.HasGroupChanged = true;
- copy.ScheduleGroupForFullUpdate();
copy.ResumeScripts();
- // required for physics to update it's position
- copy.AbsolutePosition = copy.AbsolutePosition;
-
+ copy.HasGroupChanged = true;
+ copy.ScheduleGroupForFullUpdate();
return copy;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 87ce0b7..0817144 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -5243,17 +5243,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
if (OwnerID != item.Owner)
{
- //LogPermissions("Before ApplyNextOwnerPermissions");
-
- if (scene.Permissions.PropagatePermissions())
- ApplyNextOwnerPermissions();
-
- //LogPermissions("After ApplyNextOwnerPermissions");
-
if(OwnerID != GroupID)
LastOwnerID = OwnerID;
OwnerID = item.Owner;
Inventory.ChangeInventoryOwner(item.Owner);
+
+ if (scene.Permissions.PropagatePermissions())
+ ApplyNextOwnerPermissions();
}
}
@@ -5277,6 +5273,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
GroupMask = 0; // Giving an object zaps group permissions
Inventory.ApplyNextOwnerPermissions();
+ AggregateInnerPerms();
}
public void UpdateLookAt()
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index 1d5e4fb..2bb48ad 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -134,11 +134,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
private int llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
{
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
-
if (hostPart == null)
return 0;
- if (hostPart.ParentGroup.IsAttachment)
+ SceneObjectGroup hostgroup = hostPart.ParentGroup;
+
+ if (hostgroup== null || hostgroup.IsAttachment)
return 0;
IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface();
@@ -156,31 +157,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
return 0;
- if (target.UUID != hostPart.ParentGroup.OwnerID)
+ if (target.UUID != hostgroup.OwnerID)
{
- uint effectivePerms = hostPart.ParentGroup.GetEffectivePermissions();
+ uint effectivePerms = hostgroup.GetEffectivePermissions();
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
return 0;
- hostPart.ParentGroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
+ hostgroup.SetOwner(target.UUID, target.ControllingClient.ActiveGroupId);
if (m_scene.Permissions.PropagatePermissions())
{
- foreach (SceneObjectPart child in hostPart.ParentGroup.Parts)
+ foreach (SceneObjectPart child in hostgroup.Parts)
{
child.Inventory.ChangeInventoryOwner(target.UUID);
child.TriggerScriptChangedEvent(Changed.OWNER);
child.ApplyNextOwnerPermissions();
}
+ hostgroup.AggregatePerms();
}
- hostPart.ParentGroup.RootPart.ObjectSaleType = 0;
- hostPart.ParentGroup.RootPart.SalePrice = 10;
+ hostgroup.RootPart.ObjectSaleType = 0;
+ hostgroup.RootPart.SalePrice = 10;
- hostPart.ParentGroup.HasGroupChanged = true;
- hostPart.ParentGroup.RootPart.SendPropertiesToClient(target.ControllingClient);
- hostPart.ParentGroup.RootPart.ScheduleFullUpdate();
+ hostgroup.HasGroupChanged = true;
+ hostgroup.RootPart.SendPropertiesToClient(target.ControllingClient);
+ hostgroup.RootPart.ScheduleFullUpdate();
}
return attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, false, true) ? 1 : 0;
--
cgit v1.1
From 11134072806f43ddd35fe2a70331a4877ab1b38f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Jan 2017 01:22:44 +0000
Subject: add more calls to effective permissions aggregation; do not change
groupmask on deed
---
.../Framework/InventoryAccess/InventoryAccessModule.cs | 2 ++
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 11 +++++++++--
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 +++
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 1 +
4 files changed, 15 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index b37744d..6783ce0 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -1180,6 +1180,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
part.NextOwnerMask = item.NextPermissions & part.BaseMask;
}
}
+
}
}
else
@@ -1198,6 +1199,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
rootPart.TrimPermissions();
+ so.AggregateDeepPerms();
if (isAttachment)
so.FromItemID = item.ID;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index ea100ae..c913271 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2754,9 +2754,16 @@ namespace OpenSim.Region.Framework.Scenes
continue;
sog.SetOwnerId(groupID);
- // Make the group mask be the previous owner mask
- sog.RootPart.GroupMask = sog.RootPart.OwnerMask;
+
+ // this is wrong, GroupMask is used for group sharing, still possible to set
+ // this whould give owner rights to users that are member of group but don't have role powers to edit
+// sog.RootPart.GroupMask = sog.RootPart.OwnerMask;
+
+ // we should keep all permissions on deed to group
+ // and with this comented code, if user does not set next permissions on the object
+ // and on ALL contents of ALL prims, he may loose rights, making the object useless
sog.ApplyNextOwnerPermissions();
+ sog.AggregatePerms();
sog.ScheduleGroupForFullUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 639c8dd..033170d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2764,7 +2764,10 @@ namespace OpenSim.Region.Framework.Scenes
{
// Apply Next Owner Permissions if we're not bypassing permissions
if (!m_scene.Permissions.BypassPermissions())
+ {
ApplyNextOwnerPermissions();
+ AggregatePerms();
+ }
}
rpart.ScheduleFullUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 4dd8eb1..29d9f08 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -980,6 +980,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// old code end
rootPart.TrimPermissions();
+ group.AggregateDeepPerms();
}
return true;
--
cgit v1.1
From db2fbf6516a055beb71de9b82a9773c29bf3a73d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Jan 2017 13:24:09 +0000
Subject: add more calls to effective permissions aggregation, some paths may
still be missing on objects changes, but remove the aggregation on check
paths, so all can be tested.
---
.../Linden/Caps/ObjectCaps/ObjectAdd.cs | 10 ++++-----
.../Caps/ObjectCaps/UploadObjectAssetModule.cs | 1 +
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 8 ++++++-
OpenSim/Region/Framework/Scenes/Scene.cs | 2 ++
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 10 ++++-----
.../Region/Framework/Scenes/SceneObjectGroup.cs | 26 +++++++++++++---------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++--
.../Framework/Scenes/SceneObjectPartInventory.cs | 11 ++++++++-
.../Scenes/Serialization/SceneObjectSerializer.cs | 5 +++--
.../Scenes/Serialization/SceneXmlLoader.cs | 1 +
.../Scripting/JsonStore/JsonStoreScriptModule.cs | 2 +-
.../World/TreePopulator/TreePopulatorModule.cs | 2 +-
.../Shared/Api/Implementation/OSSL_Api.cs | 1 +
14 files changed, 58 insertions(+), 30 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
index 189fa36..69fcb7d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/ObjectAdd.cs
@@ -121,6 +121,9 @@ namespace OpenSim.Region.ClientStack.Linden
OSD r = OSDParser.DeserializeLLSDXml((string)request["requestbody"]);
+ if (r.Type != OSDType.Map) // not a proper req
+ return responsedata;
+
//UUID session_id = UUID.Zero;
bool bypass_raycast = false;
uint everyone_mask = 0;
@@ -157,9 +160,6 @@ namespace OpenSim.Region.ClientStack.Linden
int state = 0;
int lastattach = 0;
- if (r.Type != OSDType.Map) // not a proper req
- return responsedata;
-
OSDMap rm = (OSDMap)r;
if (rm.ContainsKey("ObjectData")) //v2
@@ -307,8 +307,6 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
-
-
Vector3 pos = m_scene.GetNewRezLocation(ray_start, ray_end, ray_target_id, rotation, (bypass_raycast) ? (byte)1 : (byte)0, (ray_end_is_intersection) ? (byte)1 : (byte)0, true, scale, false);
PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
@@ -359,6 +357,8 @@ namespace OpenSim.Region.ClientStack.Linden
rootpart.NextOwnerMask = next_owner_mask;
rootpart.Material = (byte)material;
+ obj.AggregatePerms();
+
m_scene.PhysicsScene.AddPhysicsActorTaint(rootpart.PhysActor);
responsedata["int_response_code"] = 200; //501; //410; //404;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index 6874662..116c51f 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -335,6 +335,7 @@ namespace OpenSim.Region.ClientStack.Linden
grp.AbsolutePosition = obj.Position;
prim.RotationOffset = obj.Rotation;
+
// Required for linking
grp.RootPart.ClearUpdateSchedule();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index c913271..473589a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -338,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes
// Update item with new asset
item.AssetID = asset.FullID;
group.UpdateInventoryItem(item);
+ group.AggregatePerms();
part.SendPropertiesToClient(remoteClient);
@@ -1214,6 +1215,7 @@ namespace OpenSim.Region.Framework.Scenes
}
group.RemoveInventoryItem(localID, itemID);
+ group.AggregatePerms();
}
part.SendPropertiesToClient(remoteClient);
@@ -1530,9 +1532,10 @@ namespace OpenSim.Region.Framework.Scenes
destTaskItem.Type = srcTaskItem.Type;
destPart.Inventory.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);
-
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
+ {
part.Inventory.RemoveInventoryItem(itemId);
+ }
ScenePresence avatar;
@@ -1978,6 +1981,8 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.AddInventoryItem(taskItem, false);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
+ part.ParentGroup.AggregatePerms();
+
// tell anyone managing scripts that a new script exists
EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
@@ -2658,6 +2663,7 @@ namespace OpenSim.Region.Framework.Scenes
// We can only call this after adding the scene object, since the scene object references the scene
// to find out if scripts should be activated at all.
+ group.AggregatePerms();
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
group.ScheduleGroupForFullUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2137b42..ff1e34e 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2351,6 +2351,7 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnSceneObjectLoaded(group);
SceneObjectPart rootPart = group.GetPart(group.UUID);
rootPart.Flags &= ~PrimFlags.Scripted;
+ group.AggregateDeepPerms();
rootPart.TrimPermissions();
// Don't do this here - it will get done later on when sculpt data is loaded.
@@ -2622,6 +2623,7 @@ namespace OpenSim.Region.Framework.Scenes
if (UserManagementModule != null)
sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
+ sceneObject.AggregateDeepPerms();
sceneObject.ScheduleGroupForFullUpdate();
return sceneObject;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index dad8cac..7a97bfc 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.ForceInventoryPersistence();
sceneObject.HasGroupChanged = true;
}
-
+ sceneObject.AggregateDeepPerms();
return ret;
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 399e341..5ecf352 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -171,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes
bool addFromAllowedDrop = agentID != part.OwnerID;
part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
-
+ part.ParentGroup.AggregatePerms();
return true;
}
else
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateDeepPerms();
+// AggregateDeepPerms();
return m_EffectiveEveryOnePerms;
}
}
@@ -272,7 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateDeepPerms();
+// AggregateDeepPerms();
return m_EffectiveGroupPerms;
}
}
@@ -285,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateDeepPerms();
+// AggregateDeepPerms();
return m_EffectiveGroupOrEveryOnePerms;
}
}
@@ -298,7 +298,7 @@ namespace OpenSim.Region.Framework.Scenes
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
// bc this is on heavy duty code paths
// but for now we need to test the concept
- AggregateDeepPerms();
+ // AggregateDeepPerms();
return m_EffectiveOwnerPerms;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 033170d..d14c450 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2441,17 +2441,16 @@ namespace OpenSim.Region.Framework.Scenes
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
-
if (userExposed)
dupe.m_rootPart.TrimPermissions();
List partList = new List(m_parts.GetArray());
partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
- {
- return p1.LinkNum.CompareTo(p2.LinkNum);
- }
- );
+ {
+ return p1.LinkNum.CompareTo(p2.LinkNum);
+ }
+ );
foreach (SceneObjectPart part in partList)
{
@@ -2503,10 +2502,12 @@ namespace OpenSim.Region.Framework.Scenes
if (dupe.m_rootPart.PhysActor != null)
dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
+ dupe.AggregateDeepPerms();
+
dupe.HasGroupChanged = true;
dupe.AttachToBackup();
- ScheduleGroupForFullUpdate();
+ dupe.ScheduleGroupForFullUpdate();
}
m_dupeInProgress = false;
@@ -3426,6 +3427,7 @@ namespace OpenSim.Region.Framework.Scenes
objectGroup.HasGroupChangedDueToDelink = true;
InvalidBoundsRadius();
+ objectGroup.AggregatePerms();
if (sendEvents)
linkPart.TriggerScriptChangedEvent(Changed.LINK);
@@ -3964,8 +3966,8 @@ namespace OpenSim.Region.Framework.Scenes
public void AdjustChildPrimPermissions(bool forceTaskInventoryPermissive)
{
- uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits
- uint foldedPerms = RootPart.OwnerMask & 3;
+ uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff0; // Mask folded bits
+ uint foldedPerms = RootPart.OwnerMask & (uint)PermissionMask.FoldedMask;
ForEachPart(part =>
{
@@ -3976,14 +3978,14 @@ namespace OpenSim.Region.Framework.Scenes
part.Inventory.ApplyGodPermissions(part.BaseMask);
});
- uint lockMask = ~(uint)(PermissionMask.Move | PermissionMask.Modify);
- uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move | PermissionMask.Modify);
+ uint lockMask = ~(uint)(PermissionMask.Move);
+ uint lockBit = RootPart.OwnerMask & (uint)(PermissionMask.Move);
RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
-
+ AggregatePerms();
RootPart.ScheduleFullUpdate();
}
@@ -4008,6 +4010,7 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (SceneObjectPart part in Parts)
part.Inventory.ApplyGodPermissions(RootPart.BaseMask);
+ AggregatePerms();
}
HasGroupChanged = true;
@@ -5223,6 +5226,7 @@ namespace OpenSim.Region.Framework.Scenes
{
part.ResetOwnerChangeFlag();
});
+ AggregatePerms();
}
// clear some references to easy cg
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0817144..69d8288 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -476,8 +476,8 @@ namespace OpenSim.Region.Framework.Scenes
APIDActive = false;
Flags = 0;
CreateSelected = true;
-
TrimPermissions();
+ AggregateInnerPerms();
}
#endregion Constructors
@@ -4495,7 +4495,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
break;
}
-
+ AggregateInnerPerms();
SendFullUpdateToAllClients();
}
}
@@ -4512,6 +4512,8 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
EveryoneMask = source.EveryoneMask & BaseMask;
NextOwnerMask = source.NextOwnerMask & BaseMask;
+ AggregateInnerPerms();
+
if (OwnerMask != prevOwnerMask ||
GroupMask != prevGroupMask ||
EveryoneMask != prevEveryoneMask ||
@@ -5335,6 +5337,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
item.OwnerChanged = false;
Inventory.UpdateInventoryItem(item, false, false);
}
+ AggregateInnerPerms();
}
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 29d9f08..545d44b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -807,6 +807,7 @@ namespace OpenSim.Region.Framework.Scenes
else
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
+ m_part.AggregateInnerPerms();
m_inventorySerial++;
//m_inventorySerial += 2;
HasInventoryChanged = true;
@@ -829,7 +830,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
}
m_items.LockItemsForWrite(false);
-
+ m_part.AggregateInnerPerms();
m_inventorySerial++;
}
@@ -1022,16 +1023,20 @@ namespace OpenSim.Region.Framework.Scenes
item.AssetID = m_items[item.ItemID].AssetID;
m_items[item.ItemID] = item;
+
m_inventorySerial++;
if (fireScriptEvents)
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
if (considerChanged)
{
+ m_part.AggregateInnerPerms();
+ m_part.ParentGroup.AggregatePerms();
HasInventoryChanged = true;
m_part.ParentGroup.HasGroupChanged = true;
}
m_items.LockItemsForWrite(false);
+
return true;
}
else
@@ -1068,6 +1073,10 @@ namespace OpenSim.Region.Framework.Scenes
m_items.LockItemsForWrite(true);
m_items.Remove(itemID);
m_items.LockItemsForWrite(false);
+
+ m_part.AggregateInnerPerms();
+ m_part.ParentGroup.AggregatePerms();
+
m_inventorySerial++;
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index b8d210c..a12a401 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
// Script state may, or may not, exist. Not having any, is NOT
// ever a problem.
sceneObject.LoadScriptState(reader);
-
+ sceneObject.AggregateDeepPerms();
return sceneObject;
}
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
// Script state may, or may not, exist. Not having any, is NOT
// ever a problem.
sceneObject.LoadScriptState(doc);
-
+ sceneObject.AggregatePerms();
return sceneObject;
}
catch (Exception e)
@@ -1739,6 +1739,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
reader.ReadEndElement(); // SceneObjectPart
+ obj.AggregateInnerPerms();
// m_log.DebugFormat("[SceneObjectSerializer]: parsed SOP {0} {1}", obj.Name, obj.UUID);
return obj;
}
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index 01bc491..0f022dd 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -70,6 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
//obj.RegenerateFullIDs();
scene.AddNewSceneObject(obj, true);
+ obj.AggregateDeepPerms();
}
}
else
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index a9fdb66..6cf0092 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -665,7 +665,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
taskItem.AssetID = asset.FullID;
host.Inventory.AddInventoryItem(taskItem, false);
-
+ host.ParentGroup.AggregatePerms();
m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
}
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index e22c6ea..bf74849 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -525,7 +525,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
-
+ sceneObject.AggregatePerms();
return sceneObject;
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index e769c6d..a17eb03 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2038,6 +2038,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.Inventory.AddInventoryItemExclusive(taskItem, false);
else
m_host.Inventory.AddInventoryItem(taskItem, false);
+ m_host.ParentGroup.AggregatePerms();
return taskItem;
}
--
cgit v1.1
From 06bca0388f303067c592e59d38c4bd885d1baa51 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Jan 2017 14:30:20 +0000
Subject: Permissions module: add GetObjectPermissions() that should replace
GenericObjectPermission
---
.../World/Permissions/PermissionsModule.cs | 78 +++++++++++++++++++++-
1 file changed, 77 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index dcf0c00..57288dc 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -76,7 +76,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
//private uint PERM_MODIFY = (uint)16384;
private uint PERM_MOVE = (uint)524288;
private uint PERM_TRANS = (uint)8192;
- private uint PERM_LOCKED = (uint)540672;
+// private uint PERM_LOCKED = (uint)540672;
+ private uint PERM_LOCKED = (uint)524288; // same as move
///
/// Different user set names that come in from the configuration file.
@@ -479,6 +480,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
+
+ protected bool GroupMemberPowers(UUID groupID, UUID userID, ref ulong powers)
+ {
+ powers = 0;
+ if (null == GroupsModule)
+ return false;
+
+ GroupMembershipData gmd = GroupsModule.GetMembershipData(groupID, userID);
+
+ if (gmd != null)
+ {
+ powers = gmd.GroupPowers;
+ return true;
+ }
+ return false;
+ }
+
/*
private bool CheckGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask)
{
@@ -863,6 +881,64 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// This is a scene object group UUID
///
///
+ protected uint GetObjectPermissions(UUID currentUser, UUID objId, bool denyOnLocked)
+ {
+ SceneObjectPart part = m_scene.GetSceneObjectPart(objId);
+ if (part == null)
+ return 0;
+
+ // Admin should be able to edit anything in the sim (including admin objects)
+ if (IsAdministrator(currentUser))
+ return (uint)PermissionMask.AllEffective;
+
+ SceneObjectGroup group = part.ParentGroup;
+ SceneObjectPart root = group.RootPart;
+ if (root == null)
+ return 0;
+
+ UUID objectOwner = group.OwnerID;
+ bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0);
+
+ uint lockmask = (uint)PermissionMask.AllEffective;
+ if(locked)
+ lockmask = (uint)PermissionMask.Move;
+
+ if (currentUser == objectOwner)
+ return group.EffectiveOwnerPerms & lockmask;
+
+ if (group.IsAttachment)
+ return 0;
+
+ // Friends with benefits should be able to edit the objects too
+ if (IsFriendWithPerms(currentUser, objectOwner))
+ return group.EffectiveOwnerPerms & lockmask;
+
+ UUID sogGroupID = group.GroupID;
+ if (sogGroupID != UUID.Zero)
+ {
+ ulong powers = 0;
+ if(GroupMemberPowers(sogGroupID, currentUser, ref powers))
+ {
+ if(sogGroupID == objectOwner)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return group.EffectiveOwnerPerms & lockmask;
+ }
+ return group.EffectiveGroupOrEveryOnePerms & lockmask;
+ }
+ }
+
+ return group.EffectiveEveryOnePerms & lockmask;
+ }
+
+ ///
+ /// General permissions checks for any operation involving an object. These supplement more specific checks
+ /// implemented by callers.
+ ///
+ ///
+ /// This is a scene object group UUID
+ ///
+ ///
protected bool GenericObjectPermission(UUID currentUser, UUID objId, bool denyOnLocked)
{
// Default: deny
--
cgit v1.1
From 6d784f63060940bd82a2be776385abd40901f57c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 17 Jan 2017 23:22:02 +0000
Subject: Permissions module: GenerateClientFlags() no need to keep looking for
the same part several times; fix locked mask in GetObjectPermissions()
---
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 110 ++++++++++-----------
.../World/Permissions/PermissionsModule.cs | 21 ++--
.../Framework/Scenes/Scene.PacketHandlers.cs | 4 +-
.../Region/Framework/Scenes/Scene.Permissions.cs | 12 +--
4 files changed, 70 insertions(+), 77 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8ba1ba3..7455dea 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5731,28 +5731,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
- protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, ScenePresence sp)
+ protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart part, ScenePresence sp)
{
byte[] objectData = new byte[60];
- data.RelativePosition.ToBytes(objectData, 0);
- data.Velocity.ToBytes(objectData, 12);
- data.Acceleration.ToBytes(objectData, 24);
+ part.RelativePosition.ToBytes(objectData, 0);
+ part.Velocity.ToBytes(objectData, 12);
+ part.Acceleration.ToBytes(objectData, 24);
- Quaternion rotation = data.RotationOffset;
+ Quaternion rotation = part.RotationOffset;
rotation.Normalize();
rotation.ToBytes(objectData, 36);
- data.AngularVelocity.ToBytes(objectData, 48);
+ part.AngularVelocity.ToBytes(objectData, 48);
ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock();
- update.ClickAction = (byte)data.ClickAction;
+ update.ClickAction = (byte)part.ClickAction;
update.CRC = 0;
- update.ExtraParams = data.Shape.ExtraParams ?? Utils.EmptyBytes;
- update.FullID = data.UUID;
- update.ID = data.LocalId;
+ update.ExtraParams = part.Shape.ExtraParams ?? Utils.EmptyBytes;
+ update.FullID = part.UUID;
+ update.ID = part.LocalId;
//update.JointAxisOrAnchor = Vector3.Zero; // These are deprecated
//update.JointPivot = Vector3.Zero;
//update.JointType = 0;
- update.Material = data.Material;
+ update.Material = part.Material;
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
/*
if (data.ParentGroup.IsAttachment)
@@ -5781,68 +5781,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
*/
- if (data.ParentGroup.IsAttachment)
+ if (part.ParentGroup.IsAttachment)
{
- if (data.IsRoot)
+ if (part.IsRoot)
{
- update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID);
+ update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + part.ParentGroup.FromItemID);
}
else
update.NameValue = Utils.EmptyBytes;
- int st = (int)data.ParentGroup.AttachmentPoint;
+ int st = (int)part.ParentGroup.AttachmentPoint;
update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ;
}
else
{
update.NameValue = Utils.EmptyBytes;
- update.State = data.Shape.State; // not sure about this
+ update.State = part.Shape.State; // not sure about this
}
update.ObjectData = objectData;
- update.ParentID = data.ParentID;
- update.PathBegin = data.Shape.PathBegin;
- update.PathCurve = data.Shape.PathCurve;
- update.PathEnd = data.Shape.PathEnd;
- update.PathRadiusOffset = data.Shape.PathRadiusOffset;
- update.PathRevolutions = data.Shape.PathRevolutions;
- update.PathScaleX = data.Shape.PathScaleX;
- update.PathScaleY = data.Shape.PathScaleY;
- update.PathShearX = data.Shape.PathShearX;
- update.PathShearY = data.Shape.PathShearY;
- update.PathSkew = data.Shape.PathSkew;
- update.PathTaperX = data.Shape.PathTaperX;
- update.PathTaperY = data.Shape.PathTaperY;
- update.PathTwist = data.Shape.PathTwist;
- update.PathTwistBegin = data.Shape.PathTwistBegin;
- update.PCode = data.Shape.PCode;
- update.ProfileBegin = data.Shape.ProfileBegin;
- update.ProfileCurve = data.Shape.ProfileCurve;
- update.ProfileEnd = data.Shape.ProfileEnd;
- update.ProfileHollow = data.Shape.ProfileHollow;
- update.PSBlock = data.ParticleSystem ?? Utils.EmptyBytes;
- update.TextColor = data.GetTextColor().GetBytes(false);
- update.TextureAnim = data.TextureAnimation ?? Utils.EmptyBytes;
- update.TextureEntry = data.Shape.TextureEntry ?? Utils.EmptyBytes;
- update.Scale = data.Shape.Scale;
- update.Text = Util.StringToBytes256(data.Text);
- update.MediaURL = Util.StringToBytes256(data.MediaUrl);
+ update.ParentID = part.ParentID;
+ update.PathBegin = part.Shape.PathBegin;
+ update.PathCurve = part.Shape.PathCurve;
+ update.PathEnd = part.Shape.PathEnd;
+ update.PathRadiusOffset = part.Shape.PathRadiusOffset;
+ update.PathRevolutions = part.Shape.PathRevolutions;
+ update.PathScaleX = part.Shape.PathScaleX;
+ update.PathScaleY = part.Shape.PathScaleY;
+ update.PathShearX = part.Shape.PathShearX;
+ update.PathShearY = part.Shape.PathShearY;
+ update.PathSkew = part.Shape.PathSkew;
+ update.PathTaperX = part.Shape.PathTaperX;
+ update.PathTaperY = part.Shape.PathTaperY;
+ update.PathTwist = part.Shape.PathTwist;
+ update.PathTwistBegin = part.Shape.PathTwistBegin;
+ update.PCode = part.Shape.PCode;
+ update.ProfileBegin = part.Shape.ProfileBegin;
+ update.ProfileCurve = part.Shape.ProfileCurve;
+ update.ProfileEnd = part.Shape.ProfileEnd;
+ update.ProfileHollow = part.Shape.ProfileHollow;
+ update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes;
+ update.TextColor = part.GetTextColor().GetBytes(false);
+ update.TextureAnim = part.TextureAnimation ?? Utils.EmptyBytes;
+ update.TextureEntry = part.Shape.TextureEntry ?? Utils.EmptyBytes;
+ update.Scale = part.Shape.Scale;
+ update.Text = Util.StringToBytes256(part.Text);
+ update.MediaURL = Util.StringToBytes256(part.MediaUrl);
#region PrimFlags
- PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(sp, data.UUID);
+ PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(part, sp);
// Don't send the CreateSelected flag to everyone
flags &= ~PrimFlags.CreateSelected;
- if (sp.UUID == data.OwnerID)
+ if (sp.UUID == part.OwnerID)
{
- if (data.CreateSelected)
+ if (part.CreateSelected)
{
// Only send this flag once, then unset it
flags |= PrimFlags.CreateSelected;
- data.CreateSelected = false;
+ part.CreateSelected = false;
}
}
@@ -5854,21 +5854,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion PrimFlags
- if (data.Sound != UUID.Zero)
+ if (part.Sound != UUID.Zero)
{
- update.Sound = data.Sound;
- update.OwnerID = data.OwnerID;
- update.Gain = (float)data.SoundGain;
- update.Radius = (float)data.SoundRadius;
- update.Flags = data.SoundFlags;
+ update.Sound = part.Sound;
+ update.OwnerID = part.OwnerID;
+ update.Gain = (float)part.SoundGain;
+ update.Radius = (float)part.SoundRadius;
+ update.Flags = part.SoundFlags;
}
- switch ((PCode)data.Shape.PCode)
+ switch ((PCode)part.Shape.PCode)
{
case PCode.Grass:
case PCode.Tree:
case PCode.NewTree:
- update.Data = new byte[] { data.Shape.State };
+ update.Data = new byte[] { part.Shape.State };
break;
default:
update.Data = Utils.EmptyBytes;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 57288dc..6f16ae6 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -693,17 +693,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
);
- public uint GenerateClientFlags(ScenePresence sp, uint curEffectivePerms, UUID objID)
+ public uint GenerateClientFlags(SceneObjectPart task, ScenePresence sp, uint curEffectivePerms)
{
- if(sp == null || curEffectivePerms == 0)
- return (uint)0;
-
- SceneObjectPart task = m_scene.GetSceneObjectPart(objID);
+ if(sp == null || task == null || curEffectivePerms == 0)
+ return 0;
- // this shouldn't ever happen.. return no permissions/objectflags.
- if (task == null)
- return (uint)0;
-
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
uint objflags = curEffectivePerms & NOT_DEFAULT_FLAGS ;
@@ -719,6 +713,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
SceneObjectGroup grp = task.ParentGroup;
+ if(grp == null)
+ return 0;
+
bool unlocked = (grp.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
//bypass option == owner rights
@@ -887,7 +884,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (part == null)
return 0;
- // Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(currentUser))
return (uint)PermissionMask.AllEffective;
@@ -901,15 +897,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
uint lockmask = (uint)PermissionMask.AllEffective;
if(locked)
- lockmask = (uint)PermissionMask.Move;
+ lockmask &= ~(uint)PermissionMask.Modify;
if (currentUser == objectOwner)
return group.EffectiveOwnerPerms & lockmask;
if (group.IsAttachment)
return 0;
-
- // Friends with benefits should be able to edit the objects too
+
if (IsFriendWithPerms(currentUser, objectOwner))
return group.EffectiveOwnerPerms & lockmask;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index e611897..f2d853d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -183,7 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
part.SendFullUpdate(remoteClient);
// A prim is only tainted if it's allowed to be edited by the person clicking it.
- if (Permissions.CanChangeSelectedState(sog.UUID, (ScenePresence)remoteClient.SceneAgent))
+ if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
{
part.IsSelected = true;
EventManager.TriggerParcelPrimCountTainted();
@@ -249,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes
// handled by group, but by prim. Legacy cruft.
// TODO: Make selection flagging per prim!
//
- if (Permissions.CanChangeSelectedState(part.ParentGroup.UUID, (ScenePresence)remoteClient.SceneAgent))
+ if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
{
part.IsSelected = false;
if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 8f32b03..e42d4c2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes
{
#region Delegates
- public delegate uint GenerateClientFlagsHandler(ScenePresence sp, uint curEffectivePerms, UUID objectID);
+ public delegate uint GenerateClientFlagsHandler(SceneObjectPart part, ScenePresence sp, uint curEffectivePerms);
public delegate void SetBypassPermissionsHandler(bool value);
public delegate bool BypassPermissionsHandler();
public delegate bool PropagatePermissionsHandler();
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Object Permission Checks
- public uint GenerateClientFlags(ScenePresence sp, UUID objectID)
+ public uint GenerateClientFlags( SceneObjectPart part, ScenePresence sp)
{
// libomv will moan about PrimFlags.ObjectYouOfficer being
// obsolete...
@@ -182,8 +182,6 @@ namespace OpenSim.Region.Framework.Scenes
PrimFlags.ObjectOwnerModify;
#pragma warning restore 0612
- SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
-
if (part == null)
return 0;
@@ -195,7 +193,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
foreach (GenerateClientFlagsHandler check in list)
{
- perms &= check(sp, perms, objectID);
+ perms &= check(part, sp, perms);
}
}
return perms;
@@ -411,9 +409,9 @@ namespace OpenSim.Region.Framework.Scenes
PrimFlags.ObjectOwnerModify
);
- public bool CanChangeSelectedState(UUID objectID, ScenePresence sp)
+ public bool CanChangeSelectedState(SceneObjectPart part, ScenePresence sp)
{
- uint perms = GenerateClientFlags(sp , objectID);
+ uint perms = GenerateClientFlags(part, sp);
return (perms & CANSELECTMASK) != 0;
}
--
cgit v1.1
From c14d81f5383b95c8bcb07cf023efa0d8d0e1c3e1 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Jan 2017 00:42:08 +0000
Subject: Permissions module: replace some GenericObjectPermission by
GenericObjectPermission on some checks. Note that in some cases behavour is
now diferent.
---
.../World/Permissions/PermissionsModule.cs | 174 ++++++---------------
1 file changed, 51 insertions(+), 123 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 6f16ae6..930f5f2 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -728,7 +728,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask;
}
-
UUID taskOwnerID = task.OwnerID;
UUID spID = sp.UUID;
@@ -878,16 +877,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// This is a scene object group UUID
///
///
- protected uint GetObjectPermissions(UUID currentUser, UUID objId, bool denyOnLocked)
+ protected uint GetObjectPermissions(UUID currentUser, SceneObjectGroup group, bool denyOnLocked)
{
- SceneObjectPart part = m_scene.GetSceneObjectPart(objId);
- if (part == null)
+ if (group == null)
return 0;
if (IsAdministrator(currentUser))
return (uint)PermissionMask.AllEffective;
- SceneObjectGroup group = part.ParentGroup;
SceneObjectPart root = group.RootPart;
if (root == null)
return 0;
@@ -1193,30 +1190,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- if (!GenericObjectPermission(owner, objectID, true))
- {
- //They can't even edit the object
+ SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ if (sog == null)
return false;
- }
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
- if (part == null)
+ uint perms = GetObjectPermissions(owner, sog, false);
+ if((perms & (uint)PermissionMask.Copy) == 0)
return false;
- if (part.OwnerID == owner)
- {
- if ((part.OwnerMask & PERM_COPY) == 0)
- return false;
- }
- else if (part.GroupID != UUID.Zero)
- {
- if ((part.OwnerID == part.GroupID) && ((owner != part.LastOwnerID) || ((part.GroupMask & PERM_TRANS) == 0)))
- return false;
-
- if ((part.GroupMask & PERM_COPY) == 0)
- return false;
- }
-
//If they can rez, they can duplicate
return CanRezObject(objectCount, owner, objectPosition, scene);
}
@@ -1226,7 +1207,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericObjectPermission(deleter, objectID, false);
+ SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(deleter, sog, false);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
}
private bool CanEditObject(UUID objectID, UUID editorID, Scene scene)
@@ -1234,7 +1222,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericObjectPermission(editorID, objectID, false);
+ SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(editorID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
}
private bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene)
@@ -1242,7 +1237,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericObjectPermission(editorID, objectID, false);
+ SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(editorID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
}
private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
@@ -1314,30 +1316,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
-
- if (part == null)
+ SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ if (sog == null)
return false;
- if (part.OwnerID != user)
- {
- if (part.GroupID == UUID.Zero)
- return false;
-
- if (!IsGroupMember(part.GroupID, user, 0))
- return false;
+ uint perms = GetObjectPermissions(user, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
- if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
- return false;
- }
- else
- {
- if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
+ SceneObjectPart part = scene.GetSceneObjectPart(objectID);
+ if (part == null)
return false;
- }
TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
-
if (ti == null)
return false;
@@ -1351,14 +1342,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
// Require full perms
- if ((ti.CurrentPermissions &
- ((uint)PermissionMask.Modify |
- (uint)PermissionMask.Copy)) !=
- ((uint)PermissionMask.Modify |
- (uint)PermissionMask.Copy))
+ if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy)) !=
+ ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy))
return false;
}
-
return true;
}
@@ -1407,85 +1394,26 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_bypassPermissions)
{
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
+ if(part == null)
+ return false;
+
if (part.OwnerID != moverID)
{
- if (!part.ParentGroup.IsDeleted)
- {
- if (part.ParentGroup.IsAttachment)
+ if (part.ParentGroup.IsDeleted || part.ParentGroup.IsAttachment)
return false;
- }
}
return m_bypassPermissionsValue;
}
- bool permission = GenericObjectPermission(moverID, objectID, true);
- if (!permission)
- {
- if (!m_scene.Entities.ContainsKey(objectID))
- {
- return false;
- }
-
- // The client
- // may request to edit linked parts, and therefore, it needs
- // to also check for SceneObjectPart
-
- // If it's not an object, we cant edit it.
- if ((!(m_scene.Entities[objectID] is SceneObjectGroup)))
- {
- return false;
- }
-
-
- SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
-
-
- // UUID taskOwner = null;
- // Added this because at this point in time it wouldn't be wise for
- // the administrator object permissions to take effect.
- // UUID objectOwner = task.OwnerID;
-
- // Anyone can move
- if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
- permission = true;
-
- // Locked
- if ((task.RootPart.OwnerMask & PERM_LOCKED) == 0)
- permission = false;
- }
- else
- {
- bool locked = false;
- if (!m_scene.Entities.ContainsKey(objectID))
- {
- return false;
- }
-
- // If it's not an object, we cant edit it.
- if ((!(m_scene.Entities[objectID] is SceneObjectGroup)))
- {
- return false;
- }
-
- SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objectID];
-
- UUID objectOwner = group.OwnerID;
- locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
-
- // This is an exception to the generic object permission.
- // Administrators who lock their objects should not be able to move them,
- // however generic object permission should return true.
- // This keeps locked objects from being affected by random click + drag actions by accident
- // and allows the administrator to grab or delete a locked object.
-
- // Administrators and estate managers are still able to click+grab locked objects not
- // owned by them in the scene
- // This is by design.
+ SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
- if (locked && (moverID == objectOwner))
- return false;
- }
- return permission;
+ uint perms = GetObjectPermissions(moverID, sog, true);
+ if((perms & (uint)PermissionMask.Move) == 0)
+ return false;
+ // admins exception ? if needed then should be done at GetObjectPermissions
+ return true;
}
private bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
--
cgit v1.1
From e96378971455f5bf7969d9ca66c473d2262be7ff Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Jan 2017 01:16:58 +0000
Subject: Permissions module: fix in prim inv CanEditNotecard group edit rights
check ( in last commit plz read .. by GetObjectPermissions)
---
.../World/Permissions/PermissionsModule.cs | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 930f5f2..6e8ca55 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1320,6 +1320,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
+ // check object mod right
uint perms = GetObjectPermissions(user, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
@@ -1331,14 +1332,27 @@ namespace OpenSim.Region.CoreModules.World.Permissions
TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
if (ti == null)
return false;
-
+
if (ti.OwnerID != user)
{
- if (ti.GroupID == UUID.Zero)
+ UUID tiGroupID = ti.GroupID;
+ if (tiGroupID == UUID.Zero)
return false;
- if (!IsGroupMember(ti.GroupID, user, 0))
+ ulong powers = 0;
+ if(!GroupMemberPowers(tiGroupID, user, ref powers))
return false;
+
+ if(tiGroupID == ti.OwnerID && (powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ {
+ if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy)) ==
+ ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy))
+ return true;
+ }
+ if ((ti.GroupPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy)) ==
+ ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy))
+ return true;
+ return false;
}
// Require full perms
--
cgit v1.1
From e2c2d92d5aba757e459d0362c9b7392b528d5c8d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Jan 2017 02:29:05 +0000
Subject: antecipate baked cache check and Xbakes requests, so they happen
before viewer check request (or force it to wait via locking).
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 59 +++++++++++++-----------
1 file changed, 33 insertions(+), 26 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9545c13..c4d4f8f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2029,11 +2029,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF);
}
- // Tell the client that we're totally ready
- ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
-
- m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
-
if (!string.IsNullOrEmpty(m_callbackURI))
{
// We cannot sleep here since this would hold up the inbound packet processing thread, as
@@ -2054,6 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes
Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
m_callbackURI = null;
+ m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
}
// else
// {
@@ -2062,19 +2058,48 @@ namespace OpenSim.Region.Framework.Scenes
// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
// }
- m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
+
+ // Tell the client that we're totally ready
+ ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
+ m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
+
+ bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0;
+
+ int delayctnr = Util.EnvironmentTickCount();
+
+ if (!IsChildAgent)
+ {
+ // verify baked textures and cache
+ bool cachedbaked = false;
+
+ if (IsNPC)
+ cachedbaked = true;
+ else
+ {
+ if (m_scene.AvatarFactory != null && !isHGTP)
+ cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
+
+ // not sure we need this
+ if (!cachedbaked)
+ {
+ if (m_scene.AvatarFactory != null)
+ m_scene.AvatarFactory.QueueAppearanceSave(UUID);
+ }
+ }
+ m_log.DebugFormat("[CompleteMovement] Baked check: {0}ms", Util.EnvironmentTickCountSubtract(ts));
+ }
if(m_teleportFlags > 0)
{
gotCrossUpdate = false; // sanity check
- Thread.Sleep(500); // let viewers catch us
+ if(Util.EnvironmentTickCountSubtract(delayctnr)< 500)
+ Thread.Sleep(500); // let viewers catch us
}
if(!gotCrossUpdate)
RotateToLookAt(look);
// HG
- bool isHGTP = (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0;
if(isHGTP)
{
// ControllingClient.SendNameReply(m_uuid, Firstname, Lastname);
@@ -2101,24 +2126,6 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsChildAgent)
{
- // verify baked textures and cache
- bool cachedbaked = false;
-
- if (IsNPC)
- cachedbaked = true;
- else
- {
- if (m_scene.AvatarFactory != null && !isHGTP)
- cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
-
- // not sure we need this
- if (!cachedbaked)
- {
- if (m_scene.AvatarFactory != null)
- m_scene.AvatarFactory.QueueAppearanceSave(UUID);
- }
- }
-
List allpresences = m_scene.GetScenePresences();
// send avatar object to all presences including us, so they cross it into region
--
cgit v1.1
From b23ce04a6e9b620a8b6b78ece58711754bb6c49f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Jan 2017 21:17:09 +0000
Subject: enforce effective perms hierarchy
---
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 101 ++++++++++++---------
1 file changed, 59 insertions(+), 42 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 5ecf352..b9fa8e4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -304,6 +304,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// aggregates perms scanning parts and their contents
+ // AggregatePerms does same using cached parts content perms
public void AggregateDeepPerms()
{
lock(PermissionsLock)
@@ -313,12 +314,16 @@ namespace OpenSim.Region.Framework.Scenes
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
- uint baseOwnerPerms = RootPart.OwnerMask;
- uint owner = baseOwnerPerms;
- uint baseGroupPerms = RootPart.GroupMask;
- uint group = baseGroupPerms;
- uint baseEveryonePerms = RootPart.EveryoneMask;
- uint everyone = baseEveryonePerms;
+ uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
+ bool noBaseTransfer = (RootPart.OwnerID != RootPart.GroupID &&
+ (basePerms & (uint)PermissionMask.Transfer) == 0);
+
+ uint rootOwnerPerms = RootPart.OwnerMask;
+ uint owner = rootOwnerPerms;
+ uint rootGroupPerms = RootPart.GroupMask;
+ uint group = rootGroupPerms;
+ uint rootEveryonePerms = RootPart.EveryoneMask;
+ uint everyone = rootEveryonePerms;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
@@ -330,42 +335,47 @@ namespace OpenSim.Region.Framework.Scenes
everyone &= part.AggregatedInnerEveryonePerms;
}
// recover modify and move
- baseOwnerPerms &= movemodmask;
- owner |= baseOwnerPerms;
+ rootOwnerPerms &= movemodmask;
+ owner |= rootOwnerPerms;
if((owner & copytransfermast) == 0)
owner |= (uint)PermissionMask.Transfer;
- owner &= allmask;
+
+ owner &= basePerms;
m_EffectiveOwnerPerms = owner;
// recover modify and move
- baseGroupPerms &= movemodmask;
- group |= baseGroupPerms;
- group &= allmask;
+ rootGroupPerms &= movemodmask;
+ group |= rootGroupPerms;
+ if(noBaseTransfer)
+ group &=~(uint)PermissionMask.Copy;
uint groupOrEveryone = group;
if((group & copytransfermast) == 0)
group |= (uint)PermissionMask.Transfer;
- m_EffectiveGroupPerms = group;
+ m_EffectiveGroupPerms = group & owner;
// recover move
- baseEveryonePerms &= (uint)PermissionMask.Move;
- everyone |= baseEveryonePerms;
- everyone &= allmask;
+ rootEveryonePerms &= (uint)PermissionMask.Move;
+ everyone |= rootEveryonePerms;
+ everyone &= ~(uint)PermissionMask.Modify;
+ if(noBaseTransfer)
+ everyone &=~(uint)PermissionMask.Copy;
groupOrEveryone |= everyone;
- if((everyone & copytransfermast) == 0) // not much sense but as sl
+ if((everyone & copytransfermast) == 0)
everyone |= (uint)PermissionMask.Transfer;
- m_EffectiveEveryOnePerms = everyone;
+ m_EffectiveEveryOnePerms = everyone & owner;
- if((groupOrEveryone & copytransfermast) == 0) // not much sense but as sl
+ if((groupOrEveryone & copytransfermast) == 0)
groupOrEveryone |= (uint)PermissionMask.Transfer;
- m_EffectiveGroupOrEveryOnePerms = groupOrEveryone;
+ m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
}
}
- // aggregates perms scanning parts, assuming their contents was already aggregated
+ // aggregates perms scanning parts, assuming their contents was already aggregated and cached
+ // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
public void AggregatePerms()
{
lock(PermissionsLock)
@@ -375,55 +385,62 @@ namespace OpenSim.Region.Framework.Scenes
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
- uint baseOwnerPerms = RootPart.OwnerMask;
- uint owner = baseOwnerPerms;
- uint baseGroupPerms = RootPart.GroupMask;
- uint group = baseGroupPerms;
- uint baseEveryonePerms = RootPart.EveryoneMask;
- uint everyone = baseEveryonePerms;
+ uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
+ bool noBaseTransfer = (RootPart.OwnerID == RootPart.GroupID &&
+ (basePerms & (uint)PermissionMask.Transfer) == 0);
+
+ uint rootOwnerPerms = RootPart.OwnerMask;
+ uint owner = rootOwnerPerms;
+ uint rootGroupPerms = RootPart.GroupMask;
+ uint group = rootGroupPerms;
+ uint rootEveryonePerms = RootPart.EveryoneMask;
+ uint everyone = rootEveryonePerms;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
SceneObjectPart part = parts[i];
- part.AggregateInnerPerms();
owner &= part.AggregatedInnerOwnerPerms;
group &= part.AggregatedInnerGroupPerms;
everyone &= part.AggregatedInnerEveryonePerms;
}
// recover modify and move
- baseOwnerPerms &= movemodmask;
- owner |= baseOwnerPerms;
+ rootOwnerPerms &= movemodmask;
+ owner |= rootOwnerPerms;
if((owner & copytransfermast) == 0)
owner |= (uint)PermissionMask.Transfer;
- owner &= allmask;
+
+ owner &= basePerms;
m_EffectiveOwnerPerms = owner;
// recover modify and move
- baseGroupPerms &= movemodmask;
- group |= baseGroupPerms;
- group &= allmask;
+ rootGroupPerms &= movemodmask;
+ group |= rootGroupPerms;
+ if(noBaseTransfer)
+ group &=~(uint)PermissionMask.Copy;
uint groupOrEveryone = group;
if((group & copytransfermast) == 0)
group |= (uint)PermissionMask.Transfer;
- m_EffectiveGroupPerms = group;
+ m_EffectiveGroupPerms = group & owner;
// recover move
- baseEveryonePerms &= (uint)PermissionMask.Move;
- everyone |= baseEveryonePerms;
- everyone &= allmask;
+ rootEveryonePerms &= (uint)PermissionMask.Move;
+ everyone |= rootEveryonePerms;
+ everyone &= ~(uint)PermissionMask.Modify;
+ if(noBaseTransfer)
+ everyone &=~(uint)PermissionMask.Copy;
groupOrEveryone |= everyone;
- if((everyone & copytransfermast) == 0) // not much sense but as sl
+ if((everyone & copytransfermast) == 0)
everyone |= (uint)PermissionMask.Transfer;
- m_EffectiveEveryOnePerms = everyone;
+ m_EffectiveEveryOnePerms = everyone & owner;
- if((groupOrEveryone & copytransfermast) == 0) // not much sense but as sl
+ if((groupOrEveryone & copytransfermast) == 0)
groupOrEveryone |= (uint)PermissionMask.Transfer;
- m_EffectiveGroupOrEveryOnePerms = groupOrEveryone;
+ m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
}
}
--
cgit v1.1
From 1ff7e3499620417f3f1e8173200bec2624d99f1a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 18 Jan 2017 22:25:49 +0000
Subject: a few more changes on Permissions module
---
.../World/Permissions/PermissionsModule.cs | 170 ++++++++++-----------
1 file changed, 80 insertions(+), 90 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 6e8ca55..d70cf61 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -882,9 +882,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (group == null)
return 0;
- if (IsAdministrator(currentUser))
- return (uint)PermissionMask.AllEffective;
-
SceneObjectPart root = group.RootPart;
if (root == null)
return 0;
@@ -892,6 +889,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
UUID objectOwner = group.OwnerID;
bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0);
+ if (IsAdministrator(currentUser))
+ {
+ // do lock on admin owned objects
+ if(locked && currentUser == objectOwner)
+ return (uint)(PermissionMask.AllEffective & ~PermissionMask.Modify);
+ return (uint)PermissionMask.AllEffective;
+ }
+
uint lockmask = (uint)PermissionMask.AllEffective;
if(locked)
lockmask &= ~(uint)PermissionMask.Modify;
@@ -1185,7 +1190,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return IsAdministrator(user);
}
- private bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition)
+ private bool CanDuplicateObject(int objectCount, UUID objectID, UUID userID, Scene scene, Vector3 objectPosition)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1194,15 +1199,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(owner, sog, false);
+ uint perms = GetObjectPermissions(userID, sog, false);
if((perms & (uint)PermissionMask.Copy) == 0)
return false;
+ if(sog.OwnerID != userID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+
//If they can rez, they can duplicate
- return CanRezObject(objectCount, owner, objectPosition, scene);
+ return CanRezObject(objectCount, userID, objectPosition, scene);
}
- private bool CanDeleteObject(UUID objectID, UUID deleter, Scene scene)
+ private bool CanDeleteObject(UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1211,13 +1219,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(deleter, sog, false);
+ // ignoring locked. viewers should warn and ask for confirmation
+ uint perms = GetObjectPermissions(userID, sog, false);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
return true;
}
- private bool CanEditObject(UUID objectID, UUID editorID, Scene scene)
+ private bool CanEditObject(UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1226,13 +1235,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(editorID, sog, true);
+ uint perms = GetObjectPermissions(userID, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
return true;
}
- private bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene)
+ private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1241,18 +1250,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(editorID, sog, true);
+ uint perms = GetObjectPermissions(userID, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
return true;
}
- private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
+ private bool CanEditParcelProperties(UUID userID, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericParcelOwnerPermission(user, parcel, (ulong)p, false);
+ return GenericParcelOwnerPermission(userID, parcel, (ulong)p, false);
}
///
@@ -1263,18 +1272,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanEditScript(UUID script, UUID objectID, UUID user, Scene scene)
+ private bool CanEditScript(UUID script, UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user))
+ if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(userID))
return false;
// Ordinarily, if you can view it, you can edit it
// There is no viewing a no mod script
//
- return CanViewScript(script, objectID, user, scene);
+ return CanViewScript(script, objectID, userID, scene);
}
///
@@ -1316,7 +1325,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
- SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ SceneObjectPart part = scene.GetSceneObjectPart(objectID);
+ if (part == null)
+ return false;
+
+ SceneObjectGroup sog = part.ParentGroup;
if (sog == null)
return false;
@@ -1325,10 +1338,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
- if (part == null)
- return false;
-
TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
if (ti == null)
return false;
@@ -1426,7 +1435,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
uint perms = GetObjectPermissions(moverID, sog, true);
if((perms & (uint)PermissionMask.Move) == 0)
return false;
- // admins exception ? if needed then should be done at GetObjectPermissions
return true;
}
@@ -1435,7 +1443,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
-
// allow outide region??
if (newPoint.X < -1f || newPoint.Y < -1f)
return true;
@@ -1656,12 +1663,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
}
- private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
+ private bool CanTakeObject(UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericObjectPermission(stealer,objectID, false);
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ // ignore locked, viewers shell ask for confirmation
+ uint perms = GetObjectPermissions(userID, sog, false);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+
+ if (sog.OwnerID != userID && ((perms & (uint)PermissionMask.Transfer) == 0))
+ return false;
+ return true;
}
private bool CanTakeCopyObject(UUID objectID, UUID userID, Scene inScene)
@@ -1669,44 +1687,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- bool permission = GenericObjectPermission(userID, objectID, false);
-
- SceneObjectGroup so = (SceneObjectGroup)m_scene.Entities[objectID];
-
- if (!permission)
- {
- if (!m_scene.Entities.ContainsKey(objectID))
- {
- return false;
- }
-
- // If it's not an object, we cant edit it.
- if (!(m_scene.Entities[objectID] is SceneObjectGroup))
- {
- return false;
- }
-
- // UUID taskOwner = null;
- // Added this because at this point in time it wouldn't be wise for
- // the administrator object permissions to take effect.
- // UUID objectOwner = task.OwnerID;
-
- if ((so.RootPart.EveryoneMask & PERM_COPY) != 0)
- permission = true;
- }
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
- if (so.OwnerID != userID)
- {
- if ((so.GetEffectivePermissions() & (PERM_COPY | PERM_TRANS)) != (PERM_COPY | PERM_TRANS))
- permission = false;
- }
- else
- {
- if ((so.GetEffectivePermissions() & PERM_COPY) != PERM_COPY)
- permission = false;
- }
+ uint perms = GetObjectPermissions(userID, sog, true);
+ if((perms & (uint)PermissionMask.Copy) == 0)
+ return false;
- return permission;
+ if(sog.OwnerID != userID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+ return true;
}
private bool CanTerraformLand(UUID user, Vector3 position, Scene requestFromScene)
@@ -1792,26 +1783,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else // Prim inventory
{
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
-
if (part == null)
return false;
- if (part.OwnerID != user)
- {
- if (part.GroupID == UUID.Zero)
- return false;
-
- if (!IsGroupMember(part.GroupID, user, 0))
- return false;
+ SceneObjectGroup sog = part.ParentGroup;
+ if (sog == null)
+ return false;
- if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
- return false;
- }
- else
- {
- if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
- return false;
- }
+ uint perms = GetObjectPermissions(user, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
TaskInventoryItem ti = part.Inventory.GetInventoryItem(script);
@@ -1876,20 +1857,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else // Prim inventory
{
SceneObjectPart part = scene.GetSceneObjectPart(objectID);
-
if (part == null)
return false;
- if (part.OwnerID != user)
- {
- if (part.GroupID == UUID.Zero)
- return false;
-
- if (!IsGroupMember(part.GroupID, user, 0))
- return false;
- }
+ SceneObjectGroup sog = part.ParentGroup;
+ if (sog == null)
+ return false;
- if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
+ uint perms = GetObjectPermissions(user, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
return false;
TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
@@ -1924,7 +1900,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericObjectPermission(userID, objectID, false);
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(userID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
}
private bool CanDelinkObject(UUID userID, UUID objectID)
@@ -1932,7 +1915,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return GenericObjectPermission(userID, objectID, false);
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(userID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
}
private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene)
--
cgit v1.1
From 3b96cd8ff2e764682ccadf7f04885302b07f964b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 00:51:55 +0000
Subject: add a GetItemPermissions() to be used use on object contents checks
in Permissions module
---
.../World/Permissions/PermissionsModule.cs | 99 ++++++++++++++++++----
1 file changed, 83 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index d70cf61..3264071 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -928,6 +928,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return group.EffectiveEveryOnePerms & lockmask;
}
+ private uint GetItemPermissions(TaskInventoryItem ti, UUID userID, bool notEveryone)
+ {
+ UUID tiOwnerID = ti.OwnerID;
+ if(tiOwnerID == userID)
+ return ti.CurrentPermissions;
+
+ // ??
+ if (IsFriendWithPerms(userID, tiOwnerID))
+ return ti.CurrentPermissions;
+
+ UUID tiGroupID = ti.GroupID;
+ if(tiGroupID != UUID.Zero)
+ {
+ ulong powers = 0;
+ if(GroupMemberPowers(tiGroupID, userID, ref powers))
+ {
+ if(tiGroupID == ti.OwnerID)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return ti.CurrentPermissions;
+ }
+ uint p = ti.GroupPermissions;
+ if(!notEveryone)
+ p |= ti.EveryonePermissions;
+ return p;
+ }
+ }
+
+ if(notEveryone)
+ return 0;
+
+ return ti.EveryonePermissions;
+ }
+
///
/// General permissions checks for any operation involving an object. These supplement more specific checks
/// implemented by callers.
@@ -1796,7 +1830,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
TaskInventoryItem ti = part.Inventory.GetInventoryItem(script);
- if (ti == null)
+// if (ti == null || ti.InvType != (int)InventoryType.LSL)
+ if (ti == null) // legacy may not have type
return false;
if (ti.OwnerID != user)
@@ -1870,6 +1905,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
TaskInventoryItem ti = part.Inventory.GetInventoryItem(notecard);
+// if (ti == null || ti.InvType != (int)InventoryType.Notecard)
if (ti == null)
return false;
@@ -1938,6 +1974,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
+ SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
+ if (part == null)
+ return false;
+
+ SceneObjectGroup sog = part.ParentGroup;
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(objectID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+
+ TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
+ if(ti == null)
+ return false;
+
+ //TODO item perm ?
return true;
}
@@ -1946,6 +1999,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
+ SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
+ if (part == null)
+ return false;
+
+ SceneObjectGroup sog = part.ParentGroup;
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(objectID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+
+ TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
+ if(ti == null)
+ return false;
+
+ //TODO item perm ?
return true;
}
@@ -1962,26 +2032,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
ScenePresence p = m_scene.GetScenePresence(userID);
- if (part == null || p == null)
+ if (p == null)
+ return false;
+
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(userID, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
return false;
- if (!IsAdministrator(userID))
+ if ((int)InventoryType.LSL == invType)
{
- if (part.OwnerID != userID)
- {
- // Group permissions
- if ((part.GroupID == UUID.Zero) || (p.ControllingClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0))
- return false;
- } else {
- if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
- return false;
- }
- if ((int)InventoryType.LSL == invType)
- if (m_allowedScriptCreators == UserSet.Administrators)
- return false;
+ if (m_allowedScriptCreators == UserSet.Administrators)
+ return false;
}
return true;
--
cgit v1.1
From b9ecc962ac1fa4acaa1c1a4dc1877fe21c70885d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 10:27:30 +0000
Subject: a few more aux methods and changes
---
.../World/Permissions/PermissionsModule.cs | 285 ++++++++++-----------
1 file changed, 133 insertions(+), 152 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 3264071..da4b826 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -497,32 +497,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
-/*
- private bool CheckGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask)
+ protected bool GroupMemberPowers(UUID groupID, ScenePresence sp, ref ulong powers)
{
- if(sp == null || sp.ControllingClient == null)
+ powers = 0;
+ IClientAPI client = sp.ControllingClient;
+ if (client == null)
return false;
-
- ulong grpPowers = sp.ControllingClient.GetGroupPowers(groupID);
-
- return (grpPowers & powersMask) != 0;
- }
- private bool CheckActiveGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask)
- {
- if(sp == null || sp.ControllingClient == null)
- return false;
-
- if(sp.ControllingClient.ActiveGroupId != groupID)
+ if(!client.IsGroupMember(groupID))
return false;
- // activeGroupPowers only get current selected role powers, at least with xmlgroups.
- // lets get any role avoiding the extra burden of user also having to change role
- // ulong grpPowers = sp.ControllingClient.ActiveGroupPowers(groupID);
- ulong grpPowers = sp.ControllingClient.GetGroupPowers(groupID);
-
- return (grpPowers & powersMask) != 0;
+
+ powers = client.GetGroupPowers(groupID);
+ return true;
}
-*/
+
///
/// Parse a user set configuration setting
///
@@ -693,6 +681,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
);
+ const uint LOCKED_GOD_FLAGS = (uint)(
+ PrimFlags.ObjectCopy | // Tells client you can copy the object
+ PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
+ PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object
+ PrimFlags.ObjectAnyOwner // Tells client that someone owns the object
+ );
+
public uint GenerateClientFlags(SceneObjectPart task, ScenePresence sp, uint curEffectivePerms)
{
if(sp == null || task == null || curEffectivePerms == 0)
@@ -703,21 +698,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
uint returnMask;
- // gods have owner rights with Modify and Move always on
- if(sp.IsGod)
- {
-// returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
-// returnMask |= EXTRAGODMASK;
-// return returnMask;
- return objflags | GOD_FLAGS;
- }
SceneObjectGroup grp = task.ParentGroup;
if(grp == null)
return 0;
+ UUID taskOwnerID = task.OwnerID;
+ UUID spID = sp.UUID;
+
bool unlocked = (grp.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
+ if(sp.IsGod)
+ {
+ // do locked on objects owned by admin
+ if(!unlocked && spID == taskOwnerID)
+ return objflags | LOCKED_GOD_FLAGS;
+ else
+ return objflags | GOD_FLAGS;
+ }
+
//bypass option == owner rights
if (m_bypassPermissions)
{
@@ -728,9 +727,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask;
}
- UUID taskOwnerID = task.OwnerID;
- UUID spID = sp.UUID;
-
// owner
if (spID == taskOwnerID)
{
@@ -765,12 +761,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// group owned or shared ?
IClientAPI client = sp.ControllingClient;
- if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID))
+ ulong powers = 0;
+ if(taskGroupID != UUID.Zero && GroupMemberPowers(taskGroupID, sp, ref powers))
{
if(groupdOwned)
{
// object is owned by group, check role powers
- if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0)
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
{
returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
returnMask |=
@@ -838,7 +835,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return objectFlagsMask;
}
- // OARs need this method that handles offline users
+ // OARs still need this method that handles offline users
public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj)
{
if (obj == null)
@@ -869,14 +866,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return PermissionClass.Everyone;
}
- ///
- /// General permissions checks for any operation involving an object. These supplement more specific checks
- /// implemented by callers.
- ///
- ///
- /// This is a scene object group UUID
- ///
- ///
protected uint GetObjectPermissions(UUID currentUser, SceneObjectGroup group, bool denyOnLocked)
{
if (group == null)
@@ -893,13 +882,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
{
// do lock on admin owned objects
if(locked && currentUser == objectOwner)
- return (uint)(PermissionMask.AllEffective & ~PermissionMask.Modify);
+ return (uint)(PermissionMask.AllEffective & ~(PermissionMask.Modify | PermissionMask.Move));
return (uint)PermissionMask.AllEffective;
}
uint lockmask = (uint)PermissionMask.AllEffective;
if(locked)
- lockmask &= ~(uint)PermissionMask.Modify;
+ lockmask &= ~(uint)(PermissionMask.Modify | PermissionMask.Move);
if (currentUser == objectOwner)
return group.EffectiveOwnerPerms & lockmask;
@@ -928,7 +917,59 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return group.EffectiveEveryOnePerms & lockmask;
}
- private uint GetItemPermissions(TaskInventoryItem ti, UUID userID, bool notEveryone)
+ protected uint GetObjectPermissions(ScenePresence sp, SceneObjectGroup group, bool denyOnLocked)
+ {
+ if (sp == null || sp.IsDeleted || group == null || group.IsDeleted)
+ return 0;
+
+ SceneObjectPart root = group.RootPart;
+ if (root == null)
+ return 0;
+
+ UUID spID = sp.UUID;
+ UUID objectOwner = group.OwnerID;
+
+ bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0);
+
+ if (sp.IsGod)
+ {
+ if(locked && spID == objectOwner)
+ return (uint)(PermissionMask.AllEffective & ~(PermissionMask.Modify | PermissionMask.Move));
+ return (uint)PermissionMask.AllEffective;
+ }
+
+ uint lockmask = (uint)PermissionMask.AllEffective;
+ if(locked)
+ lockmask &= ~(uint)(PermissionMask.Modify | PermissionMask.Move);
+
+ if (spID == objectOwner)
+ return group.EffectiveOwnerPerms & lockmask;
+
+ if (group.IsAttachment)
+ return 0;
+
+ if (IsFriendWithPerms(spID, objectOwner))
+ return group.EffectiveOwnerPerms & lockmask;
+
+ UUID sogGroupID = group.GroupID;
+ if (sogGroupID != UUID.Zero)
+ {
+ ulong powers = 0;
+ if(GroupMemberPowers(sogGroupID, sp, ref powers))
+ {
+ if(sogGroupID == objectOwner)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return group.EffectiveOwnerPerms & lockmask;
+ }
+ return group.EffectiveGroupOrEveryOnePerms & lockmask;
+ }
+ }
+
+ return group.EffectiveEveryOnePerms & lockmask;
+ }
+
+ private uint GetObjectItemPermissions(UUID userID, TaskInventoryItem ti, bool notEveryone)
{
UUID tiOwnerID = ti.OwnerID;
if(tiOwnerID == userID)
@@ -962,107 +1003,41 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return ti.EveryonePermissions;
}
- ///
- /// General permissions checks for any operation involving an object. These supplement more specific checks
- /// implemented by callers.
- ///
- ///
- /// This is a scene object group UUID
- ///
- ///
- protected bool GenericObjectPermission(UUID currentUser, UUID objId, bool denyOnLocked)
+ private uint GetObjectItemPermissions(ScenePresence sp, TaskInventoryItem ti, bool notEveryone)
{
- // Default: deny
- bool permission = false;
- bool locked = false;
-
- SceneObjectPart part = m_scene.GetSceneObjectPart(objId);
-
- if (part == null)
- return false;
-
- SceneObjectGroup group = part.ParentGroup;
-
- UUID objectOwner = group.OwnerID;
- locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
-
- // People shouldn't be able to do anything with locked objects, except the Administrator
- // The 'set permissions' runs through a different permission check, so when an object owner
- // sets an object locked, the only thing that they can do is unlock it.
- //
- // Nobody but the object owner can set permissions on an object
- //
- if (locked && (!IsAdministrator(currentUser)) && denyOnLocked)
- {
- return false;
- }
-
- // Object owners should be able to edit their own content
- if (currentUser == objectOwner)
- {
- // there is no way that later code can change this back to false
- // so just return true immediately and short circuit the more
- // expensive group checks
- return true;
-
- //permission = true;
- }
- else if (group.IsAttachment)
- {
- permission = false;
- }
-
-// m_log.DebugFormat(
-// "[PERMISSIONS]: group.GroupID = {0}, part.GroupMask = {1}, isGroupMember = {2} for {3}",
-// group.GroupID,
-// m_scene.GetSceneObjectPart(objId).GroupMask,
-// IsGroupMember(group.GroupID, currentUser, 0),
-// currentUser);
-
- // Group members should be able to edit group objects
- if ((group.GroupID != UUID.Zero)
- && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0)
- && IsGroupMember(group.GroupID, currentUser, 0))
- {
- // Return immediately, so that the administrator can shares group objects
- return true;
- }
-
- // Friends with benefits should be able to edit the objects too
- if (IsFriendWithPerms(currentUser, objectOwner))
- {
- // Return immediately, so that the administrator can share objects with friends
- return true;
- }
-
- // Users should be able to edit what is over their land.
- ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
- if ((parcel != null) && (parcel.LandData.OwnerID == currentUser))
- {
- permission = true;
- }
+ UUID tiOwnerID = ti.OwnerID;
+ UUID spID = sp.UUID;
- // Estate users should be able to edit anything in the sim
- if (IsEstateManager(currentUser))
- {
- permission = true;
- }
+ if(tiOwnerID == spID)
+ return ti.CurrentPermissions;
+
+ // ??
+ if (IsFriendWithPerms(spID, tiOwnerID))
+ return ti.CurrentPermissions;
- // Admin objects should not be editable by the above
- if (IsAdministrator(objectOwner))
+ UUID tiGroupID = ti.GroupID;
+ if(tiGroupID != UUID.Zero)
{
- permission = false;
+ ulong powers = 0;
+ if(GroupMemberPowers(tiGroupID, spID, ref powers))
+ {
+ if(tiGroupID == ti.OwnerID)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return ti.CurrentPermissions;
+ }
+ uint p = ti.GroupPermissions;
+ if(!notEveryone)
+ p |= ti.EveryonePermissions;
+ return p;
+ }
}
- // Admin should be able to edit anything in the sim (including admin objects)
- if (IsAdministrator(currentUser))
- {
- permission = true;
- }
+ if(notEveryone)
+ return 0;
- return permission;
+ return ti.EveryonePermissions;
}
-
#endregion
#region Generic Permissions
@@ -1541,12 +1516,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
IClientAPI client = sp.ControllingClient;
-
+ uint perms;
foreach (SceneObjectGroup g in new List(objects))
{
- // Any user can return their own objects at any time
- //
- if (GenericObjectPermission(user, g.UUID, false))
+ perms = GetObjectPermissions(sp, g, false);
+ if((perms & (uint)PermissionMask.Modify) == 0) //??
continue;
// This is a short cut for efficiency. If land is non-null,
@@ -2122,19 +2096,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanResetScript(UUID prim, UUID script, UUID agentID, Scene scene)
+ private bool CanResetScript(UUID primID, UUID script, UUID agentID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectPart part = m_scene.GetSceneObjectPart(prim);
-
- // If we selected a sub-prim to reset, prim won't represent the object, but only a part.
- // We have to check the permissions of the object, though.
- if (part.ParentID != 0) prim = part.ParentUUID;
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(primID);
+ if (sog == null)
+ return false;
- // You can reset the scripts in any object you can edit
- return GenericObjectPermission(agentID, prim, false);
+ uint perms = GetObjectPermissions(agentID, sog, false);
+ if((perms & (uint)PermissionMask.Modify) == 0) // ??
+ return false;
+ return true;
}
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
@@ -2195,7 +2169,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// "[PERMISSIONS]: Checking CanControlPrimMedia for {0} on {1} face {2} with control permissions {3}",
// agentID, primID, face, me.ControlPermissions);
- return GenericObjectPermission(agentID, part.ParentGroup.UUID, true);
+ SceneObjectGroup sog = part.ParentGroup;
+ if (sog == null)
+ return false;
+
+ uint perms = GetObjectPermissions(agentID, sog, false);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
}
private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
--
cgit v1.1
From fe9a785ecc8747df2b15575f0d0bd88025db881b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 11:34:40 +0000
Subject: object Take and TakeCopy are for in scene SOPs and SPs and permitions
module is NOT a shared module
---
.../Avatar/Attachments/AttachmentsModule.cs | 5 +++--
.../InventoryAccess/HGInventoryAccessModule.cs | 11 ++++-----
.../World/Permissions/PermissionsModule.cs | 26 +++++++++++++---------
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++--
.../Region/Framework/Scenes/Scene.Permissions.cs | 12 +++++-----
5 files changed, 35 insertions(+), 25 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 8b8ac20..a900a2a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -1322,7 +1322,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (part == null)
return;
- if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
+ SceneObjectGroup group = part.ParentGroup;
+
+ if (!m_scene.Permissions.CanTakeObject(group, sp))
{
remoteClient.SendAgentAlertMessage(
"You don't have sufficient permissions to attach this object", false);
@@ -1334,7 +1336,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
AttachmentPt &= 0x7f;
// Calls attach with a Zero position
- SceneObjectGroup group = part.ParentGroup;
if (AttachObject(sp, group , AttachmentPt, false, true, append))
{
if (DebugLevel > 0)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 95e7456..ba3a7c9 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -541,16 +541,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
#region Permissions
- private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
+ private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
{
if (m_bypassPermissions) return true;
- if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer))
+ if(sp == null || sog == null)
+ return false;
+
+ if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(sp.UUID))
{
- SceneObjectGroup sog = null;
- if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer)
+ if (sog.OwnerID == sp.UUID)
return true;
-
return false;
}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index da4b826..3f310c7 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1671,39 +1671,45 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
}
- private bool CanTakeObject(UUID objectID, UUID userID, Scene scene)
+ private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
- if (sog == null)
+ if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
+ return false;
+
+ // take is not a attachment op
+ if(sog.IsAttachment)
return false;
// ignore locked, viewers shell ask for confirmation
- uint perms = GetObjectPermissions(userID, sog, false);
+ uint perms = GetObjectPermissions(sp, sog, false);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
- if (sog.OwnerID != userID && ((perms & (uint)PermissionMask.Transfer) == 0))
+ if (sog.OwnerID != sp.UUID && ((perms & (uint)PermissionMask.Transfer) == 0))
return false;
return true;
}
- private bool CanTakeCopyObject(UUID objectID, UUID userID, Scene inScene)
+ private bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
- if (sog == null)
+ if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
return false;
- uint perms = GetObjectPermissions(userID, sog, true);
+ // refuse on attachments
+ if(sog.IsAttachment && !sp.IsGod)
+ return false;
+
+ uint perms = GetObjectPermissions(sp, sog, true);
if((perms & (uint)PermissionMask.Copy) == 0)
return false;
- if(sog.OwnerID != userID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
+ if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
return false;
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 473589a..ad913f7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2126,6 +2126,8 @@ namespace OpenSim.Region.Framework.Scenes
List deleteGroups = new List();
List takeGroups = new List();
+ ScenePresence sp = remoteClient.SceneAgent as ScenePresence;
+
// Start with true for both, then remove the flags if objects
// that we can't derez are part of the selection
bool permissionToTake = true;
@@ -2180,14 +2182,14 @@ namespace OpenSim.Region.Framework.Scenes
{
if (action == DeRezAction.TakeCopy)
{
- if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
+ if (!Permissions.CanTakeCopyObject(grp, sp))
permissionToTakeCopy = false;
}
else
{
permissionToTakeCopy = false;
}
- if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
+ if (!Permissions.CanTakeObject(grp, sp))
permissionToTake = false;
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e42d4c2..8194606 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -44,9 +44,9 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
- public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
+ public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
- public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
+ public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region TAKE OBJECT
- public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
+ public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
{
bool result = true;
@@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (TakeObjectHandler h in list)
{
- if (h(objectID, AvatarTakingUUID, m_scene) == false)
+ if (h(sog, sp) == false)
{
result = false;
break;
@@ -357,7 +357,7 @@ namespace OpenSim.Region.Framework.Scenes
#region TAKE COPY OBJECT
- public bool CanTakeCopyObject(UUID objectID, UUID userID)
+ public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
{
bool result = true;
@@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (TakeCopyObjectHandler h in list)
{
- if (h(objectID, userID, m_scene) == false)
+ if (h(sog, sp) == false)
{
result = false;
break;
--
cgit v1.1
From 673bd3721948b376d6be14e346d616863ca943cf Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 12:35:00 +0000
Subject: object CanMove is for in scene SOGs Icleints and SPs and permitions
module is NOT a shared module
---
.../World/Permissions/PermissionsModule.cs | 21 +++-----
.../Framework/Scenes/Scene.PacketHandlers.cs | 6 +--
.../Region/Framework/Scenes/Scene.Permissions.cs | 13 +++--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 61 ++++++----------------
.../Scenes/Tests/SceneObjectCrossingTests.cs | 37 +++++++------
5 files changed, 57 insertions(+), 81 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 3f310c7..4f62827 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1420,28 +1420,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericEstatePermission(user);
}
- private bool CanMoveObject(UUID objectID, UUID moverID, Scene scene)
+ private bool CanMoveObject(SceneObjectGroup sog, ScenePresence sp)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+
+ if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
+ return false;
+
if (m_bypassPermissions)
{
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
- if(part == null)
+ if (sog.OwnerID != sp.UUID && sog.IsAttachment)
return false;
-
- if (part.OwnerID != moverID)
- {
- if (part.ParentGroup.IsDeleted || part.ParentGroup.IsAttachment)
- return false;
- }
return m_bypassPermissionsValue;
}
- SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
- if (sog == null)
- return false;
-
- uint perms = GetObjectPermissions(moverID, sog, true);
+ uint perms = GetObjectPermissions(sp, sog, true);
if((perms & (uint)PermissionMask.Move) == 0)
return false;
return true;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index f2d853d..940f80c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -325,7 +325,7 @@ namespace OpenSim.Region.Framework.Scenes
if(group == null || group.IsDeleted)
return;
- if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
+ if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
{
group.GrabMovement(objectID, offset, pos, remoteClient);
}
@@ -386,7 +386,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(objectID);
if (group != null)
{
- if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
+ if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
{
group.SpinStart(remoteClient);
}
@@ -404,7 +404,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(objectID);
if (group != null)
{
- if (Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))// && PermissionsMngr.)
+ if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
{
group.SpinMovement(rotation, remoteClient);
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 8194606..b2801ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
- public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
+ public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List objects, Scene scene);
public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
@@ -450,15 +450,22 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region MOVE OBJECT
- public bool CanMoveObject(UUID objectID, UUID moverID)
+ public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
{
+ if(sog == null || client == null)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+ if(sp == null)
+ return false;
+
MoveObjectHandler handler = OnMoveObject;
if (handler != null)
{
Delegate[] list = handler.GetInvocationList();
foreach (MoveObjectHandler h in list)
{
- if (h(objectID, moverID, m_scene) == false)
+ if (h(sog, sp) == false)
return false;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 7a97bfc..ba2ee04 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1379,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0)
{
// Are we allowed to move it?
- if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanMoveObject(grp, remoteClient))
{
// Strip all but move and rotation from request
data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation);
@@ -1474,7 +1474,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
{
group.UpdateSingleRotation(rot, localID);
}
@@ -1492,7 +1492,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
{
group.UpdateSingleRotation(rot, pos, localID);
}
@@ -1510,7 +1510,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
{
group.UpdateGroupRotationR(rot);
}
@@ -1529,7 +1529,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
{
group.UpdateGroupRotationPR(pos, rot);
}
@@ -1547,7 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment)
+ if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) || group.IsAttachment)
{
group.UpdateSinglePosition(pos, localID);
}
@@ -1562,17 +1562,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient)
{
- UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId);
- }
-
- ///
- /// Update the position of the given group.
- ///
- ///
- ///
- ///
- public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId)
- {
SceneObjectGroup group = GetGroupByPrim(localId);
if (group != null)
@@ -1589,7 +1578,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
- if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId)
+ if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)
&& m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
{
group.UpdateGroupPosition(pos);
@@ -2025,27 +2014,9 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
{
- UUID user = remoteClient.AgentId;
- UUID objid = UUID.Zero;
- SceneObjectPart obj = null;
-
- EntityBase[] entityList = GetEntities();
- foreach (EntityBase ent in entityList)
- {
- if (ent is SceneObjectGroup)
- {
- SceneObjectGroup sog = ent as SceneObjectGroup;
-
- foreach (SceneObjectPart part in sog.Parts)
- {
- if (part.LocalId == localID)
- {
- objid = part.UUID;
- obj = part;
- }
- }
- }
- }
+ SceneObjectGroup sog = GetGroupByPrim(localID);
+ if(sog == null)
+ return;
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
//aka ObjectFlags.JointWheel = IncludeInSearch
@@ -2062,15 +2033,15 @@ namespace OpenSim.Region.Framework.Scenes
// libomv will complain about PrimFlags.JointWheel being
// deprecated, so we
#pragma warning disable 0612
- if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user))
+ if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
{
- obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel);
- obj.ParentGroup.HasGroupChanged = true;
+ sog.RootPart.AddFlag(PrimFlags.JointWheel);
+ sog.HasGroupChanged = true;
}
- else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user))
+ else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(sog, remoteClient))
{
- obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel);
- obj.ParentGroup.HasGroupChanged = true;
+ sog.RootPart.RemFlag(PrimFlags.JointWheel);
+ sog.HasGroupChanged = true;
}
#pragma warning restore 0612
}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
index e1e973c..abf8c48 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs
@@ -157,29 +157,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Cross
sceneA.SceneGraph.UpdatePrimGroupPosition(
- so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId);
+ so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient);
// crossing is async
Thread.Sleep(500);
SceneObjectGroup so1PostCross;
- {
- ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId);
- Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
+ ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId);
+ Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false");
- ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId);
- TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient);
- sceneBTc.CompleteMovement();
+ ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId);
+ TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient);
+ sceneBTc.CompleteMovement();
- Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
- Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject);
+ Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true");
+ Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject);
+
+ Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
+ so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
+ Assert.NotNull(so1PostCross);
+ Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
- Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck");
- so1PostCross = sceneB.GetSceneObjectGroup(so1Id);
- Assert.NotNull(so1PostCross);
- Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount());
- }
Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition;
@@ -187,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Recross
sceneB.SceneGraph.UpdatePrimGroupPosition(
- so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId);
+ so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient);
// crossing is async
Thread.Sleep(500);
@@ -255,13 +254,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
lmmA.EventManagerOnNoLandDataFromStorage();
lmmB.EventManagerOnNoLandDataFromStorage();
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
+ TestClient tc = new TestClient(acd, sceneA);
+ List destinationTestClients = new List();
+ EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
+ ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd);
+
SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
UUID so1Id = so1.UUID;
so1.AbsolutePosition = new Vector3(128, 10, 20);
// Cross with a negative value. We must make this call rather than setting AbsolutePosition directly
// because only this will execute permission checks in the source region.
- sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId);
+ sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), sp1SceneA.ControllingClient);
// crossing is async
Thread.Sleep(500);
--
cgit v1.1
From 7651d60d72d16179ab95a1e1bc8ac6c17379f08f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 12:47:14 +0000
Subject: fix a null check
---
OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index b2801ea..e066c0a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -455,10 +455,11 @@ namespace OpenSim.Region.Framework.Scenes
if(sog == null || client == null)
return false;
- ScenePresence sp = client.SceneAgent as ScenePresence;
- if(sp == null)
+ if(client.SceneAgent == null)
return false;
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+
MoveObjectHandler handler = OnMoveObject;
if (handler != null)
{
--
cgit v1.1
From 984345a2022ba805869990e0c495af08ffe40ce9 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 13:10:04 +0000
Subject: add CanEdit check for SOGs, iclients and SPs that need to be in scene
and use it
---
.../World/Permissions/PermissionsModule.cs | 17 ++++++++-
.../Region/Framework/Scenes/Scene.Permissions.cs | 44 +++++++++++++++++-----
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 20 +++++-----
3 files changed, 60 insertions(+), 21 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 4f62827..1c8d4b8 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -283,6 +283,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnIsEstateManager += IsEstateManager;
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
m_scene.Permissions.OnDeleteObject += CanDeleteObject;
+ m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
m_scene.Permissions.OnEditObject += CanEditObject;
m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
m_scene.Permissions.OnInstantMessage += CanInstantMessage;
@@ -1235,7 +1236,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanEditObject(UUID objectID, UUID userID, Scene scene)
+ private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1250,6 +1251,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
+ private bool CanEditObject(SceneObjectGroup sog, ScenePresence sp)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
+ return false;
+
+ uint perms = GetObjectPermissions(sp, sog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ return true;
+ }
+
private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e066c0a..3491792 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -48,7 +48,8 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
- public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
+ public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene);
+ public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
@@ -118,6 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
public event SellGroupObjectHandler OnSellGroupObject;
public event TakeCopyObjectHandler OnTakeCopyObject;
public event DuplicateObjectHandler OnDuplicateObject;
+ public event EditObjectByIDsHandler OnEditObjectByIDs;
public event EditObjectHandler OnEditObject;
public event EditObjectInventoryHandler OnEditObjectInventory;
public event MoveObjectHandler OnMoveObject;
@@ -307,6 +309,9 @@ namespace OpenSim.Region.Framework.Scenes
TakeObjectHandler handler = OnTakeObject;
if (handler != null)
{
+ if(sog == null || sp == null)
+ return false;
+
Delegate[] list = handler.GetInvocationList();
foreach (TakeObjectHandler h in list)
{
@@ -364,6 +369,8 @@ namespace OpenSim.Region.Framework.Scenes
TakeCopyObjectHandler handler = OnTakeCopyObject;
if (handler != null)
{
+ if(sog == null || sp == null)
+ return false;
Delegate[] list = handler.GetInvocationList();
foreach (TakeCopyObjectHandler h in list)
{
@@ -419,13 +426,33 @@ namespace OpenSim.Region.Framework.Scenes
#region EDIT OBJECT
public bool CanEditObject(UUID objectID, UUID editorID)
{
+ EditObjectByIDsHandler handler = OnEditObjectByIDs;
+ if (handler != null)
+ {
+ Delegate[] list = handler.GetInvocationList();
+ foreach (EditObjectByIDsHandler h in list)
+ {
+ if (h(objectID, editorID, m_scene) == false)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
+ {
EditObjectHandler handler = OnEditObject;
if (handler != null)
{
+ if(sog == null || client == null || client.SceneAgent == null)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+
Delegate[] list = handler.GetInvocationList();
foreach (EditObjectHandler h in list)
{
- if (h(objectID, editorID, m_scene) == false)
+ if (h(sog, sp) == false)
return false;
}
}
@@ -452,17 +479,14 @@ namespace OpenSim.Region.Framework.Scenes
#region MOVE OBJECT
public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
{
- if(sog == null || client == null)
- return false;
-
- if(client.SceneAgent == null)
- return false;
-
- ScenePresence sp = client.SceneAgent as ScenePresence;
-
MoveObjectHandler handler = OnMoveObject;
if (handler != null)
{
+ if(sog == null || client == null || client.SceneAgent == null)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+
Delegate[] list = handler.GetInvocationList();
foreach (MoveObjectHandler h in list)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index ba2ee04..6a36982 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1358,7 +1358,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup grp = part.ParentGroup;
if (grp != null)
{
- if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(grp, remoteClient))
{
// These two are exceptions SL makes in the interpretation
// of the change flags. Must check them here because otherwise
@@ -1406,7 +1406,7 @@ namespace OpenSim.Region.Framework.Scenes
if (part != null)
{
- if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient))
{
bool physbuild = false;
if (part.ParentGroup.RootPart.PhysActor != null)
@@ -1428,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
bool physbuild = false;
if (group.RootPart.PhysActor != null)
@@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
group.UpdateTextureEntry(localID, texture);
}
@@ -1627,7 +1627,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
// VolumeDetect can't be set via UI and will always be off when a change is made there
// now only change volume dtc if phantom off
@@ -1674,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
group.SetPartName(Util.CleanString(name), primLocalID);
group.HasGroupChanged = true;
@@ -1692,7 +1692,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
group.SetPartDescription(Util.CleanString(description), primLocalID);
group.HasGroupChanged = true;
@@ -1714,7 +1714,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
if (part != null)
@@ -1731,7 +1731,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
- if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
+ if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
{
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
if (part != null)
@@ -2033,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
// libomv will complain about PrimFlags.JointWheel being
// deprecated, so we
#pragma warning disable 0612
- if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
+ if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient))
{
sog.RootPart.AddFlag(PrimFlags.JointWheel);
sog.HasGroupChanged = true;
--
cgit v1.1
From b9651652e11d354b3acb8283e99a90f5ec66a920 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 13:25:00 +0000
Subject: add a comment about parts permissions aggregation
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 69d8288..0544696 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2551,6 +2551,8 @@ namespace OpenSim.Region.Framework.Scenes
public void AggregateInnerPerms()
{
+ // assuming child prims permissions masks are irrelevant on a linkset
+ // root part is handle at SOG since its masks are the sog masks
const uint mask = (uint)PermissionMask.AllEffective;
uint owner = mask;
--
cgit v1.1
From d8108ab740d9a6ad782476fc43b62ec4c36b30b3 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 17:45:54 +0000
Subject: change CanDeedObject. WARNING like on other grids, if you do not set
next owner rights on object and ALL ITS CONTENTS, you may loose all rights on
it
---
.../World/Permissions/PermissionsModule.cs | 41 ++++++++++++++++------
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 13 ++-----
.../Region/Framework/Scenes/Scene.Permissions.cs | 11 ++++--
3 files changed, 41 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 1c8d4b8..b4c5072 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -71,12 +71,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#region Constants
// These are here for testing. They will be taken out
- //private uint PERM_ALL = (uint)2147483647;
- private uint PERM_COPY = (uint)32768;
- //private uint PERM_MODIFY = (uint)16384;
- private uint PERM_MOVE = (uint)524288;
- private uint PERM_TRANS = (uint)8192;
-// private uint PERM_LOCKED = (uint)540672;
private uint PERM_LOCKED = (uint)524288; // same as move
///
@@ -867,6 +861,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return PermissionClass.Everyone;
}
+ // get effective object permissions using user UUID. User rights will be fixed
protected uint GetObjectPermissions(UUID currentUser, SceneObjectGroup group, bool denyOnLocked)
{
if (group == null)
@@ -918,6 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return group.EffectiveEveryOnePerms & lockmask;
}
+ // get effective object permissions using present presence. So some may depend on requested rights (ie God)
protected uint GetObjectPermissions(ScenePresence sp, SceneObjectGroup group, bool denyOnLocked)
{
if (sp == null || sp.IsDeleted || group == null || group.IsDeleted)
@@ -1178,15 +1174,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false);
}
- private bool CanDeedObject(UUID user, UUID group, Scene scene)
+ private bool CanDeedObject(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- ScenePresence sp = scene.GetScenePresence(user);
- IClientAPI client = sp.ControllingClient;
+ if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted || targetGroupID == UUID.Zero)
+ return false;
+
+ // object has group already?
+ if(sog.GroupID != targetGroupID)
+ return false;
+
+ // is effectivelly shared?
+ if(sog.EffectiveGroupPerms == 0)
+ return false;
+
+ if(sp.IsGod)
+ return true;
+
+ // owned by requester?
+ if(sog.OwnerID != sp.UUID)
+ return false;
+
+ // owner can transfer?
+ if((sog.EffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+
+ // group member ?
+ ulong powers = 0;
+ if(!GroupMemberPowers(targetGroupID, sp, ref powers))
+ return false;
- if ((client.GetGroupPowers(group) & (ulong)GroupPowers.DeedObject) == 0)
+ // has group rights?
+ if ((powers & (ulong)GroupPowers.DeedObject) == 0)
return false;
return true;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index ad913f7..3230a2b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2717,9 +2717,6 @@ namespace OpenSim.Region.Framework.Scenes
{
if (ownerID != UUID.Zero)
return;
-
- if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID))
- return;
}
List groups = new List();
@@ -2750,15 +2747,9 @@ namespace OpenSim.Region.Framework.Scenes
child.TriggerScriptChangedEvent(Changed.OWNER);
}
}
- else // The object was deeded to the group
+ else // The object deeded to the group
{
- if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId)
- continue;
-
- if (!Permissions.CanTransferObject(sog.UUID, groupID))
- continue;
-
- if (sog.GroupID != groupID)
+ if (!Permissions.CanDeedObject(remoteClient, sog, groupID))
continue;
sog.SetOwnerId(groupID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 3491792..a7f3dd7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene);
+ public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool LinkObjectHandler(UUID user, UUID objectID);
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
@@ -934,15 +934,20 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
- public bool CanDeedObject(UUID user, UUID group)
+ public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID)
{
DeedObjectHandler handler = OnDeedObject;
if (handler != null)
{
+ if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+
Delegate[] list = handler.GetInvocationList();
foreach (DeedObjectHandler h in list)
{
- if (h(user, group, m_scene) == false)
+ if (h(sp, sog, targetGroupID) == false)
return false;
}
}
--
cgit v1.1
From 6826ca9b57e8582722efe3f9626148b2e52ef160 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 18:25:25 +0000
Subject: fix the meaning of objectDuplicate[OnRay]() flags parameter but still
not using it
---
OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++---
.../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 2 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 10 +++++++---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +-
OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | 2 +-
5 files changed, 13 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 7455dea..410ac00 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -7758,10 +7758,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ObjectDuplicate handlerObjectDuplicate = null;
- for (int i = 0; i < dupe.ObjectData.Length; i++)
+ handlerObjectDuplicate = OnObjectDuplicate;
+ if (handlerObjectDuplicate != null)
{
- handlerObjectDuplicate = OnObjectDuplicate;
- if (handlerObjectDuplicate != null)
+ for (int i = 0; i < dupe.ObjectData.Length; i++)
{
UUID rezGroupID = dupe.AgentData.GroupID;
if(!IsGroupMember(rezGroupID))
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 0d8ece7..a349aa1 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
m_scene.AddNewSceneObject(sog, false);
- m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
+ m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, m_userId, UUID.Zero, Quaternion.Identity, false);
Assert.That(pc.Owner, Is.EqualTo(6));
Assert.That(pc.Group, Is.EqualTo(0));
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ff1e34e..d9b0327 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3605,7 +3605,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Group of new object
public void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
{
- SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Identity);
+ bool createSelected = (flags & (uint)PrimFlags.CreateSelected) != 0;
+ SceneObjectGroup copy = SceneGraph.DuplicateObject(originalPrim, offset, AgentID,
+ GroupID, Quaternion.Identity, createSelected);
if (copy != null)
EventManager.TriggerObjectAddedToScene(copy);
}
@@ -3635,6 +3637,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart target = GetSceneObjectPart(localID);
SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj);
+ bool createSelected = (dupeFlags & (uint)PrimFlags.CreateSelected) != 0;
+
if (target != null && target2 != null)
{
Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
@@ -3676,13 +3680,13 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion worldRot = target2.GetWorldRotation();
// SceneObjectGroup obj = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
- copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, worldRot);
+ copy = m_sceneGraph.DuplicateObject(localID, pos, AgentID, GroupID, worldRot, createSelected);
//obj.Rotation = worldRot;
//obj.UpdateGroupRotationR(worldRot);
}
else
{
- copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
+ copy = m_sceneGraph.DuplicateObject(localID, pos, AgentID, GroupID, Quaternion.Identity, createSelected);
}
if (copy != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 6a36982..ebf081e 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -2057,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes
///
/// null if duplication fails, otherwise the duplicated object
///
- public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
+ public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, UUID AgentID, UUID GroupID, Quaternion rot, bool createSelected)
{
// m_log.DebugFormat(
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 56723bf..4d2eb3f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectGroup dupeSo
= scene.SceneGraph.DuplicateObject(
- part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity);
+ part1.LocalId, new Vector3(10, 0, 0), ownerId, UUID.Zero, Quaternion.Identity, false);
Assert.That(dupeSo.Parts.Length, Is.EqualTo(2));
SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
--
cgit v1.1
From 97e6f21c6c7933c95cf74b0dc4613d267a5905ab Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 18:33:00 +0000
Subject: actually make use of it as viewers requested
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index ebf081e..fc13692 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -2113,12 +2113,7 @@ namespace OpenSim.Region.Framework.Scenes
// PROBABLE END OF FIXME
- // Since we copy from a source group that is in selected
- // state, but the copy is shown deselected in the viewer,
- // We need to clear the selection flag here, else that
- // prim never gets persisted at all. The client doesn't
- // think it's selected, so it will never send a deselect...
- copy.IsSelected = false;
+ copy.IsSelected = createSelected;
if (rot != Quaternion.Identity)
copy.UpdateGroupRotationR(rot);
--
cgit v1.1
From 69bcbd856b8785b2912fa4ceac7411967756107c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 19 Jan 2017 19:01:56 +0000
Subject: change CanDuplicateObject
---
.../Region/CoreModules/World/Permissions/PermissionsModule.cs | 11 +++++------
OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 11 ++++++++---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +--
.../OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | 8 +++++---
4 files changed, 19 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b4c5072..341bd7e 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1221,24 +1221,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return IsAdministrator(user);
}
- private bool CanDuplicateObject(int objectCount, UUID objectID, UUID userID, Scene scene, Vector3 objectPosition)
+ private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
- if (sog == null)
+ if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
return false;
- uint perms = GetObjectPermissions(userID, sog, false);
+ uint perms = GetObjectPermissions(sp, sog, false);
if((perms & (uint)PermissionMask.Copy) == 0)
return false;
- if(sog.OwnerID != userID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
+ if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
return false;
//If they can rez, they can duplicate
- return CanRezObject(objectCount, userID, objectPosition, scene);
+ return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene);
}
private bool CanDeleteObject(UUID objectID, UUID userID, Scene scene)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index a7f3dd7..3e75c8a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
+ public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp, Scene scenen);
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
@@ -392,15 +392,20 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region DUPLICATE OBJECT
- public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition)
+ public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID)
{
DuplicateObjectHandler handler = OnDuplicateObject;
if (handler != null)
{
+ if(sog == null || sog.IsDeleted)
+ return false;
+ ScenePresence sp = m_scene.GetScenePresence(agentID);
+ if(sp == null || sp.IsDeleted)
+ return false;
Delegate[] list = handler.GetInvocationList();
foreach (DuplicateObjectHandler h in list)
{
- if (h(objectCount, objectID, owner, m_scene, objectPosition) == false)
+ if (h(sog, sp, m_scene) == false)
return false;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index fc13692..9264138 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -2066,8 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
if (original != null)
{
- if (m_parentScene.Permissions.CanDuplicateObject(
- original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
+ if (m_parentScene.Permissions.CanDuplicateObject(original, AgentID))
{
SceneObjectGroup copy = original.Copy(true);
copy.AbsolutePosition = copy.AbsolutePosition + offset;
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 9c0fa75..4875a61 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -106,6 +106,7 @@ namespace OpenSim.Region.OptionalModules
private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
{
+
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
string response = DoCommonChecks(objectCount, ownerID, lo, scene);
@@ -119,15 +120,16 @@ namespace OpenSim.Region.OptionalModules
}
//OnDuplicateObject
- private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition)
+ private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
{
+ Vector3 objectPosition = sog.AbsolutePosition;
ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
- string response = DoCommonChecks(objectCount, ownerID, lo, scene);
+ string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo, scene);
if (response != null)
{
- m_dialogModule.SendAlertToUser(ownerID, response);
+ m_dialogModule.SendAlertToUser(sp.UUID, response);
return false;
}
return true;
--
cgit v1.1
From df40cdc83e5aca49ccca5e527bc43daf9b194c0c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 20 Jan 2017 13:45:44 +0000
Subject: remove redundant IsGod, rename some GOD as Administrator (both only
on permissions module)
---
.../World/Permissions/PermissionsModule.cs | 170 +++++++--------------
.../Region/Framework/Scenes/Scene.Permissions.cs | 13 +-
2 files changed, 65 insertions(+), 118 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 341bd7e..79308b4 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool m_bypassPermissionsValue = true;
private bool m_propagatePermissions = false;
private bool m_debugPermissions = false;
- private bool m_allowGridGods = false;
- private bool m_RegionOwnerIsGod = false;
- private bool m_RegionManagerIsGod = false;
- private bool m_forceGridGodsOnly;
- private bool m_forceGodModeAlwaysOn;
- private bool m_allowGodActionsWithoutGodMode;
+ private bool m_allowGridAdmins = false;
+ private bool m_RegionOwnerIsAdmin = false;
+ private bool m_RegionManagerIsAdmin = false;
+ private bool m_forceGridAdminsOnly;
+ private bool m_forceAdminModeAlwaysOn;
+ private bool m_allowAdminActionsWithoutGodMode;
private bool m_SimpleBuildPermissions = false;
@@ -167,23 +167,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
string[] sections = new string[] { "Startup", "Permissions" };
- m_allowGridGods = Util.GetConfigVarFromSections(config, "allow_grid_gods", sections, false);
+ m_allowGridAdmins = Util.GetConfigVarFromSections(config, "allow_grid_gods", sections, false);
m_bypassPermissions = !Util.GetConfigVarFromSections(config, "serverside_object_permissions", sections, true);
m_propagatePermissions = Util.GetConfigVarFromSections(config, "propagate_permissions", sections, true);
- m_forceGridGodsOnly = Util.GetConfigVarFromSections(config, "force_grid_gods_only", sections, false);
- if(!m_forceGridGodsOnly)
+ m_forceGridAdminsOnly = Util.GetConfigVarFromSections(config, "force_grid_gods_only", sections, false);
+ if(!m_forceGridAdminsOnly)
{
- m_RegionOwnerIsGod = Util.GetConfigVarFromSections(config, "region_owner_is_god",sections, true);
- m_RegionManagerIsGod = Util.GetConfigVarFromSections(config, "region_manager_is_god",sections, false);
+ m_RegionOwnerIsAdmin = Util.GetConfigVarFromSections(config, "region_owner_is_god",sections, true);
+ m_RegionManagerIsAdmin = Util.GetConfigVarFromSections(config, "region_manager_is_god",sections, false);
}
else
- m_allowGridGods = true;
+ m_allowGridAdmins = true;
- m_forceGodModeAlwaysOn = Util.GetConfigVarFromSections(config, "automatic_gods", sections, false);
- m_allowGodActionsWithoutGodMode = Util.GetConfigVarFromSections(config, "implicit_gods", sections, false);
- if(m_allowGodActionsWithoutGodMode)
- m_forceGodModeAlwaysOn = false;
+ m_forceAdminModeAlwaysOn = Util.GetConfigVarFromSections(config, "automatic_gods", sections, false);
+ m_allowAdminActionsWithoutGodMode = Util.GetConfigVarFromSections(config, "implicit_gods", sections, false);
+ if(m_allowAdminActionsWithoutGodMode)
+ m_forceAdminModeAlwaysOn = false;
m_SimpleBuildPermissions = Util.GetConfigVarFromSections(config, "simple_build_permissions",sections, false);
@@ -271,8 +271,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
m_scene.Permissions.OnDeedParcel += CanDeedParcel;
m_scene.Permissions.OnDeedObject += CanDeedObject;
- m_scene.Permissions.OnIsGod += IsGod;
- m_scene.Permissions.OnIsGridGod += IsGridGod;
+ m_scene.Permissions.OnIsGridGod += IsGridAdministrator;
m_scene.Permissions.OnIsAdministrator += IsAdministrator;
m_scene.Permissions.OnIsEstateManager += IsEstateManager;
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
@@ -552,13 +551,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (user == UUID.Zero)
return false;
- if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod)
+ if (m_RegionOwnerIsAdmin && m_scene.RegionInfo.EstateSettings.EstateOwner == user)
return true;
- if (IsEstateManager(user) && m_RegionManagerIsGod)
+ if (m_RegionManagerIsAdmin && IsEstateManager(user))
return true;
- if (IsGridGod(user, null))
+ if (IsGridAdministrator(user))
return true;
return false;
@@ -570,14 +569,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// The user
/// Unused, can be null
///
- protected bool IsGridGod(UUID user, Scene scene)
+ protected bool IsGridAdministrator(UUID user)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- if (user == UUID.Zero) return false;
+ if (user == UUID.Zero)
+ return false;
- if (m_allowGridGods)
+ if (m_allowGridAdmins)
{
ScenePresence sp = m_scene.GetScenePresence(user);
if (sp != null)
@@ -631,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
#region Object Permissions
-#pragma warning disable 0612
+
const uint DEFAULT_FLAGS = (uint)(
PrimFlags.ObjectCopy | // Tells client you can copy the object
PrimFlags.ObjectModify | // tells client you can modify the object
@@ -651,7 +651,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object
PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object
);
-#pragma warning restore 0612
const uint EXTRAOWNERMASK = (uint)(
PrimFlags.ObjectYouOwner |
@@ -693,7 +692,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
uint returnMask;
-
SceneObjectGroup grp = task.ParentGroup;
if(grp == null)
return 0;
@@ -1059,85 +1057,54 @@ namespace OpenSim.Region.CoreModules.World.Permissions
public bool GenericEstatePermission(UUID user)
{
- // Default: deny
- bool permission = false;
-
// Estate admins should be able to use estate tools
if (IsEstateManager(user))
- permission = true;
+ return true;
// Administrators always have permission
if (IsAdministrator(user))
- permission = true;
+ return true;
- return permission;
+ return false;
}
protected bool GenericParcelPermission(UUID user, ILandObject parcel, ulong groupPowers)
{
- bool permission = false;
-
if (parcel.LandData.OwnerID == user)
- {
- permission = true;
- }
+ return true;
if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
- {
- permission = true;
- }
+ return true;
if (IsEstateManager(user))
- {
- permission = true;
- }
+ return true;
if (IsAdministrator(user))
- {
- permission = true;
- }
+ return true;
if (m_SimpleBuildPermissions &&
(parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
- permission = true;
+ return true;
- return permission;
+ return false;
}
protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager)
{
if (parcel.LandData.OwnerID == user)
- {
- // Returning immediately so that group deeded objects on group deeded land don't trigger a NRE on
- // the subsequent redundant checks when using lParcelMediaCommandList()
- // See http://opensimulator.org/mantis/view.php?id=3999 for more details
return true;
- }
if (parcel.LandData.IsGroupOwned && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
- {
return true;
- }
if (allowEstateManager && IsEstateManager(user))
- {
return true;
- }
if (IsAdministrator(user))
- {
return true;
- }
return false;
}
-
- protected bool GenericParcelPermission(UUID user, Vector3 pos, ulong groupPowers)
- {
- ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
- if (parcel == null) return false;
- return GenericParcelPermission(user, parcel, groupPowers);
- }
#endregion
#region Permission Checks
@@ -1165,6 +1132,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (parcel.LandData.OwnerID != user) // Only the owner can deed!
return false;
+ if(parcel.LandData.GroupID == UUID.Zero)
+ return false;
+
ScenePresence sp = scene.GetScenePresence(user);
IClientAPI client = sp.ControllingClient;
@@ -1213,14 +1183,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool IsGod(UUID user, Scene scene)
- {
- DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
- if (m_bypassPermissions) return m_bypassPermissionsValue;
-
- return IsAdministrator(user);
- }
-
private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1480,53 +1442,39 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- // allow outide region??
+ // allow outide region this mb needed for crossings ???
if (newPoint.X < -1f || newPoint.Y < -1f)
return true;
if (newPoint.X > scene.RegionInfo.RegionSizeX + 1.0f || newPoint.Y > scene.RegionInfo.RegionSizeY + 1.0f)
- {
return true;
- }
-
- SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
-
- ILandObject land = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
- if (!enteringRegion)
- {
- ILandObject fromland = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
-
- if (fromland == land) // Not entering
- return true;
- }
-
- if (land == null)
- {
+ ILandObject parcel = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
+ if (parcel == null)
return false;
- }
- if ((land.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
- {
+ if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
return true;
- }
- if (!m_scene.Entities.ContainsKey(objectID))
- {
+ EntityBase ent = null;
+ if (!m_scene.Entities.TryGetValue(objectID, out ent))
return false;
- }
- // If it's not an object, we cant edit it.
- if (!(m_scene.Entities[objectID] is SceneObjectGroup))
- {
+ if(ent == null || !(ent is SceneObjectGroup))
return false;
- }
+ SceneObjectGroup task = (SceneObjectGroup)ent;
- if (GenericParcelPermission(task.OwnerID, newPoint, 0))
+ if (!enteringRegion)
{
- return true;
+ ILandObject fromparcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
+
+ if (fromparcel == parcel) // it already entered parcel ????
+ return true;
}
+ if (GenericParcelPermission(task.OwnerID, parcel, 0))
+ return true;
+
//Otherwise, false!
return false;
}
@@ -1632,7 +1580,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
+ private bool CanRezObject(int objectCount, UUID userID, Vector3 objectPosition, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions)
@@ -1640,26 +1588,26 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
- ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
+ ILandObject parcel = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
if (parcel == null || parcel.LandData == null)
return false;
LandData landdata = parcel.LandData;
- if ((owner == landdata.OwnerID))
+ if ((userID == landdata.OwnerID))
return true;
if ((landdata.Flags & (uint)ParcelFlags.CreateObjects) != 0)
return true;
- if(IsAdministrator(owner))
+ if(IsAdministrator(userID))
return true;
if(landdata.GroupID != UUID.Zero)
{
if ((landdata.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
- return IsGroupMember(landdata.GroupID, owner, 0);
+ return IsGroupMember(landdata.GroupID, userID, 0);
- if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, owner, (ulong)GroupPowers.AllowRez))
+ if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, userID, (ulong)GroupPowers.AllowRez))
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 3e75c8a..9845418 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -68,8 +68,8 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
- public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
- public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene);
+ public delegate bool IsGodHandler(UUID user);
+ public delegate bool IsGridGodHandler(UUID user);
public delegate bool IsAdministratorHandler(UUID user);
public delegate bool IsEstateManagerHandler(UUID user);
public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
@@ -139,7 +139,6 @@ namespace OpenSim.Region.Framework.Scenes
public event TerraformLandHandler OnTerraformLand;
public event RunConsoleCommandHandler OnRunConsoleCommand;
public event IssueEstateCommandHandler OnIssueEstateCommand;
- public event IsGodHandler OnIsGod;
public event IsGridGodHandler OnIsGridGod;
public event IsAdministratorHandler OnIsAdministrator;
public event IsEstateManagerHandler OnIsEstateManager;
@@ -798,13 +797,13 @@ namespace OpenSim.Region.Framework.Scenes
#region CAN BE GODLIKE
public bool IsGod(UUID user)
{
- IsGodHandler handler = OnIsGod;
+ IsAdministratorHandler handler = OnIsAdministrator;
if (handler != null)
{
Delegate[] list = handler.GetInvocationList();
- foreach (IsGodHandler h in list)
+ foreach (IsAdministratorHandler h in list)
{
- if (h(user, m_scene) == false)
+ if (h(user) == false)
return false;
}
}
@@ -819,7 +818,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (IsGridGodHandler h in list)
{
- if (h(user, m_scene) == false)
+ if (h(user) == false)
return false;
}
}
--
cgit v1.1
From dac32c4e5acd76a3b42dede1c573dbef1a98c7e1 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 20 Jan 2017 14:26:24 +0000
Subject: change CanObjectEntry() to use a SOG
---
.../EntityTransfer/EntityTransferModule.cs | 2 +-
.../World/Permissions/PermissionsModule.cs | 38 ++++++++++-----------
.../Region/Framework/Scenes/Scene.Permissions.cs | 6 ++--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
.../PrimLimitsModule/PrimLimitsModule.cs | 39 +++++++++-------------
.../Shared/Api/Implementation/LSL_Api.cs | 2 +-
7 files changed, 40 insertions(+), 51 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 6dc982b..92485a1 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -2620,7 +2620,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
// FIXME: It would be better to never add the scene object at all rather than add it and then delete
// it
- if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition))
+ if (!Scene.Permissions.CanObjectEntry(so, true, so.AbsolutePosition))
{
// Deny non attachments based on parcel settings
//
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 79308b4..95a007a 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1437,42 +1437,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
+ private bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
- if (m_bypassPermissions) return m_bypassPermissionsValue;
-
- // allow outide region this mb needed for crossings ???
- if (newPoint.X < -1f || newPoint.Y < -1f)
- return true;
- if (newPoint.X > scene.RegionInfo.RegionSizeX + 1.0f || newPoint.Y > scene.RegionInfo.RegionSizeY + 1.0f)
- return true;
- ILandObject parcel = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
- if (parcel == null)
+ if(sog == null || sog.IsDeleted)
return false;
- if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
+ float newX = newPoint.X;
+ float newY = newPoint.Y;
+
+ // allow outside region this mb needed for crossings
+ if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
+ newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
- EntityBase ent = null;
- if (!m_scene.Entities.TryGetValue(objectID, out ent))
- return false;
+ if (m_bypassPermissions)
+ return m_bypassPermissionsValue;
- if(ent == null || !(ent is SceneObjectGroup))
+ ILandObject parcel = scene.LandChannel.GetLandObject(newX, newY);
+ if (parcel == null)
return false;
- SceneObjectGroup task = (SceneObjectGroup)ent;
+ if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
+ return true;
if (!enteringRegion)
{
- ILandObject fromparcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
-
- if (fromparcel == parcel) // it already entered parcel ????
+ Vector3 oldPoint = sog.AbsolutePosition;
+ ILandObject fromparcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
+ if (fromparcel != null && fromparcel.Equals(parcel)) // it already entered parcel ????
return true;
}
- if (GenericParcelPermission(task.OwnerID, parcel, 0))
+ if (GenericParcelPermission(sog.OwnerID, parcel, 0))
return true;
//Otherwise, false!
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 9845418..6925b6c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
+ public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene);
public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List objects, Scene scene);
public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
@@ -504,7 +504,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region OBJECT ENTRY
- public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint)
+ public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
{
ObjectEntryHandler handler = OnObjectEntry;
if (handler != null)
@@ -512,7 +512,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ObjectEntryHandler h in list)
{
- if (h(objectID, enteringRegion, newPoint, m_scene) == false)
+ if (h(sog, enteringRegion, newPoint, m_scene) == false)
return false;
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 9264138..8fc438d 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1579,7 +1579,7 @@ namespace OpenSim.Region.Framework.Scenes
else
{
if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)
- && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
+ && m_parentScene.Permissions.CanObjectEntry(group, false, pos))
{
group.UpdateGroupPosition(pos);
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d14c450..83c5db4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -4656,7 +4656,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if ((change & ObjectChangeType.Position) != 0)
{
- if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position))
+ if (IsAttachment || m_scene.Permissions.CanObjectEntry(group, false, data.position))
UpdateGroupPosition(data.position);
updateType = updatetype.groupterse;
}
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 4875a61..9c0d801 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -135,50 +135,41 @@ namespace OpenSim.Region.OptionalModules
return true;
}
- private bool CanObjectEnter(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene)
+ private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene)
{
- if (newPoint.X < -1f || newPoint.X > (scene.RegionInfo.RegionSizeX + 1) ||
- newPoint.Y < -1f || newPoint.Y > (scene.RegionInfo.RegionSizeY) )
+ float newX = newPoint.X;
+ float newY = newPoint.Y;
+ if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
+ newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
- SceneObjectPart obj = scene.GetSceneObjectPart(objectID);
-
- if (obj == null)
+ if (sog == null)
return false;
- // Prim counts are determined by the location of the root prim. if we're
- // moving a child prim, just let it pass
- if (!obj.IsRoot)
- {
- return true;
- }
-
- ILandObject newParcel = scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
+ ILandObject newParcel = scene.LandChannel.GetLandObject(newX, newY);
if (newParcel == null)
return true;
- Vector3 oldPoint = obj.GroupPosition;
- ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
-
- // The prim hasn't crossed a region boundry so we don't need to worry
- // about prim counts here
- if(oldParcel != null && oldParcel.Equals(newParcel))
+ if(!enteringRegion)
{
- return true;
+ Vector3 oldPoint = sog.AbsolutePosition;
+ ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
+ if(oldParcel != null && oldParcel.Equals(newParcel))
+ return true;
}
- int objectCount = obj.ParentGroup.PrimCount;
+ int objectCount = sog.PrimCount;
int usedPrims = newParcel.PrimCounts.Total;
int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
// TODO: Add Special Case here for temporary prims
- string response = DoCommonChecks(objectCount, obj.OwnerID, newParcel, scene);
+ string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene);
if (response != null)
{
- m_dialogModule.SendAlertToUser(obj.OwnerID, response);
+ m_dialogModule.SendAlertToUser(sog.OwnerID, response);
return false;
}
return true;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 45bdb41..3cdf49c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2722,7 +2722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part.ParentGroup.RootPart == part)
{
SceneObjectGroup parent = part.ParentGroup;
- if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos))
+ if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent, false, (Vector3)toPos))
return;
parent.UpdateGroupPosition((Vector3)toPos);
}
--
cgit v1.1
From 05196ebe27f4d3827049704bf8ee1d93a28875a4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 20 Jan 2017 22:50:50 +0000
Subject: test jenkins
---
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 95a007a..2275497 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1441,17 +1441,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
- if(sog == null || sog.IsDeleted)
- return false;
-
float newX = newPoint.X;
float newY = newPoint.Y;
- // allow outside region this mb needed for crossings
+ // allow outside region this is needed for crossings
if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
+ if(sog == null || sog.IsDeleted)
+ return false;
+
if (m_bypassPermissions)
return m_bypassPermissionsValue;
--
cgit v1.1
From 48f137599f5930611e2ade0f1c64fc3a6b188f75 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 20 Jan 2017 23:36:35 +0000
Subject: fix a null ref on jenkins
---
.../OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 9c0d801..744e260 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -139,8 +139,8 @@ namespace OpenSim.Region.OptionalModules
{
float newX = newPoint.X;
float newY = newPoint.Y;
- if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
- newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
+ if (newX < -1.0f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
+ newY < -1.0f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
if (sog == null)
@@ -160,14 +160,12 @@ namespace OpenSim.Region.OptionalModules
}
int objectCount = sog.PrimCount;
- int usedPrims = newParcel.PrimCounts.Total;
- int simulatorCapacity = newParcel.GetSimulatorMaxPrimCount();
// TODO: Add Special Case here for temporary prims
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene);
- if (response != null)
+ if (response != null && m_dialogModule != null)
{
m_dialogModule.SendAlertToUser(sog.OwnerID, response);
return false;
@@ -182,7 +180,7 @@ namespace OpenSim.Region.OptionalModules
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{
- response = "Unable to rez object because the parcel is too full";
+ response = "Unable to rez object because the region is too full";
}
else
{
--
cgit v1.1
From c0231fe1698bf82d4af837a3467296b5c3e2e99b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 00:18:25 +0000
Subject: Oops.. fix the null on the correct place.. jenkis may now fail for
another reason
---
OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 744e260..635df96 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -165,9 +165,10 @@ namespace OpenSim.Region.OptionalModules
string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene);
- if (response != null && m_dialogModule != null)
+ if (response != null)
{
- m_dialogModule.SendAlertToUser(sog.OwnerID, response);
+ if(m_dialogModule != null)
+ m_dialogModule.SendAlertToUser(sog.OwnerID, response);
return false;
}
return true;
--
cgit v1.1
From 85a31c9e76f136ae8f0afe0bd7a00c4fc1a8e66b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 02:29:08 +0000
Subject: initialize SimwideArea
---
OpenSim/Region/CoreModules/World/Land/LandObject.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 73b4cb5..ae79849 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1043,7 +1043,9 @@ namespace OpenSim.Region.CoreModules.World.Land
else
LandData.AABBMax = new Vector3(tx, ty, (float)m_scene.Heightmap[tx - 1, ty - 1]);
- LandData.Area = tempArea * landUnit * landUnit;
+ tempArea *= landUnit * landUnit;
+ LandData.Area = tempArea;
+ LandData.SimwideArea = tempArea;
}
#endregion
--
cgit v1.1
From b20bd1a9dfdf9f7b7bb342f69832f7e7662ecaf2 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 03:35:59 +0000
Subject: change the initialization point of SimwideArea
---
OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 6 ++++--
OpenSim/Region/CoreModules/World/Land/LandObject.cs | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 5d12f8b..66be5e5 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -287,8 +287,10 @@ namespace OpenSim.Region.CoreModules.World.Land
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
(int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
- fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
- fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
+ LandData ldata = fullSimParcel.LandData;
+ ldata.SimwideArea = ldata.Area;
+ ldata.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
+ ldata.ClaimDate = Util.UnixTimeSinceEpoch();
return AddLandObject(fullSimParcel);
}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index ae79849..3aca741 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -356,6 +356,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
+ // the total prims a parcel owner can have on a region
public int GetSimulatorMaxPrimCount()
{
if (overrideSimulatorMaxPrimCount != null)
@@ -370,7 +371,7 @@ namespace OpenSim.Region.CoreModules.World.Land
* (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
+0.5 );
-
+ // sanity check
if(simMax > m_scene.RegionInfo.ObjectCapacity)
simMax = m_scene.RegionInfo.ObjectCapacity;
//m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}",
@@ -1045,7 +1046,6 @@ namespace OpenSim.Region.CoreModules.World.Land
tempArea *= landUnit * landUnit;
LandData.Area = tempArea;
- LandData.SimwideArea = tempArea;
}
#endregion
--
cgit v1.1
From 9d61df0887d05415513645790fe266d84b00fffe Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 05:14:13 +0000
Subject: fix CanObjectEntry and CanTerraformLand group permissions
---
.../World/Permissions/PermissionsModule.cs | 63 +++++++++++-----------
1 file changed, 30 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 2275497..59da1c2 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -98,8 +98,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool m_forceAdminModeAlwaysOn;
private bool m_allowAdminActionsWithoutGodMode;
- private bool m_SimpleBuildPermissions = false;
-
///
/// The set of users that are allowed to create scripts. This is only active if permissions are not being
/// bypassed. This overrides normal permissions.
@@ -185,8 +183,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(m_allowAdminActionsWithoutGodMode)
m_forceAdminModeAlwaysOn = false;
- m_SimpleBuildPermissions = Util.GetConfigVarFromSections(config, "simple_build_permissions",sections, false);
-
m_allowedScriptCreators
= ParseUserSetConfigSetting(config, "allowed_script_creators", m_allowedScriptCreators);
m_allowedScriptEditors
@@ -1068,27 +1064,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
- protected bool GenericParcelPermission(UUID user, ILandObject parcel, ulong groupPowers)
- {
- if (parcel.LandData.OwnerID == user)
- return true;
-
- if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
- return true;
-
- if (IsEstateManager(user))
- return true;
-
- if (IsAdministrator(user))
- return true;
-
- if (m_SimpleBuildPermissions &&
- (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
- return true;
-
- return false;
- }
-
protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager)
{
if (parcel.LandData.OwnerID == user)
@@ -1470,9 +1445,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- if (GenericParcelPermission(sog.OwnerID, parcel, 0))
+ UUID userID = sog.OwnerID;
+ LandData landdata = parcel.LandData;
+
+ if (landdata.OwnerID == userID)
+ return true;
+
+ if (IsAdministrator(userID))
return true;
+ UUID landGroupID = landdata.GroupID;
+ if (landGroupID != UUID.Zero)
+ {
+ if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowGroupObjectEntry)) != 0)
+ return IsGroupMember(landGroupID, userID, 0);
+
+ if (landdata.IsGroupOwned && IsGroupMember(landGroupID, userID, (ulong)GroupPowers.AllowRez))
+ return true;
+ }
+
//Otherwise, false!
return false;
}
@@ -1688,13 +1679,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanTerraformLand(UUID user, Vector3 position, Scene requestFromScene)
+ private bool CanTerraformLand(UUID userID, Vector3 position, Scene requestFromScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
// Estate override
- if (GenericEstatePermission(user))
+ if (GenericEstatePermission(userID))
return true;
float X = position.X;
@@ -1712,13 +1703,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
if (parcel == null)
return false;
-
- // Others allowed to terraform?
- if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowTerraform)) != 0)
+
+ LandData landdata = parcel.LandData;
+ if (landdata == null)
+ return false;
+
+ if ((landdata.Flags & ((int)ParcelFlags.AllowTerraform)) != 0)
return true;
- // Land owner can terraform too
- if (parcel != null && GenericParcelPermission(user, parcel, (ulong)GroupPowers.AllowEditLand))
+ if(landdata.OwnerID == userID)
+ return true;
+
+ if (landdata.IsGroupOwned && parcel.LandData.GroupID != UUID.Zero &&
+ IsGroupMember(landdata.GroupID, userID, (ulong)GroupPowers.AllowEditLand))
return true;
return false;
--
cgit v1.1
From 0a5d6671cec0eaea00127e29d4237cc4614d111d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 06:37:29 +0000
Subject: fix llScriptDanger(); don't call old ScriptDamage on ossl health
functions
---
OpenSim/Region/Framework/Scenes/Scene.cs | 88 ++++++++++------------
.../Shared/Api/Implementation/LSL_Api.cs | 2 +-
.../Shared/Api/Implementation/OSSL_Api.cs | 9 ++-
3 files changed, 47 insertions(+), 52 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d9b0327..ca298be 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5083,65 +5083,59 @@ Label_GroupsDone:
#endregion
#region Script Engine
-
- private bool ScriptDanger(SceneObjectPart part, Vector3 pos)
+ public bool LSLScriptDanger(SceneObjectPart part, Vector3 pos)
{
+
ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
- if (part != null)
- {
- if (parcel != null)
- {
- if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0)
- {
- return true;
- }
- else if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
- {
- return true;
- }
- else if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
- && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
+ if (parcel == null)
+ return true;
+
+ LandData ldata = parcel.LandData;
+ if (ldata == null)
+ return true;
+
+ uint landflags = ldata.Flags;
+
+ uint mask = (uint)(ParcelFlags.CreateObjects | ParcelFlags.AllowAPrimitiveEntry);
+ if((landflags & mask) != mask)
+ return true;
+
+ if((landflags & (uint)ParcelFlags.AllowOtherScripts) != 0)
+ return false;
- if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY)
- {
- // The only time parcel != null when an object is inside a region is when
- // there is nothing behind the landchannel. IE, no land plugin loaded.
- return true;
- }
- else
- {
- // The object is outside of this region. Stop piping events to it.
- return false;
- }
- }
- }
- else
- {
+ if(part == null)
+ return true;
+ if(part.GroupID == ldata.GroupID && (landflags & (uint)ParcelFlags.AllowGroupScripts) != 0)
return false;
- }
+
+ return true;
}
- public bool ScriptDanger(uint localID, Vector3 pos)
+ private bool ScriptDanger(SceneObjectPart part, Vector3 pos)
{
- SceneObjectPart part = GetSceneObjectPart(localID);
- if (part != null)
+ if (part == null)
+ return false;
+
+ ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
+ if (parcel != null)
{
- return ScriptDanger(part, pos);
+ if ((parcel.LandData.Flags & (uint)ParcelFlags.AllowOtherScripts) != 0)
+ return true;
+
+ if ((part.OwnerID == parcel.LandData.OwnerID) || Permissions.IsGod(part.OwnerID))
+ return true;
+
+ if (((parcel.LandData.Flags & (uint)ParcelFlags.AllowGroupScripts) != 0)
+ && (parcel.LandData.GroupID != UUID.Zero) && (parcel.LandData.GroupID == part.GroupID))
+ return true;
}
else
{
- return false;
+ if (pos.X > 0f && pos.X < RegionInfo.RegionSizeX && pos.Y > 0f && pos.Y < RegionInfo.RegionSizeY)
+ return true;
}
+
+ return false;
}
public bool PipeEventsForScript(uint localID)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3cdf49c..226ad6c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7963,7 +7963,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llScriptDanger(LSL_Vector pos)
{
m_host.AddScriptLPS(1);
- bool result = World.ScriptDanger(m_host.LocalId, pos);
+ bool result = World.LSLScriptDanger(m_host, pos);
if (result)
{
return 1;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a17eb03..4c3f7ee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -3538,7 +3538,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Float health = new LSL_Float(-1);
ScenePresence presence = World.GetScenePresence(new UUID(avatar));
- if (presence != null) health = presence.Health;
+ if (presence != null)
+ health = presence.Health;
return health;
}
@@ -3578,7 +3579,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
+ if (presence != null)
{
float health = presence.Health;
health += (float)healing;
@@ -3598,7 +3599,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
+ if (presence != null)
{
if (health > 100.0)
health = 100.0;
@@ -3617,7 +3618,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID avatarId = new UUID(avatar);
ScenePresence presence = World.GetScenePresence(avatarId);
- if (presence != null && World.ScriptDanger(m_host.LocalId, m_host.GetWorldPosition()))
+ if (presence != null)
presence.HealRate = (float)healrate;
}
--
cgit v1.1
From 186f0b73cd9c3005fc75a9925bc65902d26d497b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 10:22:00 +0000
Subject: add/fix CanRunScript
---
.../World/Permissions/PermissionsModule.cs | 32 ++++++++++++++++++++--
.../Region/Framework/Scenes/Scene.Permissions.cs | 24 ++++++++++++++--
.../Framework/Scenes/SceneObjectPartInventory.cs | 2 +-
3 files changed, 53 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 59da1c2..b012f5f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1612,12 +1612,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return IsAdministrator(user);
}
- private bool CanRunScript(UUID script, UUID objectID, UUID user, Scene scene)
+ private bool CanRunScript(TaskInventoryItem scriptitem, SceneObjectPart part)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- return true;
+ if(scriptitem == null || part == null)
+ return false;
+
+ SceneObjectGroup sog = part.ParentGroup;
+ if(sog == null)
+ return false;
+
+ Vector3 pos = sog.AbsolutePosition;
+ ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
+ if (parcel == null)
+ return false;
+
+ LandData ldata = parcel.LandData;
+ if(ldata == null)
+ return false;
+
+ uint lflags = ldata.Flags;
+
+ if ((lflags & (uint)ParcelFlags.AllowOtherScripts) != 0)
+ return true;
+
+ if ((part.OwnerID == ldata.OwnerID))
+ return true;
+
+ if (((lflags & (uint)ParcelFlags.AllowGroupScripts) != 0)
+ && (ldata.GroupID != UUID.Zero) && (ldata.GroupID == part.GroupID))
+ return true;
+
+ return GenericEstatePermission(part.OwnerID);
}
private bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 6925b6c..e941210 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
- public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
+ public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user, Scene scene);
+ public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
@@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes
public event ViewNotecardHandler OnViewNotecard;
public event EditScriptHandler OnEditScript;
public event EditNotecardHandler OnEditNotecard;
+ public event RunScriptHandlerByIDs OnRunScriptByIDs;
public event RunScriptHandler OnRunScript;
public event CompileScriptHandler OnCompileScript;
public event StartScriptHandler OnStartScript;
@@ -654,19 +656,37 @@ namespace OpenSim.Region.Framework.Scenes
#region RUN SCRIPT (When Script Placed in Object)
public bool CanRunScript(UUID script, UUID objectID, UUID user)
{
+ RunScriptHandlerByIDs handler = OnRunScriptByIDs;
+ if (handler != null)
+ {
+ Delegate[] list = handler.GetInvocationList();
+ foreach (RunScriptHandlerByIDs h in list)
+ {
+ if (h(script, objectID, user, m_scene) == false)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part)
+ {
RunScriptHandler handler = OnRunScript;
if (handler != null)
{
+ if(item == null || part == null)
+ return false;
Delegate[] list = handler.GetInvocationList();
foreach (RunScriptHandler h in list)
{
- if (h(script, objectID, user, m_scene) == false)
+ if (h(item, part) == false)
return false;
}
}
return true;
}
+
#endregion
#region COMPILE SCRIPT (When Script needs to get (re)compiled)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 545d44b..b53c355 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
- if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
+ if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item, m_part))
{
StoreScriptError(item.ItemID, "no permission");
return false;
--
cgit v1.1
From 7a1d9e213ef9efc20417e999631c3c265f061006 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 11:21:36 +0000
Subject: fix CanReturnObjects
---
.../World/Permissions/PermissionsModule.cs | 33 +++++++++++++---------
1 file changed, 20 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b012f5f..f3afac7 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1473,19 +1473,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- GroupPowers powers;
- ILandObject l;
-
ScenePresence sp = scene.GetScenePresence(user);
if (sp == null)
return false;
+ bool isPrivUser = sp.IsGod || IsEstateManager(user);
+
IClientAPI client = sp.ControllingClient;
- uint perms;
+ GroupPowers powers;
+ ILandObject l;
+
foreach (SceneObjectGroup g in new List(objects))
{
- perms = GetObjectPermissions(sp, g, false);
- if((perms & (uint)PermissionMask.Modify) == 0) //??
+ if(g.IsAttachment)
+ {
+ objects.Remove(g);
+ continue;
+ }
+
+ if (isPrivUser || g.OwnerID == user)
continue;
// This is a short cut for efficiency. If land is non-null,
@@ -1499,27 +1505,28 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else
{
Vector3 pos = g.AbsolutePosition;
-
l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
}
// If it's not over any land, then we can't do a thing
- if (l == null)
+ if (l == null || l.LandData == null)
{
objects.Remove(g);
continue;
}
+ LandData ldata = l.LandData;
// If we own the land outright, then allow
//
- if (l.LandData.OwnerID == user)
+ if (ldata.OwnerID == user)
continue;
// Group voodoo
//
- if (l.LandData.IsGroupOwned)
+ if (ldata.IsGroupOwned)
{
- powers = (GroupPowers)client.GetGroupPowers(l.LandData.GroupID);
+ UUID lGroupID = ldata.GroupID;
+ powers = (GroupPowers)client.GetGroupPowers(lGroupID);
// Not a group member, or no rights at all
//
if (powers == (GroupPowers)0)
@@ -1530,7 +1537,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Group deeded object?
//
- if (g.OwnerID == l.LandData.GroupID &&
+ if (g.OwnerID == lGroupID &&
(powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
{
objects.Remove(g);
@@ -1539,7 +1546,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Group set object?
//
- if (g.GroupID == l.LandData.GroupID &&
+ if (g.GroupID == lGroupID &&
(powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
{
objects.Remove(g);
--
cgit v1.1
From c14ec1a9bdefc01ae817c17973d85daec10ebb3d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 21 Jan 2017 14:22:32 +0000
Subject: a few more changes on permissions
---
.../World/Permissions/PermissionsModule.cs | 98 +++++++++++-----------
1 file changed, 47 insertions(+), 51 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f3afac7..890d07a 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -69,10 +69,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
#region Constants
- // These are here for testing. They will be taken out
-
- private uint PERM_LOCKED = (uint)524288; // same as move
-
///
/// Different user set names that come in from the configuration file.
///
@@ -866,7 +862,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return 0;
UUID objectOwner = group.OwnerID;
- bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0);
+ bool locked = denyOnLocked && ((root.OwnerMask & (uint)PermissionMask.Move) == 0);
if (IsAdministrator(currentUser))
{
@@ -920,7 +916,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
UUID spID = sp.UUID;
UUID objectOwner = group.OwnerID;
- bool locked = denyOnLocked && ((root.OwnerMask & PERM_LOCKED) == 0);
+ bool locked = denyOnLocked && ((root.OwnerMask & (uint)PermissionMask.Move) == 0);
if (sp.IsGod)
{
@@ -960,12 +956,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return group.EffectiveEveryOnePerms & lockmask;
}
- private uint GetObjectItemPermissions(UUID userID, TaskInventoryItem ti, bool notEveryone)
+ private uint GetObjectItemPermissions(UUID userID, TaskInventoryItem ti)
{
UUID tiOwnerID = ti.OwnerID;
if(tiOwnerID == userID)
return ti.CurrentPermissions;
-
+
+ if(IsAdministrator(userID))
+ return (uint)PermissionMask.AllEffective;
// ??
if (IsFriendWithPerms(userID, tiOwnerID))
return ti.CurrentPermissions;
@@ -981,17 +979,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
return ti.CurrentPermissions;
}
- uint p = ti.GroupPermissions;
- if(!notEveryone)
- p |= ti.EveryonePermissions;
- return p;
+ return ti.GroupPermissions;
}
}
- if(notEveryone)
- return 0;
-
- return ti.EveryonePermissions;
+ return 0;
}
private uint GetObjectItemPermissions(ScenePresence sp, TaskInventoryItem ti, bool notEveryone)
@@ -1104,19 +1096,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- if (parcel.LandData.OwnerID != user) // Only the owner can deed!
+ if(parcel.LandData.GroupID == UUID.Zero)
return false;
- if(parcel.LandData.GroupID == UUID.Zero)
+ if (IsAdministrator(user))
+ return true;
+
+ if (parcel.LandData.OwnerID != user) // Only the owner can deed!
return false;
ScenePresence sp = scene.GetScenePresence(user);
- IClientAPI client = sp.ControllingClient;
+ if(sp == null)
+ return false;
+ IClientAPI client = sp.ControllingClient;
if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0)
return false;
- return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false);
+ return true;
}
private bool CanDeedObject(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID)
@@ -1383,13 +1380,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (IsAdministrator(user))
return true;
- if (m_scene.RegionInfo.EstateSettings.IsEstateOwner(user))
- return true;
-
if (ownerCommand)
- return false;
+ return m_scene.RegionInfo.EstateSettings.IsEstateOwner(user);
- return GenericEstatePermission(user);
+ return IsEstateManager(user);
}
private bool CanMoveObject(SceneObjectGroup sog, ScenePresence sp)
@@ -1764,7 +1758,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
+ private bool CanViewScript(UUID script, UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1772,7 +1766,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
- InventoryItemBase assetRequestItem = invService.GetItem(user, script);
+ InventoryItemBase assetRequestItem = invService.GetItem(userID, script);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{
assetRequestItem = LibraryRootFolder.FindItem(script);
@@ -1792,12 +1786,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// readable only if it's really full perms
//
if ((assetRequestItem.CurrentPermissions &
+/*
((uint)PermissionMask.Modify |
(uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer)) !=
((uint)PermissionMask.Modify |
(uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer))
+*/
+ (uint)(PermissionMask.Modify | PermissionMask.Copy)) !=
+ (uint)(PermissionMask.Modify | PermissionMask.Copy))
return false;
}
else // Prim inventory
@@ -1810,7 +1808,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(user, sog, true);
+ uint perms = GetObjectPermissions(userID, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
@@ -1820,23 +1818,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (ti == null) // legacy may not have type
return false;
- if (ti.OwnerID != user)
- {
- if (ti.GroupID == UUID.Zero)
- return false;
-
- if (!IsGroupMember(ti.GroupID, user, 0))
- return false;
- }
+ uint itperms = GetObjectItemPermissions(userID, ti);
// Require full perms
- if ((ti.CurrentPermissions &
- ((uint)PermissionMask.Modify |
+
+ if ((itperms &
+/*
+ ((uint)(PermissionMask.Modify |
(uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer)) !=
((uint)PermissionMask.Modify |
(uint)PermissionMask.Copy |
(uint)PermissionMask.Transfer))
+*/
+ (uint)(PermissionMask.Modify | PermissionMask.Copy)) !=
+ (uint)(PermissionMask.Modify | PermissionMask.Copy))
return false;
}
@@ -1851,7 +1847,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
+ private bool CanViewNotecard(UUID notecard, UUID objectID, UUID userID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1859,7 +1855,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
- InventoryItemBase assetRequestItem = invService.GetItem(user, notecard);
+ InventoryItemBase assetRequestItem = invService.GetItem(userID, notecard);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{
assetRequestItem = LibraryRootFolder.FindItem(notecard);
@@ -1885,7 +1881,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(user, sog, true);
+ uint perms = GetObjectPermissions(userID, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
@@ -1895,18 +1891,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (ti == null)
return false;
- if (ti.OwnerID != user)
- {
- if (ti.GroupID == UUID.Zero)
- return false;
-
- if (!IsGroupMember(ti.GroupID, user, 0))
- return false;
- }
+ uint itperms = GetObjectItemPermissions(userID, ti);
// Notecards are always readable unless no copy
//
- if ((ti.CurrentPermissions &
+ if ((itperms &
(uint)PermissionMask.Copy) !=
(uint)PermissionMask.Copy)
return false;
@@ -1976,7 +1965,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(ti == null)
return false;
- //TODO item perm ?
+ uint itperms = GetObjectItemPermissions(userID, ti);
+
+ if((itperms & (uint)PermissionMask.Copy) == 0)
+ return false;
+
+ if(sog.OwnerID != userID && (itperms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+
return true;
}
--
cgit v1.1
From 50e318c401f69b7b3946b0a630d455bf7fe4118c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 22 Jan 2017 03:23:50 +0000
Subject: work around group sharing and owned permitions issues, fix a non copy
objects delete issue
---
.../World/Permissions/PermissionsModule.cs | 206 ++++++++++++++++-----
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 33 ++--
.../Region/Framework/Scenes/Scene.Permissions.cs | 32 +++-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 32 ++--
4 files changed, 214 insertions(+), 89 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 890d07a..e16022d 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -267,6 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnIsAdministrator += IsAdministrator;
m_scene.Permissions.OnIsEstateManager += IsEstateManager;
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
+ m_scene.Permissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
m_scene.Permissions.OnDeleteObject += CanDeleteObject;
m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
m_scene.Permissions.OnEditObject += CanEditObject;
@@ -674,6 +675,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
PrimFlags.ObjectAnyOwner // Tells client that someone owns the object
);
+ const uint SHAREDMASK = (uint)(
+ PermissionMask.Move |
+ PermissionMask.Modify |
+ PermissionMask.Copy
+ );
+
public uint GenerateClientFlags(SceneObjectPart task, ScenePresence sp, uint curEffectivePerms)
{
if(sp == null || task == null || curEffectivePerms == 0)
@@ -749,20 +756,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
ulong powers = 0;
if(taskGroupID != UUID.Zero && GroupMemberPowers(taskGroupID, sp, ref powers))
{
- if(groupdOwned)
+ // shared as priority over group roles
+ bool notShared = (grp.EffectiveGroupPerms & SHAREDMASK) == 0;
+ if(groupdOwned && notShared)
{
// object is owned by group, check role powers
- if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
- {
- returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
- returnMask |=
- (uint)PrimFlags.ObjectGroupOwned |
- (uint)PrimFlags.ObjectAnyOwner;
- if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
- returnMask |= (uint)PrimFlags.ObjectOwnerModify;
- return returnMask;
- }
- else
+ if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
{
// group sharing or everyone
returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
@@ -771,12 +770,30 @@ namespace OpenSim.Region.CoreModules.World.Permissions
(uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
+
+ // we may have copy without transfer
+ uint grpEffectiveOwnerPerms = grp.EffectiveOwnerPerms;
+ if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
+ returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectAnyOwner;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ return returnMask;
}
else
{
// group sharing or everyone
returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
- if (taskOwnerID != UUID.Zero)
+ if(groupdOwned)
+ {
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectAnyOwner;
+ }
+ else if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
@@ -886,18 +903,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return group.EffectiveOwnerPerms & lockmask;
UUID sogGroupID = group.GroupID;
- if (sogGroupID != UUID.Zero)
+ ulong powers = 0;
+ if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, currentUser, ref powers))
{
- ulong powers = 0;
- if(GroupMemberPowers(sogGroupID, currentUser, ref powers))
- {
- if(sogGroupID == objectOwner)
- {
- if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
- return group.EffectiveOwnerPerms & lockmask;
- }
+ bool Shared = (group.EffectiveGroupPerms & SHAREDMASK) != 0;
+
+ if(Shared || sogGroupID != objectOwner)
return group.EffectiveGroupOrEveryOnePerms & lockmask;
- }
+
+ if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
+ return group.EffectiveGroupOrEveryOnePerms & lockmask;
+
+ uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask;
+ if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
+ return grpEffectiveOwnerPerms;
}
return group.EffectiveEveryOnePerms & lockmask;
@@ -939,18 +959,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return group.EffectiveOwnerPerms & lockmask;
UUID sogGroupID = group.GroupID;
- if (sogGroupID != UUID.Zero)
+ ulong powers = 0;
+ if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, sp, ref powers))
{
- ulong powers = 0;
- if(GroupMemberPowers(sogGroupID, sp, ref powers))
- {
- if(sogGroupID == objectOwner)
- {
- if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
- return group.EffectiveOwnerPerms & lockmask;
- }
+ bool Shared = (group.EffectiveGroupPerms & SHAREDMASK) != 0;
+
+ if(Shared || sogGroupID != objectOwner)
return group.EffectiveGroupOrEveryOnePerms & lockmask;
- }
+
+ if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
+ return group.EffectiveGroupOrEveryOnePerms & lockmask;
+
+ uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask;
+ if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
+ return grpEffectiveOwnerPerms;
}
return group.EffectiveEveryOnePerms & lockmask;
@@ -1167,15 +1190,59 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if((perms & (uint)PermissionMask.Copy) == 0)
return false;
- if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
+ if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
return false;
//If they can rez, they can duplicate
return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene);
}
- private bool CanDeleteObject(UUID objectID, UUID userID, Scene scene)
+ private bool CanDeleteObject(SceneObjectGroup sog, ScenePresence sp)
+ {
+ // ignoring locked. viewers should warn and ask for confirmation
+
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
+ return false;
+
+ if(sog.IsAttachment)
+ return false;
+
+ UUID sogOwnerID = sog.OwnerID;
+ UUID spID = sp.UUID;
+
+ if(sogOwnerID == spID)
+ return true;
+
+ if (sp.IsGod)
+ return true;
+
+ if (IsFriendWithPerms(sog.UUID, sogOwnerID))
+ return true;
+
+ UUID sogGroupID = sog.GroupID;
+ if (sogGroupID != UUID.Zero)
+ {
+ ulong powers = 0;
+ if(GroupMemberPowers(sogGroupID, sp, ref powers))
+ {
+ if(sogGroupID == sogOwnerID)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return true;
+ }
+ return (sog.EffectiveGroupPerms & (uint)PermissionMask.Modify) != 0;
+ }
+ }
+ return false;
+ }
+
+ private bool CanDeleteObjectByIDs(UUID objectID, UUID userID, Scene scene)
{
+ // ignoring locked. viewers should warn and ask for confirmation
+
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1183,11 +1250,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- // ignoring locked. viewers should warn and ask for confirmation
- uint perms = GetObjectPermissions(userID, sog, false);
- if((perms & (uint)PermissionMask.Modify) == 0)
+ if(sog.IsAttachment)
return false;
- return true;
+
+ UUID sogOwnerID = sog.OwnerID;
+
+ if(sogOwnerID == userID)
+ return true;
+
+ if (IsAdministrator(userID))
+ return true;
+
+ if (IsFriendWithPerms(objectID, sogOwnerID))
+ return true;
+
+ UUID sogGroupID = sog.GroupID;
+ if (sogGroupID != UUID.Zero)
+ {
+ ulong powers = 0;
+ if(GroupMemberPowers(sogGroupID, userID, ref powers))
+ {
+ if(sogGroupID == sogOwnerID)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return true;
+ }
+ return (sog.EffectiveGroupPerms & (uint)PermissionMask.Modify) != 0;
+ }
+ }
+ return false;
}
private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
@@ -1667,6 +1758,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
{
+ // ignore locked, viewers shell ask for confirmation
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1677,14 +1769,36 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(sog.IsAttachment)
return false;
- // ignore locked, viewers shell ask for confirmation
- uint perms = GetObjectPermissions(sp, sog, false);
- if((perms & (uint)PermissionMask.Modify) == 0)
+ UUID sogOwnerID = sog.OwnerID;
+ UUID spID = sp.UUID;
+
+ if(sogOwnerID == spID)
+ return true;
+
+ if (sp.IsGod)
+ return true;
+
+ if((sog.EffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
return false;
+
+ if (IsFriendWithPerms(sog.UUID, sogOwnerID))
+ return true;
- if (sog.OwnerID != sp.UUID && ((perms & (uint)PermissionMask.Transfer) == 0))
- return false;
- return true;
+ UUID sogGroupID = sog.GroupID;
+ if (sogGroupID != UUID.Zero)
+ {
+ ulong powers = 0;
+ if(GroupMemberPowers(sogGroupID, sp, ref powers))
+ {
+ if(sogGroupID == sogOwnerID)
+ {
+ if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
+ return true;
+ }
+ return (sog.EffectiveGroupPerms & (uint)PermissionMask.Modify) != 0;
+ }
+ }
+ return false;
}
private bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
@@ -1703,7 +1817,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if((perms & (uint)PermissionMask.Copy) == 0)
return false;
- if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
+ if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
return false;
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 3230a2b..a1eb721 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1380,18 +1380,10 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
- if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
+ if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId))
{
- // If the item to be moved is no copy, we need to be able to
- // edit the prim.
- if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
- return;
- }
- else
- {
- // If the item is copiable, then we just need to have perms
- // on it. The delete check is a pure rights check
- if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId))
+ // check also if we can delete the no copy item
+ if(!Permissions.CanEditObject(part.UUID, remoteClient.AgentId))
return;
}
@@ -2125,6 +2117,7 @@ namespace OpenSim.Region.Framework.Scenes
List deleteIDs = new List();
List deleteGroups = new List();
List takeGroups = new List();
+ List takeDeleteGroups = new List();
ScenePresence sp = remoteClient.SceneAgent as ScenePresence;
@@ -2192,7 +2185,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!Permissions.CanTakeObject(grp, sp))
permissionToTake = false;
- if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
+ if (!Permissions.CanDeleteObject(grp, remoteClient))
permissionToDelete = false;
}
@@ -2249,26 +2242,24 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- if (permissionToTake && (!permissionToDelete))
- takeGroups.Add(grp);
-
if (permissionToDelete)
{
if (permissionToTake)
+ takeDeleteGroups.Add(grp);
+ else
deleteGroups.Add(grp);
deleteIDs.Add(grp.LocalId);
}
+ else if(permissionToTake)
+ takeGroups.Add(grp);
}
SendKillObject(deleteIDs);
- if (deleteGroups.Count > 0)
+ if (takeDeleteGroups.Count > 0)
{
- foreach (SceneObjectGroup g in deleteGroups)
- deleteIDs.Remove(g.LocalId);
-
m_asyncSceneObjectDeleter.DeleteToInventory(
- action, destinationID, deleteGroups, remoteClient,
+ action, destinationID, takeDeleteGroups, remoteClient,
true);
}
if (takeGroups.Count > 0)
@@ -2277,7 +2268,7 @@ namespace OpenSim.Region.Framework.Scenes
action, destinationID, takeGroups, remoteClient,
false);
}
- if (deleteIDs.Count > 0)
+ if (deleteGroups.Count > 0)
{
foreach (SceneObjectGroup g in deleteGroups)
DeleteSceneObject(g, true);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index e941210..754609a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -42,7 +42,8 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool BypassPermissionsHandler();
public delegate bool PropagatePermissionsHandler();
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
- public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
+ public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter, Scene scene);
+ public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
@@ -114,6 +115,7 @@ namespace OpenSim.Region.Framework.Scenes
public event BypassPermissionsHandler OnBypassPermissions;
public event PropagatePermissionsHandler OnPropagatePermissions;
public event RezObjectHandler OnRezObject;
+ public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs;
public event DeleteObjectHandler OnDeleteObject;
public event TransferObjectHandler OnTransferObject;
public event TakeObjectHandler OnTakeObject;
@@ -262,13 +264,39 @@ namespace OpenSim.Region.Framework.Scenes
{
bool result = true;
+ DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs;
+ if (handler != null)
+ {
+ Delegate[] list = handler.GetInvocationList();
+ foreach (DeleteObjectHandlerByIDs h in list)
+ {
+ if (h(objectID, deleter, m_scene) == false)
+ {
+ result = false;
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
+ {
+ bool result = true;
+
DeleteObjectHandler handler = OnDeleteObject;
if (handler != null)
{
+ if(sog == null || client == null || client.SceneAgent == null)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+
Delegate[] list = handler.GetInvocationList();
foreach (DeleteObjectHandler h in list)
{
- if (h(objectID, deleter, m_scene) == false)
+ if (h(sog, sp) == false)
{
result = false;
break;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index b9fa8e4..ddb03c3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -315,8 +315,7 @@ namespace OpenSim.Region.Framework.Scenes
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
- bool noBaseTransfer = (RootPart.OwnerID != RootPart.GroupID &&
- (basePerms & (uint)PermissionMask.Transfer) == 0);
+ bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
uint rootOwnerPerms = RootPart.OwnerMask;
uint owner = rootOwnerPerms;
@@ -342,17 +341,17 @@ namespace OpenSim.Region.Framework.Scenes
owner &= basePerms;
m_EffectiveOwnerPerms = owner;
+ uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
// recover modify and move
rootGroupPerms &= movemodmask;
group |= rootGroupPerms;
if(noBaseTransfer)
group &=~(uint)PermissionMask.Copy;
+ else
+ group |= ownertransfermask;
uint groupOrEveryone = group;
-
- if((group & copytransfermast) == 0)
- group |= (uint)PermissionMask.Transfer;
m_EffectiveGroupPerms = group & owner;
// recover move
@@ -361,15 +360,12 @@ namespace OpenSim.Region.Framework.Scenes
everyone &= ~(uint)PermissionMask.Modify;
if(noBaseTransfer)
everyone &=~(uint)PermissionMask.Copy;
+ else
+ everyone |= ownertransfermask;
groupOrEveryone |= everyone;
- if((everyone & copytransfermast) == 0)
- everyone |= (uint)PermissionMask.Transfer;
m_EffectiveEveryOnePerms = everyone & owner;
-
- if((groupOrEveryone & copytransfermast) == 0)
- groupOrEveryone |= (uint)PermissionMask.Transfer;
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
}
}
@@ -386,8 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
- bool noBaseTransfer = (RootPart.OwnerID == RootPart.GroupID &&
- (basePerms & (uint)PermissionMask.Transfer) == 0);
+ bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
uint rootOwnerPerms = RootPart.OwnerMask;
uint owner = rootOwnerPerms;
@@ -412,17 +407,17 @@ namespace OpenSim.Region.Framework.Scenes
owner &= basePerms;
m_EffectiveOwnerPerms = owner;
+ uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
// recover modify and move
rootGroupPerms &= movemodmask;
group |= rootGroupPerms;
if(noBaseTransfer)
group &=~(uint)PermissionMask.Copy;
+ else
+ group |= ownertransfermask;
uint groupOrEveryone = group;
-
- if((group & copytransfermast) == 0)
- group |= (uint)PermissionMask.Transfer;
m_EffectiveGroupPerms = group & owner;
// recover move
@@ -431,15 +426,12 @@ namespace OpenSim.Region.Framework.Scenes
everyone &= ~(uint)PermissionMask.Modify;
if(noBaseTransfer)
everyone &=~(uint)PermissionMask.Copy;
+ else
+ everyone |= ownertransfermask;
groupOrEveryone |= everyone;
- if((everyone & copytransfermast) == 0)
- everyone |= (uint)PermissionMask.Transfer;
m_EffectiveEveryOnePerms = everyone & owner;
-
- if((groupOrEveryone & copytransfermast) == 0)
- groupOrEveryone |= (uint)PermissionMask.Transfer;
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
}
}
--
cgit v1.1
From 8d99c86f96319e143e8e3b5a642c420fd0867c57 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 22 Jan 2017 05:07:43 +0000
Subject: share before groupr roles was a testing elsewhere induced mistake,
clean it up
---
.../World/Permissions/PermissionsModule.cs | 82 ++++++++++------------
1 file changed, 36 insertions(+), 46 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index e16022d..b0fdd11 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -739,10 +739,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
UUID taskGroupID = task.GroupID;
- bool groupdOwned = taskOwnerID == taskGroupID;
+ bool notGroupdOwned = taskOwnerID != taskGroupID;
// if friends with rights then owner
- if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
+ if (notGroupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{
returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked);
returnMask |= EXTRAOWNERMASK;
@@ -756,47 +756,37 @@ namespace OpenSim.Region.CoreModules.World.Permissions
ulong powers = 0;
if(taskGroupID != UUID.Zero && GroupMemberPowers(taskGroupID, sp, ref powers))
{
- // shared as priority over group roles
- bool notShared = (grp.EffectiveGroupPerms & SHAREDMASK) == 0;
- if(groupdOwned && notShared)
+ if(notGroupdOwned)
{
- // object is owned by group, check role powers
- if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
- {
- // group sharing or everyone
- returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
- returnMask |=
- (uint)PrimFlags.ObjectGroupOwned |
- (uint)PrimFlags.ObjectAnyOwner;
- return returnMask;
- }
-
- // we may have copy without transfer
- uint grpEffectiveOwnerPerms = grp.EffectiveOwnerPerms;
- if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
- grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
- returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
- returnMask |=
- (uint)PrimFlags.ObjectGroupOwned |
- (uint)PrimFlags.ObjectAnyOwner;
- if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
- returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ // group sharing or everyone
+ returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
+ if (taskOwnerID != UUID.Zero)
+ returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
- else
+
+ // object is owned by group, check role powers
+ if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
{
// group sharing or everyone
returnMask = ApplyObjectModifyMasks(grp.EffectiveGroupOrEveryOnePerms, objflags, unlocked);
- if(groupdOwned)
- {
- returnMask |=
- (uint)PrimFlags.ObjectGroupOwned |
- (uint)PrimFlags.ObjectAnyOwner;
- }
- else if (taskOwnerID != UUID.Zero)
- returnMask |= (uint)PrimFlags.ObjectAnyOwner;
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectAnyOwner;
return returnMask;
}
+
+ // we may have copy without transfer
+ uint grpEffectiveOwnerPerms = grp.EffectiveOwnerPerms;
+ if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
+ returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
+ returnMask |=
+ (uint)PrimFlags.ObjectGroupOwned |
+ (uint)PrimFlags.ObjectYouOwner;
+ if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
+ returnMask |= (uint)PrimFlags.ObjectOwnerModify;
+ return returnMask;
}
// fallback is everyone rights
@@ -898,17 +888,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (group.IsAttachment)
return 0;
-
- if (IsFriendWithPerms(currentUser, objectOwner))
- return group.EffectiveOwnerPerms & lockmask;
UUID sogGroupID = group.GroupID;
+ bool notgroudOwned = sogGroupID != objectOwner;
+
+ if (notgroudOwned && IsFriendWithPerms(currentUser, objectOwner))
+ return group.EffectiveOwnerPerms & lockmask;
+
ulong powers = 0;
if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, currentUser, ref powers))
{
- bool Shared = (group.EffectiveGroupPerms & SHAREDMASK) != 0;
-
- if(Shared || sogGroupID != objectOwner)
+ if(notgroudOwned)
return group.EffectiveGroupOrEveryOnePerms & lockmask;
if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
@@ -955,16 +945,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (group.IsAttachment)
return 0;
- if (IsFriendWithPerms(spID, objectOwner))
+ UUID sogGroupID = group.GroupID;
+ bool notgroudOwned = sogGroupID != objectOwner;
+
+ if (notgroudOwned && IsFriendWithPerms(spID, objectOwner))
return group.EffectiveOwnerPerms & lockmask;
- UUID sogGroupID = group.GroupID;
ulong powers = 0;
if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, sp, ref powers))
{
- bool Shared = (group.EffectiveGroupPerms & SHAREDMASK) != 0;
-
- if(Shared || sogGroupID != objectOwner)
+ if(notgroudOwned)
return group.EffectiveGroupOrEveryOnePerms & lockmask;
if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
--
cgit v1.1
From df035a4022b1a4e7c9d745ee47e87fd62e8987c2 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 22 Jan 2017 21:38:59 +0000
Subject: don't let part lastowner be the group
---
.../CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 6783ce0..a73906c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -1139,8 +1139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
foreach (SceneObjectPart part in so.Parts)
{
part.GroupMask = 0; // DO NOT propagate here
-
- part.LastOwnerID = part.OwnerID;
+ if( part.OwnerID != part.GroupID)
+ part.LastOwnerID = part.OwnerID;
part.OwnerID = item.Owner;
part.RezzerID = item.Owner;
part.Inventory.ChangeInventoryOwner(item.Owner);
--
cgit v1.1
From c673ef7e3cd5d9bb4d06094229d5a0647f49a36e Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 22 Jan 2017 23:05:39 +0000
Subject: replace calls to SOG.GetEffectivePermissions() by the new
SOG.EffectiveOwnerPerms, some of those inline permissions checks should be
reviewed and pass by permissions module
---
OpenSim/Region/CoreModules/World/Land/LandObject.cs | 2 +-
OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | 4 ++--
OpenSim/Region/Framework/Scenes/Scene.cs | 2 +-
.../OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3aca741..8c0edc8 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.CoreModules.World.Land
foreach (SceneObjectGroup obj in primsOverMe)
{
if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero &&
- (obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
+ (obj.EffectiveOwnerPerms & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
}
}
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 4542bbf..504a584 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
switch (saleType)
{
case 1: // Sell as original (in-place sale)
- uint effectivePerms = group.GetEffectivePermissions();
+ uint effectivePerms = group.EffectiveOwnerPerms;
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
{
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
group.AbsolutePosition = originalPosition;
- uint perms = group.GetEffectivePermissions();
+ uint perms = group.EffectiveOwnerPerms;
if ((perms & (uint)PermissionMask.Transfer) == 0)
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ca298be..4fca4ed 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2770,7 +2770,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup sog = (SceneObjectGroup)e;
if (sog != null && !sog.IsAttachment)
{
- if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0))
+ if (!exceptNoCopy || ((sog.EffectiveOwnerPerms & (uint)PermissionMask.Copy) != 0))
{
DeleteSceneObject((SceneObjectGroup)e, false);
}
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index 2bb48ad..92b5831 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
if (target.UUID != hostgroup.OwnerID)
{
- uint effectivePerms = hostgroup.GetEffectivePermissions();
+ uint effectivePerms = hostgroup.EffectiveOwnerPerms;
if ((effectivePerms & (uint)PermissionMask.Transfer) == 0)
return 0;
--
cgit v1.1
From 1e0ed50d29ac89e8f2d41872967a30b7963cf0ba Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 23 Jan 2017 01:18:27 +0000
Subject: Activate the new Offline IM module code instead of the old code
As most have gone to OfflineMessaging V2, this change will not affect
existing users but will benefit future grids.
---
.../Avatar/InstantMessage/OfflineMessageModule.cs | 24 ++++------------------
1 file changed, 4 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index d1f6054..297346a 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -248,22 +248,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (scene == null)
scene = m_SceneList[0];
-// Avination new code
-// SendReply reply = SynchronousRestObjectRequester.MakeRequest(
-// "POST", m_RestURL+"/SaveMessage/?scope=" +
-// scene.RegionInfo.ScopeID.ToString(), im);
-
-// current opensim and osgrid compatible
- bool success = SynchronousRestObjectRequester.MakeRequest(
- "POST", m_RestURL+"/SaveMessage/", im, 10000);
-// current opensim and osgrid compatible end
+ SendReply reply = SynchronousRestObjectRequester.MakeRequest(
+ "POST", m_RestURL+"/SaveMessage/?scope=" +
+ scene.RegionInfo.ScopeID.ToString(), im);
if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
{
IClientAPI client = FindClient(new UUID(im.fromAgentID));
if (client == null)
return;
-/* Avination new code
+
if (reply.Message == String.Empty)
reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
@@ -296,16 +290,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
reply.Message,
false, new Vector3()));
}
-*/
-// current opensim and osgrid compatible
- client.SendInstantMessage(new GridInstantMessage(
- null, new UUID(im.toAgentID),
- "System", new UUID(im.fromAgentID),
- (byte)InstantMessageDialog.MessageFromAgent,
- "User is not logged in. "+
- (success ? "Message saved." : "Message not saved"),
- false, new Vector3()));
-// current opensim and osgrid compatible end
}
}
}
--
cgit v1.1
From f50d59843483a9f8ea7e5adff0e454640ac091ec Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 23 Jan 2017 14:06:38 +0000
Subject: Disable spam in profiles module. Modules should not say they're
disabled.
---
OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index bc8aeca..89e3020 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if (profileConfig == null)
{
- m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration");
+ //m_log.Debug("[PROFILES]: UserProfiles disabled, no configuration");
Enabled = false;
return;
}
--
cgit v1.1
From f0700f48d8280e46f2322f0471b89df41198e93a Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 23 Jan 2017 14:26:14 +0000
Subject: Comment some more debug and squelch another module not running msg.
Modules whould not require that their .ini key is present. If the user
chooses to not use that module, they should not be required to retain
the config key for it.
---
.../UserProfiles/LocalUserProfilesServiceConnector.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs
index 9e75ee2..2e6f472 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs
@@ -85,12 +85,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
public LocalUserProfilesServicesConnector()
{
- m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params");
+ //m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params");
}
public LocalUserProfilesServicesConnector(IConfigSource source)
{
- m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly.");
+ //m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly.");
InitialiseService(source);
}
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
IConfig config = source.Configs[ConfigName];
if (config == null)
{
- m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini");
+ //m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini");
return;
}
@@ -225,4 +225,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile
}
#endregion
}
-}
\ No newline at end of file
+}
--
cgit v1.1
From b45f6b933fc7f9baf625dd846debf33f7fba9ea9 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 24 Jan 2017 14:01:39 +0000
Subject: fix a bug in CanCopyObjectInventory; add CanDoObjectInvToObjectInv (
not wired)
---
.../World/Permissions/PermissionsModule.cs | 105 ++++++++++++++++-----
1 file changed, 82 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b0fdd11..1b3fdc3 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -258,56 +258,65 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnBypassPermissions += BypassPermissions;
m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions;
m_scene.Permissions.OnPropagatePermissions += PropagatePermissions;
+
+ m_scene.Permissions.OnIsGridGod += IsGridAdministrator;
+ m_scene.Permissions.OnIsAdministrator += IsAdministrator;
+ m_scene.Permissions.OnIsEstateManager += IsEstateManager;
+
m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags;
+
+ m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand;
+ m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
+
+ m_scene.Permissions.OnTeleport += CanTeleport;
+
+ m_scene.Permissions.OnInstantMessage += CanInstantMessage;
+
m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
m_scene.Permissions.OnDeedParcel += CanDeedParcel;
- m_scene.Permissions.OnDeedObject += CanDeedObject;
- m_scene.Permissions.OnIsGridGod += IsGridAdministrator;
- m_scene.Permissions.OnIsAdministrator += IsAdministrator;
- m_scene.Permissions.OnIsEstateManager += IsEstateManager;
+ m_scene.Permissions.OnSellParcel += CanSellParcel;
+ m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
+ m_scene.Permissions.OnTerraformLand += CanTerraformLand;
+ m_scene.Permissions.OnBuyLand += CanBuyLand;
+
+ m_scene.Permissions.OnRezObject += CanRezObject;
+ m_scene.Permissions.OnObjectEntry += CanObjectEntry;
+ m_scene.Permissions.OnReturnObjects += CanReturnObjects;
+
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
m_scene.Permissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
m_scene.Permissions.OnDeleteObject += CanDeleteObject;
m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
m_scene.Permissions.OnEditObject += CanEditObject;
- m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
- m_scene.Permissions.OnInstantMessage += CanInstantMessage;
m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer;
- m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand;
m_scene.Permissions.OnMoveObject += CanMoveObject;
- m_scene.Permissions.OnObjectEntry += CanObjectEntry;
- m_scene.Permissions.OnReturnObjects += CanReturnObjects;
- m_scene.Permissions.OnRezObject += CanRezObject;
- m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
- m_scene.Permissions.OnRunScript += CanRunScript;
- m_scene.Permissions.OnCompileScript += CanCompileScript;
- m_scene.Permissions.OnSellParcel += CanSellParcel;
m_scene.Permissions.OnTakeObject += CanTakeObject;
- m_scene.Permissions.OnSellGroupObject += CanSellGroupObject;
m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
- m_scene.Permissions.OnTerraformLand += CanTerraformLand;
m_scene.Permissions.OnLinkObject += CanLinkObject;
m_scene.Permissions.OnDelinkObject += CanDelinkObject;
- m_scene.Permissions.OnBuyLand += CanBuyLand;
+ m_scene.Permissions.OnDeedObject += CanDeedObject;
+ m_scene.Permissions.OnSellGroupObject += CanSellGroupObject;
- m_scene.Permissions.OnViewNotecard += CanViewNotecard;
- m_scene.Permissions.OnViewScript += CanViewScript;
- m_scene.Permissions.OnEditNotecard += CanEditNotecard;
- m_scene.Permissions.OnEditScript += CanEditScript;
m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory;
m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
+
+ m_scene.Permissions.OnViewNotecard += CanViewNotecard;
+ m_scene.Permissions.OnViewScript += CanViewScript;
+ m_scene.Permissions.OnEditNotecard += CanEditNotecard;
+ m_scene.Permissions.OnEditScript += CanEditScript;
m_scene.Permissions.OnResetScript += CanResetScript;
+ m_scene.Permissions.OnRunScript += CanRunScript;
+ m_scene.Permissions.OnCompileScript += CanCompileScript;
m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory;
m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory;
m_scene.Permissions.OnEditUserInventory += CanEditUserInventory;
m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory;
- m_scene.Permissions.OnTeleport += CanTeleport;
m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
@@ -2061,7 +2070,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(objectID, sog, true);
+ uint perms = GetObjectPermissions(userID, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
@@ -2080,6 +2089,56 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
+ // object inventory to object inventory item drag and drop
+ private bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ if (sourcePart == null || destPart == null || item == null)
+ return false;
+
+ SceneObjectGroup srcsog = sourcePart.ParentGroup;
+ SceneObjectGroup destsog = destPart.ParentGroup;
+ if (srcsog == null || destsog == null)
+ return false;
+
+ // dest is locked
+ if((destsog.EffectiveOwnerPerms & (uint)PermissionMask.Move) == 0)
+ return false;
+
+ uint itperms = item.CurrentPermissions;
+
+ // if item is no copy the source is modifed
+ if((itperms & (uint)PermissionMask.Copy) == 0 && (srcsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
+ return false;
+
+ UUID srcOwner = srcsog.OwnerID;
+ UUID destOwner = destsog.OwnerID;
+ bool notSameOwner = srcOwner != destOwner;
+
+ if(notSameOwner)
+ {
+ if((itperms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+
+ // scripts can't be droped
+ if(item.InvType == (int)InventoryType.LSL)
+ return false;
+
+ if((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
+ return false;
+ }
+ else
+ {
+ if((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0 &&
+ (destsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
+ return false;
+ }
+
+ return true;
+ }
+
private bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
--
cgit v1.1
From 74ac2034e00286af27d309248d4add2c2a073309 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 25 Jan 2017 16:57:46 +0000
Subject: make use of CanDoObjectInvToObjectInv
---
.../World/Permissions/PermissionsModule.cs | 1 +
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 22 +---------------------
.../Region/Framework/Scenes/Scene.Permissions.cs | 19 +++++++++++++++++++
3 files changed, 21 insertions(+), 21 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 1b3fdc3..1973bcb 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -303,6 +303,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
+ m_scene.Permissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv;
m_scene.Permissions.OnViewNotecard += CanViewNotecard;
m_scene.Permissions.OnViewScript += CanViewScript;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a1eb721..29666d5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1461,28 +1461,8 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
- // Can't transfer this
- //
- if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
- return;
-
- bool overrideNoMod = false;
- if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
- overrideNoMod = true;
-
- if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
- {
- // object cannot copy items to an object owned by a different owner
- // unless llAllowInventoryDrop has been called
-
+ if(!Permissions.CanDoObjectInvToObjectInv(srcTaskItem, part, destPart))
return;
- }
-
- // must have both move and modify permission to put an item in an object
- if (((part.OwnerMask & (uint)PermissionMask.Modify) == 0) && (!overrideNoMod))
- {
- return;
- }
TaskInventoryItem destTaskItem = new TaskInventoryItem();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 754609a..968b298 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -86,6 +86,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
+ public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
@@ -158,6 +159,7 @@ namespace OpenSim.Region.Framework.Scenes
public event DelinkObjectHandler OnDelinkObject;
public event CreateObjectInventoryHandler OnCreateObjectInventory;
public event CopyObjectInventoryHandler OnCopyObjectInventory;
+ public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
public event TransferObjectInventoryHandler OnTransferObjectInventory;
public event CreateUserInventoryHandler OnCreateUserInventory;
@@ -1090,6 +1092,23 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
+ public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
+ {
+ DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
+ if (handler != null)
+ {
+ if (sourcePart == null || destPart == null || item == null)
+ return false;
+ Delegate[] list = handler.GetInvocationList();
+ foreach (DoObjectInvToObjectInv h in list)
+ {
+ if (h(item, sourcePart, destPart) == false)
+ return false;
+ }
+ }
+ return true;
+ }
+
public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
--
cgit v1.1
From f722f1cf6c96c36ff64de5df63979ebc81875b94 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 25 Jan 2017 18:10:59 +0000
Subject: fix test setup
---
.../ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index d652b0d1..16b87b3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
using OpenSim.Region.OptionalModules.World.NPC;
using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api;
using OpenSim.Region.ScriptEngine.Shared.Instance;
@@ -63,12 +64,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
base.SetUp();
IConfigSource initConfigSource = new IniConfigSource();
- IConfig config = initConfigSource.AddConfig("XEngine");
+ IConfig config = initConfigSource.AddConfig("Startup");
+ config.Set("serverside_object_permissions", true);
+ config =initConfigSource.AddConfig("Permissions");
+ config.Set("permissionmodules", "DefaultPermissionsModule");
+ config.Set("serverside_object_permissions", true);
+ config.Set("propagate_permissions", true);
+
+ config = initConfigSource.AddConfig("XEngine");
config.Set("Enabled", "true");
m_scene = new SceneHelpers().SetupScene();
- SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
-
+ SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new object[] { new DefaultPermissionsModule() });
m_engine = new XEngine.XEngine();
m_engine.Initialise(initConfigSource);
m_engine.AddRegion(m_scene);
--
cgit v1.1
From 02fbe5a740e81280bff16caaf50f5f6326fc9c80 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 25 Jan 2017 19:39:58 +0000
Subject: add and use CanDropInObjectInv
---
.../World/Permissions/PermissionsModule.cs | 191 ++++++++++++--------
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 200 ++++++++++-----------
.../Region/Framework/Scenes/Scene.Permissions.cs | 24 +++
3 files changed, 242 insertions(+), 173 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 1973bcb..bbebce1 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene;
+ protected ScenePermissions scenePermissions;
protected bool m_Enabled;
private InventoryFolderImpl m_libraryRootFolder;
@@ -253,74 +254,74 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_scene = scene;
scene.RegisterModuleInterface(this);
+ scenePermissions = m_scene.Permissions;
//Register functions with Scene External Checks!
- m_scene.Permissions.OnBypassPermissions += BypassPermissions;
- m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions;
- m_scene.Permissions.OnPropagatePermissions += PropagatePermissions;
-
- m_scene.Permissions.OnIsGridGod += IsGridAdministrator;
- m_scene.Permissions.OnIsAdministrator += IsAdministrator;
- m_scene.Permissions.OnIsEstateManager += IsEstateManager;
-
- m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags;
-
- m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand;
- m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
-
- m_scene.Permissions.OnTeleport += CanTeleport;
-
- m_scene.Permissions.OnInstantMessage += CanInstantMessage;
-
- m_scene.Permissions.OnAbandonParcel += CanAbandonParcel;
- m_scene.Permissions.OnReclaimParcel += CanReclaimParcel;
- m_scene.Permissions.OnDeedParcel += CanDeedParcel;
- m_scene.Permissions.OnSellParcel += CanSellParcel;
- m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
- m_scene.Permissions.OnTerraformLand += CanTerraformLand;
- m_scene.Permissions.OnBuyLand += CanBuyLand;
-
- m_scene.Permissions.OnRezObject += CanRezObject;
- m_scene.Permissions.OnObjectEntry += CanObjectEntry;
- m_scene.Permissions.OnReturnObjects += CanReturnObjects;
-
- m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
- m_scene.Permissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
- m_scene.Permissions.OnDeleteObject += CanDeleteObject;
- m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
- m_scene.Permissions.OnEditObject += CanEditObject;
- m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer;
- m_scene.Permissions.OnMoveObject += CanMoveObject;
- m_scene.Permissions.OnTakeObject += CanTakeObject;
- m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
- m_scene.Permissions.OnLinkObject += CanLinkObject;
- m_scene.Permissions.OnDelinkObject += CanDelinkObject;
- m_scene.Permissions.OnDeedObject += CanDeedObject;
- m_scene.Permissions.OnSellGroupObject += CanSellGroupObject;
-
-
- m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory;
- m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
- m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
- m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
- m_scene.Permissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv;
-
- m_scene.Permissions.OnViewNotecard += CanViewNotecard;
- m_scene.Permissions.OnViewScript += CanViewScript;
- m_scene.Permissions.OnEditNotecard += CanEditNotecard;
- m_scene.Permissions.OnEditScript += CanEditScript;
- m_scene.Permissions.OnResetScript += CanResetScript;
- m_scene.Permissions.OnRunScript += CanRunScript;
- m_scene.Permissions.OnCompileScript += CanCompileScript;
-
- m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory;
- m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory;
- m_scene.Permissions.OnEditUserInventory += CanEditUserInventory;
- m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory;
-
-
- m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
- m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
+ scenePermissions.OnBypassPermissions += BypassPermissions;
+ scenePermissions.OnSetBypassPermissions += SetBypassPermissions;
+ scenePermissions.OnPropagatePermissions += PropagatePermissions;
+
+ scenePermissions.OnIsGridGod += IsGridAdministrator;
+ scenePermissions.OnIsAdministrator += IsAdministrator;
+ scenePermissions.OnIsEstateManager += IsEstateManager;
+
+ scenePermissions.OnGenerateClientFlags += GenerateClientFlags;
+
+ scenePermissions.OnIssueEstateCommand += CanIssueEstateCommand;
+ scenePermissions.OnRunConsoleCommand += CanRunConsoleCommand;
+
+ scenePermissions.OnTeleport += CanTeleport;
+
+ scenePermissions.OnInstantMessage += CanInstantMessage;
+
+ scenePermissions.OnAbandonParcel += CanAbandonParcel;
+ scenePermissions.OnReclaimParcel += CanReclaimParcel;
+ scenePermissions.OnDeedParcel += CanDeedParcel;
+ scenePermissions.OnSellParcel += CanSellParcel;
+ scenePermissions.OnEditParcelProperties += CanEditParcelProperties;
+ scenePermissions.OnTerraformLand += CanTerraformLand;
+ scenePermissions.OnBuyLand += CanBuyLand;
+
+ scenePermissions.OnRezObject += CanRezObject;
+ scenePermissions.OnObjectEntry += CanObjectEntry;
+ scenePermissions.OnReturnObjects += CanReturnObjects;
+
+ scenePermissions.OnDuplicateObject += CanDuplicateObject;
+ scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
+ scenePermissions.OnDeleteObject += CanDeleteObject;
+ scenePermissions.OnEditObjectByIDs += CanEditObjectByIDs;
+ scenePermissions.OnEditObject += CanEditObject;
+ scenePermissions.OnInventoryTransfer += CanInventoryTransfer;
+ scenePermissions.OnMoveObject += CanMoveObject;
+ scenePermissions.OnTakeObject += CanTakeObject;
+ scenePermissions.OnTakeCopyObject += CanTakeCopyObject;
+ scenePermissions.OnLinkObject += CanLinkObject;
+ scenePermissions.OnDelinkObject += CanDelinkObject;
+ scenePermissions.OnDeedObject += CanDeedObject;
+ scenePermissions.OnSellGroupObject += CanSellGroupObject;
+
+ scenePermissions.OnCreateObjectInventory += CanCreateObjectInventory;
+ scenePermissions.OnEditObjectInventory += CanEditObjectInventory;
+ scenePermissions.OnCopyObjectInventory += CanCopyObjectInventory;
+ scenePermissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
+ scenePermissions.OnDoObjectInvToObjectInv += CanDoObjectInvToObjectInv;
+ scenePermissions.OnDropInObjectInv += CanDropInObjectInv;
+
+ scenePermissions.OnViewNotecard += CanViewNotecard;
+ scenePermissions.OnViewScript += CanViewScript;
+ scenePermissions.OnEditNotecard += CanEditNotecard;
+ scenePermissions.OnEditScript += CanEditScript;
+ scenePermissions.OnResetScript += CanResetScript;
+ scenePermissions.OnRunScript += CanRunScript;
+ scenePermissions.OnCompileScript += CanCompileScript;
+
+ scenePermissions.OnCreateUserInventory += CanCreateUserInventory;
+ scenePermissions.OnCopyUserInventory += CanCopyUserInventory;
+ scenePermissions.OnEditUserInventory += CanEditUserInventory;
+ scenePermissions.OnDeleteUserInventory += CanDeleteUserInventory;
+
+ scenePermissions.OnControlPrimMedia += CanControlPrimMedia;
+ scenePermissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
m_scene.AddCommand("Users", this, "bypass permissions",
"bypass permissions ",
@@ -2094,11 +2095,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
- if (m_bypassPermissions) return m_bypassPermissionsValue;
if (sourcePart == null || destPart == null || item == null)
return false;
+ if (m_bypassPermissions)
+ return m_bypassPermissionsValue;
+
SceneObjectGroup srcsog = sourcePart.ParentGroup;
SceneObjectGroup destsog = destPart.ParentGroup;
if (srcsog == null || destsog == null)
@@ -2127,12 +2130,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(item.InvType == (int)InventoryType.LSL)
return false;
- if((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
+ if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
return false;
}
else
{
- if((destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0 &&
+ if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0 &&
(destsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
return false;
}
@@ -2140,6 +2143,54 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
+ private bool CanDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+
+ if (sp == null || sp.IsDeleted || destPart == null || item == null)
+ return false;
+
+ SceneObjectGroup destsog = destPart.ParentGroup;
+ if (destsog == null || destsog.IsDeleted)
+ return false;
+
+ if (m_bypassPermissions)
+ return m_bypassPermissionsValue;
+
+ if(sp.IsGod)
+ return true;
+
+ // dest is locked
+ if((destsog.EffectiveOwnerPerms & (uint)PermissionMask.Move) == 0)
+ return false;
+
+ UUID destOwner = destsog.OwnerID;
+ UUID spID = sp.UUID;
+ bool spNotOwner = spID != destOwner;
+
+ // scripts can't be droped
+ if(spNotOwner && item.InvType == (int)InventoryType.LSL)
+ return false;
+
+ if(spNotOwner || item.Owner != destOwner)
+ {
+ // no copy item will be moved if it has transfer
+ uint itperms = item.CurrentPermissions;
+ if((itperms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+ }
+
+ // allowdrop is a root part thing and does bypass modify rights
+ if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
+ return true;
+
+ uint perms = GetObjectPermissions(spID, destsog, true);
+ if((perms & (uint)PermissionMask.Modify) == 0)
+ return false;
+
+ return true;
+ }
+
private bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -2153,7 +2204,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null)
return false;
- uint perms = GetObjectPermissions(objectID, sog, true);
+ uint perms = GetObjectPermissions(userID, sog, true);
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 29666d5..7377e6d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1645,76 +1645,78 @@ namespace OpenSim.Region.Framework.Scenes
uint primLocalID)
{
UUID itemID = itemInfo.ItemID;
+ if (itemID == UUID.Zero)
+ {
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero to update for {1}!",
+ remoteClient.Name);
+ return;
+ }
// Find the prim we're dealing with
SceneObjectPart part = GetSceneObjectPart(primLocalID);
+ if(part == null)
+ {
+ m_log.WarnFormat(
+ "[PRIM INVENTORY]: " +
+ "Update with item {0} requested of prim {1} for {2} but this prim does not exist",
+ itemID, primLocalID, remoteClient.Name);
+ return;
+ }
- if (part != null)
+ TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID);
+
+ if (currentItem == null)
{
- TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID);
- bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
- & (uint)PrimFlags.AllowInventoryDrop) != 0;
+ InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
- // Explicity allow anyone to add to the inventory if the
- // AllowInventoryDrop flag has been set. Don't however let
- // them update an item unless they pass the external checks
- //
- if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)
- && (currentItem != null || !allowInventoryDrop))
- return;
+ // if not found Try library
+ if (item == null && LibraryService != null && LibraryService.LibraryRootFolder != null)
+ item = LibraryService.LibraryRootFolder.FindItem(itemID);
- if (currentItem == null)
+ if(item == null)
{
- UUID copyID = UUID.Random();
- if (itemID != UUID.Zero)
- {
- InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
+ itemID, remoteClient.Name);
+ return;
+ }
- // Try library
- if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
- {
- item = LibraryService.LibraryRootFolder.FindItem(itemID);
- }
+ if (!Permissions.CanDropInObjectInv(item, remoteClient, part))
+ return;
- // If we've found the item in the user's inventory or in the library
- if (item != null)
- {
- part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
- m_log.InfoFormat(
- "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
- item.Name, primLocalID, remoteClient.Name);
- part.SendPropertiesToClient(remoteClient);
- if (!Permissions.BypassPermissions())
- {
- if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
- {
- List uuids = new List();
- uuids.Add(itemID);
- RemoveInventoryItem(remoteClient, uuids);
- }
- }
- }
- else
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
- itemID, remoteClient.Name);
- }
+ UUID copyID = UUID.Random();
+ part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
+ m_log.InfoFormat(
+ "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
+ item.Name, primLocalID, remoteClient.Name);
+ part.SendPropertiesToClient(remoteClient);
+ if (!Permissions.BypassPermissions())
+ {
+ if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
+ {
+ List uuids = new List();
+ uuids.Add(itemID);
+ RemoveInventoryItem(remoteClient, uuids);
}
}
- else // Updating existing item with new perms etc
- {
+ }
+ else // Updating existing item with new perms etc
+ {
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()",
// currentItem.Name, part.Name);
- // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the
- // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update)
- // will not pass in a transaction ID in the update message.
- if (transactionID != UUID.Zero && AgentTransactionsModule != null)
- {
- AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
- remoteClient, part, transactionID, currentItem);
+ if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
+ return;
+
+ // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the
+ // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update)
+ // will not pass in a transaction ID in the update message.
+ if (transactionID != UUID.Zero && AgentTransactionsModule != null)
+ {
+ AgentTransactionsModule.HandleTaskItemUpdateFromTransaction(
+ remoteClient, part, transactionID, currentItem);
// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard)
// remoteClient.SendAgentAlertMessage("Notecard saved", false);
@@ -1722,49 +1724,30 @@ namespace OpenSim.Region.Framework.Scenes
// remoteClient.SendAgentAlertMessage("Script saved", false);
// else
// remoteClient.SendAgentAlertMessage("Item saved", false);
- }
+ }
- // Base ALWAYS has move
- currentItem.BasePermissions |= (uint)PermissionMask.Move;
+ // Base ALWAYS has move
+ currentItem.BasePermissions |= (uint)PermissionMask.Move;
- itemInfo.Flags = currentItem.Flags;
+ itemInfo.Flags = currentItem.Flags;
- // Check if we're allowed to mess with permissions
- if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
+ // Check if we're allowed to mess with permissions
+ if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
+ {
+ if (remoteClient.AgentId != part.OwnerID) // Not owner
{
- if (remoteClient.AgentId != part.OwnerID) // Not owner
- {
- // Friends and group members can't change any perms
- itemInfo.BasePermissions = currentItem.BasePermissions;
- itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
- itemInfo.GroupPermissions = currentItem.GroupPermissions;
- itemInfo.NextPermissions = currentItem.NextPermissions;
- itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
- }
- else
- {
- // Owner can't change base, and can change other
- // only up to base
- itemInfo.BasePermissions = currentItem.BasePermissions;
- if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
- itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
- if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
- itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
- if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
- itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
- if (itemInfo.NextPermissions != currentItem.NextPermissions)
- itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
- itemInfo.EveryonePermissions &= currentItem.BasePermissions;
- itemInfo.GroupPermissions &= currentItem.BasePermissions;
- itemInfo.CurrentPermissions &= currentItem.BasePermissions;
- itemInfo.NextPermissions &= currentItem.BasePermissions;
- }
-
+ // Friends and group members can't change any perms
+ itemInfo.BasePermissions = currentItem.BasePermissions;
+ itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
+ itemInfo.GroupPermissions = currentItem.GroupPermissions;
+ itemInfo.NextPermissions = currentItem.NextPermissions;
+ itemInfo.CurrentPermissions = currentItem.CurrentPermissions;
}
else
{
- if (itemInfo.BasePermissions != currentItem.BasePermissions)
- itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
+ // Owner can't change base, and can change other
+ // only up to base
+ itemInfo.BasePermissions = currentItem.BasePermissions;
if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
@@ -1773,24 +1756,35 @@ namespace OpenSim.Region.Framework.Scenes
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
if (itemInfo.NextPermissions != currentItem.NextPermissions)
itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
+ itemInfo.EveryonePermissions &= currentItem.BasePermissions;
+ itemInfo.GroupPermissions &= currentItem.BasePermissions;
+ itemInfo.CurrentPermissions &= currentItem.BasePermissions;
+ itemInfo.NextPermissions &= currentItem.BasePermissions;
}
- // Next ALWAYS has move
- itemInfo.NextPermissions |= (uint)PermissionMask.Move;
+ }
+ else
+ {
+ if (itemInfo.BasePermissions != currentItem.BasePermissions)
+ itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteBase;
+ if (itemInfo.EveryonePermissions != currentItem.EveryonePermissions)
+ itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
+ if (itemInfo.GroupPermissions != currentItem.GroupPermissions)
+ itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
+ if (itemInfo.CurrentPermissions != currentItem.CurrentPermissions)
+ itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteOwner;
+ if (itemInfo.NextPermissions != currentItem.NextPermissions)
+ itemInfo.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
+ }
+
+ // Next ALWAYS has move
+ itemInfo.NextPermissions |= (uint)PermissionMask.Move;
- if (part.Inventory.UpdateInventoryItem(itemInfo))
- {
- part.SendPropertiesToClient(remoteClient);
- }
+ if (part.Inventory.UpdateInventoryItem(itemInfo))
+ {
+ part.SendPropertiesToClient(remoteClient);
}
}
- else
- {
- m_log.WarnFormat(
- "[PRIM INVENTORY]: " +
- "Update with item {0} requested of prim {1} for {2} but this prim does not exist",
- itemID, primLocalID, remoteClient.Name);
- }
}
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 968b298..4630497 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -87,6 +87,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
+ public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart);
public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
@@ -160,6 +161,7 @@ namespace OpenSim.Region.Framework.Scenes
public event CreateObjectInventoryHandler OnCreateObjectInventory;
public event CopyObjectInventoryHandler OnCopyObjectInventory;
public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
+ public event DoDropInObjectInv OnDropInObjectInv;
public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
public event TransferObjectInventoryHandler OnTransferObjectInventory;
public event CreateUserInventoryHandler OnCreateUserInventory;
@@ -1109,6 +1111,28 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
+ public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart)
+ {
+ DoDropInObjectInv handler = OnDropInObjectInv;
+ if (handler != null)
+ {
+ if (client == null || client.SceneAgent == null|| destPart == null || item == null)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+ if(sp == null || sp.IsDeleted)
+ return false;
+
+ Delegate[] list = handler.GetInvocationList();
+ foreach (DoDropInObjectInv h in list)
+ {
+ if (h(item, sp, destPart) == false)
+ return false;
+ }
+ }
+ return true;
+ }
+
public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
{
DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
--
cgit v1.1
From dd190f1a1f4639b580cab1cd0695e4ee9534e8ed Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 25 Jan 2017 20:26:09 +0000
Subject: CHANGED ALLOWED_DROP should only trigger if user has no MOD rights
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 109 +++++++++++----------
2 files changed, 59 insertions(+), 55 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 7377e6d..dbc7def 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1648,7 +1648,7 @@ namespace OpenSim.Region.Framework.Scenes
if (itemID == UUID.Zero)
{
m_log.ErrorFormat(
- "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero to update for {1}!",
+ "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!",
remoteClient.Name);
return;
}
@@ -1686,7 +1686,8 @@ namespace OpenSim.Region.Framework.Scenes
return;
UUID copyID = UUID.Random();
- part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID);
+ bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient);
+ part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights);
m_log.InfoFormat(
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
item.Name, primLocalID, remoteClient.Name);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index ddb03c3..12e53a8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes
/// The user inventory item being added.
/// The item UUID that should be used by the new item.
///
- public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID)
+ public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID, bool withModRights = true)
{
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}",
@@ -120,69 +120,72 @@ namespace OpenSim.Region.Framework.Scenes
UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID;
SceneObjectPart part = GetPart(localID);
- if (part != null)
+ if (part == null)
{
- TaskInventoryItem taskItem = new TaskInventoryItem();
-
- taskItem.ItemID = newItemId;
- taskItem.AssetID = item.AssetID;
- taskItem.Name = item.Name;
- taskItem.Description = item.Description;
- taskItem.OwnerID = part.OwnerID; // Transfer ownership
- taskItem.CreatorID = item.CreatorIdAsUuid;
- taskItem.Type = item.AssetType;
- taskItem.InvType = item.InvType;
-
- if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
- {
- taskItem.BasePermissions = item.BasePermissions &
- item.NextPermissions;
- taskItem.CurrentPermissions = item.CurrentPermissions &
- item.NextPermissions;
- taskItem.EveryonePermissions = item.EveryOnePermissions &
- item.NextPermissions;
- taskItem.GroupPermissions = item.GroupPermissions &
- item.NextPermissions;
- taskItem.NextPermissions = item.NextPermissions;
- // We're adding this to a prim we don't own. Force
- // owner change
- taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
- }
- else
- {
- taskItem.BasePermissions = item.BasePermissions;
- taskItem.CurrentPermissions = item.CurrentPermissions;
- taskItem.EveryonePermissions = item.EveryOnePermissions;
- taskItem.GroupPermissions = item.GroupPermissions;
- taskItem.NextPermissions = item.NextPermissions;
- }
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
+ localID, Name, UUID, newItemId);
+ return false;
+ }
+
+ TaskInventoryItem taskItem = new TaskInventoryItem();
+
+ taskItem.ItemID = newItemId;
+ taskItem.AssetID = item.AssetID;
+ taskItem.Name = item.Name;
+ taskItem.Description = item.Description;
+ taskItem.OwnerID = part.OwnerID; // Transfer ownership
+ taskItem.CreatorID = item.CreatorIdAsUuid;
+ taskItem.Type = item.AssetType;
+ taskItem.InvType = item.InvType;
+
+ if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions())
+ {
+ taskItem.BasePermissions = item.BasePermissions &
+ item.NextPermissions;
+ taskItem.CurrentPermissions = item.CurrentPermissions &
+ item.NextPermissions;
+ taskItem.EveryonePermissions = item.EveryOnePermissions &
+ item.NextPermissions;
+ taskItem.GroupPermissions = item.GroupPermissions &
+ item.NextPermissions;
+ taskItem.NextPermissions = item.NextPermissions;
+ // We're adding this to a prim we don't own. Force
+ // owner change
+ taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
+
+ }
+ else
+ {
+ taskItem.BasePermissions = item.BasePermissions;
+ taskItem.CurrentPermissions = item.CurrentPermissions;
+ taskItem.EveryonePermissions = item.EveryOnePermissions;
+ taskItem.GroupPermissions = item.GroupPermissions;
+ taskItem.NextPermissions = item.NextPermissions;
+ }
- taskItem.Flags = item.Flags;
+ taskItem.Flags = item.Flags;
// m_log.DebugFormat(
// "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}",
// taskItem.Flags, taskItem.Name, localID, remoteClient.Name);
- // TODO: These are pending addition of those fields to TaskInventoryItem
+ // TODO: These are pending addition of those fields to TaskInventoryItem
// taskItem.SalePrice = item.SalePrice;
// taskItem.SaleType = item.SaleType;
- taskItem.CreationDate = (uint)item.CreationDate;
-
- bool addFromAllowedDrop = agentID != part.OwnerID;
-
- part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
- part.ParentGroup.AggregatePerms();
- return true;
- }
+ taskItem.CreationDate = (uint)item.CreationDate;
+
+ bool addFromAllowedDrop;
+ if(withModRights)
+ addFromAllowedDrop = false;
else
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}",
- localID, Name, UUID, newItemId);
- }
+ addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0;
+
+ part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
+ part.ParentGroup.AggregatePerms();
+ return true;
- return false;
}
///
--
cgit v1.1
From 2fc7993d699bc763638664975bf6390aaf43cc94 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 26 Jan 2017 02:45:12 +0000
Subject: ubOde: update prim mass when changing Density
---
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index a2fbf41..45ef273 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -920,8 +920,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
set
{
+ float old = m_density;
m_density = value / 100f;
- // for not prim mass is not updated since this implies full rebuild of body inertia TODO
+ if(m_density != old)
+ UpdatePrimBodyData();
}
}
public override float GravModifier
--
cgit v1.1
From 32c1127809a27f6400d1585513a70900dac6de78 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 26 Jan 2017 18:35:53 +0000
Subject: Make it possible to override the URL module
---
.../CoreModules/Scripting/LSLHttp/UrlModule.cs | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index bb80a88..311deab 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -83,17 +83,17 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
- private Dictionary m_RequestMap =
+ protected Dictionary m_RequestMap =
new Dictionary();
- private Dictionary m_UrlMap =
+ protected Dictionary m_UrlMap =
new Dictionary();
- private uint m_HttpsPort = 0;
- private IHttpServer m_HttpServer = null;
- private IHttpServer m_HttpsServer = null;
+ protected uint m_HttpsPort = 0;
+ protected IHttpServer m_HttpServer = null;
+ protected IHttpServer m_HttpsServer = null;
- public string ExternalHostNameForLSL { get; private set; }
+ public string ExternalHostNameForLSL { get; protected set; }
///
/// The default maximum number of urls
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
public Type ReplaceableInterface
{
- get { return null; }
+ get { return typeof(IUrlModule); }
}
public string Name
@@ -453,7 +453,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
}
- private void RemoveUrl(UrlData data)
+ protected void RemoveUrl(UrlData data)
{
if (data.isSsl)
m_HttpsServer.RemoveHTTPHandler("", "/lslhttps/"+data.urlcode.ToString()+"/");
@@ -461,7 +461,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
m_HttpServer.RemoveHTTPHandler("", "/lslhttp/"+data.urlcode.ToString()+"/");
}
- private Hashtable NoEvents(UUID requestID, UUID sessionID)
+ protected Hashtable NoEvents(UUID requestID, UUID sessionID)
{
Hashtable response = new Hashtable();
UrlData url;
@@ -499,7 +499,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
return response;
}
- private bool HasEvents(UUID requestID, UUID sessionID)
+ protected bool HasEvents(UUID requestID, UUID sessionID)
{
UrlData url=null;
@@ -530,7 +530,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
}
}
}
- private Hashtable GetEvents(UUID requestID, UUID sessionID)
+ protected Hashtable GetEvents(UUID requestID, UUID sessionID)
{
UrlData url = null;
RequestData requestData = null;
@@ -735,7 +735,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
}
}
- private void OnScriptReset(uint localID, UUID itemID)
+ protected void OnScriptReset(uint localID, UUID itemID)
{
ScriptRemoved(itemID);
}
--
cgit v1.1
From ed365f6220afd4a3bb7d77ef44f6ecf673b46266 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 26 Jan 2017 19:43:00 +0000
Subject: remove SOP.AttachPoint, redundant( and incoerent) with
SOG.AttachmentPoint
---
.../Avatar/Attachments/AttachmentsModule.cs | 42 +++++++++-------------
.../InventoryAccess/InventoryAccessModule.cs | 14 +++-----
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 11 +++---
.../Shared/Api/Implementation/LSL_Api.cs | 2 --
4 files changed, 25 insertions(+), 44 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index a900a2a..cf188aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -481,14 +481,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
// group.Name, group.LocalId, sp.Name, attachmentPt, silent);
- if (sp.GetAttachments().Contains(group))
- {
-// m_log.WarnFormat(
-// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
-// group.Name, group.LocalId, sp.Name, AttachmentPt);
-
- return false;
- }
if (group.GetSittingAvatarsCount() != 0)
{
@@ -500,6 +492,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return false;
}
+ List attachments = sp.GetAttachments(attachmentPt);
+ if (attachments.Contains(group))
+ {
+// if (DebugLevel > 0)
+// m_log.WarnFormat(
+// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
+// group.Name, group.LocalId, sp.Name, attachmentPt);
+
+ return false;
+ }
+
Vector3 attachPos = group.AbsolutePosition;
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
@@ -533,7 +536,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint;
attachPos = group.RootPart.AttachedPos;
- group.HasGroupChanged = true;
}
// if we still didn't find a suitable attachment point.......
@@ -544,18 +546,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
attachPos = Vector3.Zero;
}
- List attachments = sp.GetAttachments(attachmentPt);
-
- if (attachments.Contains(group))
- {
- if (DebugLevel > 0)
- m_log.WarnFormat(
- "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached",
- group.Name, group.LocalId, sp.Name, attachmentPt);
-
- return false;
- }
-
// If we already have 5, remove the oldest until only 4 are left. Skip over temp ones
while (attachments.Count >= 5)
{
@@ -579,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
lock (sp.AttachmentsSyncLock)
{
group.AttachmentPoint = attachmentPt;
- group.AbsolutePosition = attachPos;
+ group.RootPart.AttachedPos = attachPos;
if (addToInventory && sp.PresenceType != PresenceType.Npc)
UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append);
@@ -956,7 +946,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
m_scene.DeleteFromStorage(so.UUID);
m_scene.EventManager.TriggerParcelPrimCountTainted();
- so.AttachedAvatar = sp.UUID;
foreach (SceneObjectPart part in so.Parts)
{
@@ -969,11 +958,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
}
- so.AbsolutePosition = attachOffset;
- so.RootPart.AttachedPos = attachOffset;
- so.IsAttachment = true;
so.RootPart.SetParentLocalId(sp.LocalId);
+ so.AttachedAvatar = sp.UUID;
so.AttachmentPoint = attachmentpoint;
+ so.RootPart.AttachedPos = attachOffset;
+ so.AbsolutePosition = attachOffset;
+ so.IsAttachment = true;
sp.AddAttachment(so);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index a73906c..67c847b 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -427,20 +427,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
originalRotations[objectGroup.UUID] = inventoryStoredRotation;
// Restore attachment data after trip through the sim
- if (objectGroup.RootPart.AttachPoint > 0)
+ if (objectGroup.AttachmentPoint > 0)
{
inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
- }
+ if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
+ objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
+ objectGroup.RootPart.Shape.LastAttachPoint = (byte)objectGroup.AttachmentPoint;
- // Trees could be attached and it's been done, but it makes
- // no sense. State must be preserved because it's the tree type
- if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
- objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
- {
- objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
- if (objectGroup.RootPart.AttachPoint > 0)
- objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint;
}
objectGroup.AbsolutePosition = inventoryStoredPosition;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0544696..bf0e31b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -244,11 +244,6 @@ namespace OpenSim.Region.Framework.Scenes
public uint TimeStampTerse;
- // The following two are to hold the attachment data
- // while an object is inworld
- [XmlIgnore]
- public byte AttachPoint = 0;
-
[XmlIgnore]
public Quaternion AttachRotation = Quaternion.Identity;
@@ -277,7 +272,11 @@ namespace OpenSim.Region.Framework.Scenes
public scriptEvents AggregateScriptEvents;
- public Vector3 AttachedPos;
+ public Vector3 AttachedPos
+ {
+ get;
+ set;
+ }
// rotation locks on local X,Y and or Z axis bit flags
// bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 226ad6c..3f2e321 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7972,7 +7972,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
return 0;
}
-
}
public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel)
@@ -15867,7 +15866,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
- group.RootPart.AttachPoint = group.RootPart.Shape.State;
group.RootPart.AttachedPos = group.AbsolutePosition;
group.ResetIDs();
--
cgit v1.1
From cdc23bab74d5ed5250850bd9c4fc027809ad3d3c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 26 Jan 2017 19:51:50 +0000
Subject: remove unused and wrong methods
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 57 ----------------------
2 files changed, 1 insertion(+), 58 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 8fc438d..49e98e7 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1569,7 +1569,7 @@ namespace OpenSim.Region.Framework.Scenes
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{
// Set the new attachment point data in the object
- byte attachmentPoint = group.GetAttachmentPoint();
+ byte attachmentPoint = (byte)group.AttachmentPoint;
group.UpdateGroupPosition(pos);
group.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 83c5db4..dff242e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1783,63 +1783,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- ///
- /// Attach this scene object to the given avatar.
- ///
- ///
- ///
- ///
- private void AttachToAgent(
- ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
- {
- if (avatar != null)
- {
- // don't attach attachments to child agents
- if (avatar.IsChildAgent) return;
-
- // Remove from database and parcel prim count
- m_scene.DeleteFromStorage(so.UUID);
- m_scene.EventManager.TriggerParcelPrimCountTainted();
-
- so.AttachedAvatar = avatar.UUID;
-
- if (so.RootPart.PhysActor != null)
- {
- m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
- so.RootPart.PhysActor = null;
- }
-
- so.AbsolutePosition = attachOffset;
- so.RootPart.AttachedPos = attachOffset;
- so.IsAttachment = true;
- so.RootPart.SetParentLocalId(avatar.LocalId);
- so.AttachmentPoint = attachmentpoint;
-
- avatar.AddAttachment(this);
-
- if (!silent)
- {
- // Killing it here will cause the client to deselect it
- // It then reappears on the avatar, deselected
- // through the full update below
- //
- if (IsSelected)
- {
- m_scene.SendKillObject(new List { m_rootPart.LocalId });
- }
-
- IsSelected = false; // fudge....
- ScheduleGroupForFullUpdate();
- }
- }
- else
- {
- m_log.WarnFormat(
- "[SOG]: Tried to add attachment {0} to avatar with UUID {1} in region {2} but the avatar is not present",
- UUID, avatar.ControllingClient.AgentId, Scene.RegionInfo.RegionName);
- }
- }
-
public byte GetAttachmentPoint()
{
return m_rootPart.Shape.State;
--
cgit v1.1
From 56e3aaefde72bc8819dfb34b423f4ada65f1a195 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 12:32:01 +0000
Subject: Permissions modules where made NONShared modules. Make them so,
removing incoerences and their potencial bugs
---
.../World/Objects/BuySell/BuySellModule.cs | 2 +-
.../World/Permissions/PermissionsModule.cs | 152 +++++++++++++++------
.../Region/Framework/Scenes/Scene.Permissions.cs | 120 ++++++++--------
.../PrimLimitsModule/PrimLimitsModule.cs | 40 +++---
4 files changed, 193 insertions(+), 121 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 504a584..142c8b7 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
if (part.OwnerID == part.GroupID) // Group owned
{
// Does the user have the power to put the object on sale?
- if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID, m_scene))
+ if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID))
{
client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
return;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index bbebce1..a369c30 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -349,7 +349,77 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (!m_Enabled)
return;
+ if(scene != m_scene)
+ return;
+
m_scene.UnregisterModuleInterface(this);
+
+ scenePermissions.OnBypassPermissions -= BypassPermissions;
+ scenePermissions.OnSetBypassPermissions -= SetBypassPermissions;
+ scenePermissions.OnPropagatePermissions -= PropagatePermissions;
+
+ scenePermissions.OnIsGridGod -= IsGridAdministrator;
+ scenePermissions.OnIsAdministrator -= IsAdministrator;
+ scenePermissions.OnIsEstateManager -= IsEstateManager;
+
+ scenePermissions.OnGenerateClientFlags -= GenerateClientFlags;
+
+ scenePermissions.OnIssueEstateCommand -= CanIssueEstateCommand;
+ scenePermissions.OnRunConsoleCommand -= CanRunConsoleCommand;
+
+ scenePermissions.OnTeleport -= CanTeleport;
+
+ scenePermissions.OnInstantMessage -= CanInstantMessage;
+
+ scenePermissions.OnAbandonParcel -= CanAbandonParcel;
+ scenePermissions.OnReclaimParcel -= CanReclaimParcel;
+ scenePermissions.OnDeedParcel -= CanDeedParcel;
+ scenePermissions.OnSellParcel -= CanSellParcel;
+ scenePermissions.OnEditParcelProperties -= CanEditParcelProperties;
+ scenePermissions.OnTerraformLand -= CanTerraformLand;
+ scenePermissions.OnBuyLand -= CanBuyLand;
+
+ scenePermissions.OnRezObject -= CanRezObject;
+ scenePermissions.OnObjectEntry -= CanObjectEntry;
+ scenePermissions.OnReturnObjects -= CanReturnObjects;
+
+ scenePermissions.OnDuplicateObject -= CanDuplicateObject;
+ scenePermissions.OnDeleteObjectByIDs -= CanDeleteObjectByIDs;
+ scenePermissions.OnDeleteObject -= CanDeleteObject;
+ scenePermissions.OnEditObjectByIDs -= CanEditObjectByIDs;
+ scenePermissions.OnEditObject -= CanEditObject;
+ scenePermissions.OnInventoryTransfer -= CanInventoryTransfer;
+ scenePermissions.OnMoveObject -= CanMoveObject;
+ scenePermissions.OnTakeObject -= CanTakeObject;
+ scenePermissions.OnTakeCopyObject -= CanTakeCopyObject;
+ scenePermissions.OnLinkObject -= CanLinkObject;
+ scenePermissions.OnDelinkObject -= CanDelinkObject;
+ scenePermissions.OnDeedObject -= CanDeedObject;
+ scenePermissions.OnSellGroupObject -= CanSellGroupObject;
+
+ scenePermissions.OnCreateObjectInventory -= CanCreateObjectInventory;
+ scenePermissions.OnEditObjectInventory -= CanEditObjectInventory;
+ scenePermissions.OnCopyObjectInventory -= CanCopyObjectInventory;
+ scenePermissions.OnDeleteObjectInventory -= CanDeleteObjectInventory;
+ scenePermissions.OnDoObjectInvToObjectInv -= CanDoObjectInvToObjectInv;
+ scenePermissions.OnDropInObjectInv -= CanDropInObjectInv;
+
+ scenePermissions.OnViewNotecard -= CanViewNotecard;
+ scenePermissions.OnViewScript -= CanViewScript;
+ scenePermissions.OnEditNotecard -= CanEditNotecard;
+ scenePermissions.OnEditScript -= CanEditScript;
+ scenePermissions.OnResetScript -= CanResetScript;
+ scenePermissions.OnRunScript -= CanRunScript;
+ scenePermissions.OnCompileScript -= CanCompileScript;
+
+ scenePermissions.OnCreateUserInventory -= CanCreateUserInventory;
+ scenePermissions.OnCopyUserInventory -= CanCopyUserInventory;
+ scenePermissions.OnEditUserInventory -= CanEditUserInventory;
+ scenePermissions.OnDeleteUserInventory -= CanDeleteUserInventory;
+
+ scenePermissions.OnControlPrimMedia -= CanControlPrimMedia;
+ scenePermissions.OnInteractWithPrimMedia -= CanInteractWithPrimMedia;
+
}
public void Close()
@@ -1099,7 +1169,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#endregion
#region Permission Checks
- private bool CanAbandonParcel(UUID user, ILandObject parcel, Scene scene)
+ private bool CanAbandonParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1107,7 +1177,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandRelease, false);
}
- private bool CanReclaimParcel(UUID user, ILandObject parcel, Scene scene)
+ private bool CanReclaimParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1115,7 +1185,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, 0,true);
}
- private bool CanDeedParcel(UUID user, ILandObject parcel, Scene scene)
+ private bool CanDeedParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1129,7 +1199,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (parcel.LandData.OwnerID != user) // Only the owner can deed!
return false;
- ScenePresence sp = scene.GetScenePresence(user);
+ ScenePresence sp = m_scene.GetScenePresence(user);
if(sp == null)
return false;
@@ -1179,7 +1249,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
+ private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1195,7 +1265,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
//If they can rez, they can duplicate
- return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene);
+ return CanRezObject(0, sp.UUID, sog.AbsolutePosition);
}
private bool CanDeleteObject(SceneObjectGroup sog, ScenePresence sp)
@@ -1240,14 +1310,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
- private bool CanDeleteObjectByIDs(UUID objectID, UUID userID, Scene scene)
+ private bool CanDeleteObjectByIDs(UUID objectID, UUID userID)
{
// ignoring locked. viewers should warn and ask for confirmation
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
if (sog == null)
return false;
@@ -1282,12 +1352,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
- private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
+ private bool CanEditObjectByIDs(UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
if (sog == null)
return false;
@@ -1311,12 +1381,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene)
+ private bool CanEditObjectInventory(UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- SceneObjectGroup sog = scene.GetGroupByPrim(objectID);
+ SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
if (sog == null)
return false;
@@ -1326,7 +1396,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanEditParcelProperties(UUID userID, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager)
+ private bool CanEditParcelProperties(UUID userID, ILandObject parcel, GroupPowers p, bool allowManager)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1342,7 +1412,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanEditScript(UUID script, UUID objectID, UUID userID, Scene scene)
+ private bool CanEditScript(UUID script, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1353,7 +1423,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Ordinarily, if you can view it, you can edit it
// There is no viewing a no mod script
//
- return CanViewScript(script, objectID, userID, scene);
+ return CanViewScript(script, objectID, userID);
}
///
@@ -1364,7 +1434,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
+ private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1395,7 +1465,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
+ SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return false;
@@ -1442,21 +1512,21 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanInstantMessage(UUID user, UUID target, Scene startScene)
+ private bool CanInstantMessage(UUID user, UUID target)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
// If the sender is an object, check owner instead
//
- SceneObjectPart part = startScene.GetSceneObjectPart(user);
+ SceneObjectPart part = m_scene.GetSceneObjectPart(user);
if (part != null)
user = part.OwnerID;
return GenericCommunicationPermission(user, target);
}
- private bool CanInventoryTransfer(UUID user, UUID target, Scene startScene)
+ private bool CanInventoryTransfer(UUID user, UUID target)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1464,7 +1534,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericCommunicationPermission(user, target);
}
- private bool CanIssueEstateCommand(UUID user, Scene requestFromScene, bool ownerCommand)
+ private bool CanIssueEstateCommand(UUID user, bool ownerCommand)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1498,7 +1568,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene)
+ private bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1506,8 +1576,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
float newY = newPoint.Y;
// allow outside region this is needed for crossings
- if (newX < -1f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
- newY < -1f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
+ if (newX < -1f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
+ newY < -1f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
if(sog == null || sog.IsDeleted)
@@ -1516,7 +1586,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_bypassPermissions)
return m_bypassPermissionsValue;
- ILandObject parcel = scene.LandChannel.GetLandObject(newX, newY);
+ ILandObject parcel = m_scene.LandChannel.GetLandObject(newX, newY);
if (parcel == null)
return false;
@@ -1554,12 +1624,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
- private bool CanReturnObjects(ILandObject land, UUID user, List objects, Scene scene)
+ private bool CanReturnObjects(ILandObject land, UUID user, List objects)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- ScenePresence sp = scene.GetScenePresence(user);
+ ScenePresence sp = m_scene.GetScenePresence(user);
if (sp == null)
return false;
@@ -1591,7 +1661,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
else
{
Vector3 pos = g.AbsolutePosition;
- l = scene.LandChannel.GetLandObject(pos.X, pos.Y);
+ l = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
}
// If it's not over any land, then we can't do a thing
@@ -1662,7 +1732,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanRezObject(int objectCount, UUID userID, Vector3 objectPosition, Scene scene)
+ private bool CanRezObject(int objectCount, UUID userID, Vector3 objectPosition)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions)
@@ -1670,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
- ILandObject parcel = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
+ ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
if (parcel == null || parcel.LandData == null)
return false;
@@ -1696,7 +1766,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
- private bool CanRunConsoleCommand(UUID user, Scene requestFromScene)
+ private bool CanRunConsoleCommand(UUID user)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1741,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericEstatePermission(part.OwnerID);
}
- private bool CanSellParcel(UUID user, ILandObject parcel, Scene scene)
+ private bool CanSellParcel(UUID user, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1749,7 +1819,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale, true);
}
- private bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
+ private bool CanSellGroupObject(UUID userID, UUID groupID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1823,7 +1893,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanTerraformLand(UUID userID, Vector3 position, Scene requestFromScene)
+ private bool CanTerraformLand(UUID userID, Vector3 position)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1873,7 +1943,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanViewScript(UUID script, UUID objectID, UUID userID, Scene scene)
+ private bool CanViewScript(UUID script, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1915,7 +1985,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
+ SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return false;
@@ -1962,7 +2032,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
///
///
///
- private bool CanViewNotecard(UUID notecard, UUID objectID, UUID userID, Scene scene)
+ private bool CanViewNotecard(UUID notecard, UUID objectID, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1988,7 +2058,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
}
else // Prim inventory
{
- SceneObjectPart part = scene.GetSceneObjectPart(objectID);
+ SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
if (part == null)
return false;
@@ -2051,7 +2121,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene)
+ private bool CanBuyLand(UUID userID, ILandObject parcel)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -2319,7 +2389,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanResetScript(UUID primID, UUID script, UUID agentID, Scene scene)
+ private bool CanResetScript(UUID primID, UUID script, UUID agentID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -2334,7 +2404,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true;
}
- private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
+ private bool CanCompileScript(UUID ownerUUID, int scriptType)
{
//m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
switch (scriptType) {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 4630497..45d710a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -41,47 +41,47 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void SetBypassPermissionsHandler(bool value);
public delegate bool BypassPermissionsHandler();
public delegate bool PropagatePermissionsHandler();
- public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
- public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter, Scene scene);
+ public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition);
+ public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter);
public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
+ public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
+ public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp, Scene scenen);
- public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene);
+ public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
+ public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
+ public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
- public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene);
- public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List objects, Scene scene);
- public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene);
- public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene);
- public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
- public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
- public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user, Scene scene);
+ public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
+ public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List objects);
+ public delegate bool InstantMessageHandler(UUID user, UUID target);
+ public delegate bool InventoryTransferHandler(UUID user, UUID target);
+ public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
+ public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user);
+ public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user);
+ public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user);
+ public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user);
public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
- public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
- public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
- public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
- public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
- public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
- public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene);
- public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
+ public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType);
+ public delegate bool StartScriptHandler(UUID script, UUID user);
+ public delegate bool StopScriptHandler(UUID script, UUID user);
+ public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user);
+ public delegate bool TerraformLandHandler(UUID user, Vector3 position);
+ public delegate bool RunConsoleCommandHandler(UUID user);
+ public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand);
public delegate bool IsGodHandler(UUID user);
public delegate bool IsGridGodHandler(UUID user);
public delegate bool IsAdministratorHandler(UUID user);
public delegate bool IsEstateManagerHandler(UUID user);
- public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager);
- public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
- public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
+ public delegate bool EditParcelHandler(UUID user, ILandObject parcel);
+ public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager);
+ public delegate bool SellParcelHandler(UUID user, ILandObject parcel);
+ public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel);
+ public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel);
+ public delegate bool DeedParcelHandler(UUID user, ILandObject parcel);
public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
- public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
+ public delegate bool BuyLandHandler(UUID user, ILandObject parcel);
public delegate bool LinkObjectHandler(UUID user, UUID objectID);
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
@@ -254,7 +254,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (RezObjectHandler h in list)
{
- if (h(objectCount, owner,objectPosition, m_scene) == false)
+ if (h(objectCount, owner,objectPosition) == false)
return false;
}
}
@@ -274,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (DeleteObjectHandlerByIDs h in list)
{
- if (h(objectID, deleter, m_scene) == false)
+ if (h(objectID, deleter) == false)
{
result = false;
break;
@@ -321,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (TransferObjectHandler h in list)
{
- if (h(objectID, recipient, m_scene) == false)
+ if (h(objectID, recipient) == false)
{
result = false;
break;
@@ -366,7 +366,7 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region SELL GROUP OBJECT
- public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
+ public bool CanSellGroupObject(UUID userID, UUID groupID)
{
bool result = true;
@@ -376,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (SellGroupObjectHandler h in list)
{
- if (h(userID, groupID, scene) == false)
+ if (h(userID, groupID) == false)
{
result = false;
break;
@@ -438,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (DuplicateObjectHandler h in list)
{
- if (h(sog, sp, m_scene) == false)
+ if (h(sog, sp) == false)
return false;
}
}
@@ -470,7 +470,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditObjectByIDsHandler h in list)
{
- if (h(objectID, editorID, m_scene) == false)
+ if (h(objectID, editorID) == false)
return false;
}
}
@@ -505,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditObjectInventoryHandler h in list)
{
- if (h(objectID, editorID, m_scene) == false)
+ if (h(objectID, editorID) == false)
return false;
}
}
@@ -546,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ObjectEntryHandler h in list)
{
- if (h(sog, enteringRegion, newPoint, m_scene) == false)
+ if (h(sog, enteringRegion, newPoint) == false)
return false;
}
}
@@ -566,7 +566,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ReturnObjectsHandler h in list)
{
- if (h(land, user, objects, m_scene) == false)
+ if (h(land, user, objects) == false)
{
result = false;
break;
@@ -592,7 +592,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (InstantMessageHandler h in list)
{
- if (h(user, target, m_scene) == false)
+ if (h(user, target) == false)
return false;
}
}
@@ -610,7 +610,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (InventoryTransferHandler h in list)
{
- if (h(user, target, m_scene) == false)
+ if (h(user, target) == false)
return false;
}
}
@@ -628,7 +628,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ViewScriptHandler h in list)
{
- if (h(script, objectID, user, m_scene) == false)
+ if (h(script, objectID, user) == false)
return false;
}
}
@@ -643,7 +643,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ViewNotecardHandler h in list)
{
- if (h(script, objectID, user, m_scene) == false)
+ if (h(script, objectID, user) == false)
return false;
}
}
@@ -661,7 +661,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditScriptHandler h in list)
{
- if (h(script, objectID, user, m_scene) == false)
+ if (h(script, objectID, user) == false)
return false;
}
}
@@ -676,7 +676,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditNotecardHandler h in list)
{
- if (h(script, objectID, user, m_scene) == false)
+ if (h(script, objectID, user) == false)
return false;
}
}
@@ -694,7 +694,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (RunScriptHandlerByIDs h in list)
{
- if (h(script, objectID, user, m_scene) == false)
+ if (h(script, objectID, user) == false)
return false;
}
}
@@ -730,7 +730,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (CompileScriptHandler h in list)
{
- if (h(ownerUUID, scriptType, m_scene) == false)
+ if (h(ownerUUID, scriptType) == false)
return false;
}
}
@@ -748,7 +748,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (StartScriptHandler h in list)
{
- if (h(script, user, m_scene) == false)
+ if (h(script, user) == false)
return false;
}
}
@@ -766,7 +766,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (StopScriptHandler h in list)
{
- if (h(script, user, m_scene) == false)
+ if (h(script, user) == false)
return false;
}
}
@@ -784,7 +784,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ResetScriptHandler h in list)
{
- if (h(prim, script, user, m_scene) == false)
+ if (h(prim, script, user) == false)
return false;
}
}
@@ -802,7 +802,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (TerraformLandHandler h in list)
{
- if (h(user, pos, m_scene) == false)
+ if (h(user, pos) == false)
return false;
}
}
@@ -820,7 +820,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (RunConsoleCommandHandler h in list)
{
- if (h(user, m_scene) == false)
+ if (h(user) == false)
return false;
}
}
@@ -838,7 +838,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (IssueEstateCommandHandler h in list)
{
- if (h(user, m_scene, ownerCommand) == false)
+ if (h(user, ownerCommand) == false)
return false;
}
}
@@ -918,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (EditParcelPropertiesHandler h in list)
{
- if (h(user, parcel, p, m_scene, allowManager) == false)
+ if (h(user, parcel, p, allowManager) == false)
return false;
}
}
@@ -935,7 +935,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (SellParcelHandler h in list)
{
- if (h(user, parcel, m_scene) == false)
+ if (h(user, parcel) == false)
return false;
}
}
@@ -952,7 +952,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (AbandonParcelHandler h in list)
{
- if (h(user, parcel, m_scene) == false)
+ if (h(user, parcel) == false)
return false;
}
}
@@ -968,7 +968,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (ReclaimParcelHandler h in list)
{
- if (h(user, parcel, m_scene) == false)
+ if (h(user, parcel) == false)
return false;
}
}
@@ -983,7 +983,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (DeedParcelHandler h in list)
{
- if (h(user, parcel, m_scene) == false)
+ if (h(user, parcel) == false)
return false;
}
}
@@ -1018,7 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes
Delegate[] list = handler.GetInvocationList();
foreach (BuyLandHandler h in list)
{
- if (h(user, parcel, m_scene) == false)
+ if (h(user, parcel) == false)
return false;
}
}
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 635df96..6f2eedc 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.OptionalModules
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_enabled;
+ private Scene m_scene;
public string Name { get { return "PrimLimitsModule"; } }
public Type ReplaceableInterface { get { return null; } }
@@ -80,6 +81,7 @@ namespace OpenSim.Region.OptionalModules
{
return;
}
+ m_scene = scene;
scene.Permissions.OnRezObject += CanRezObject;
scene.Permissions.OnObjectEntry += CanObjectEnter;
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
@@ -94,9 +96,9 @@ namespace OpenSim.Region.OptionalModules
return;
}
- scene.Permissions.OnRezObject -= CanRezObject;
- scene.Permissions.OnObjectEntry -= CanObjectEnter;
- scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
+ m_scene.Permissions.OnRezObject -= CanRezObject;
+ m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
+ m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
}
public void RegionLoaded(Scene scene)
@@ -104,12 +106,12 @@ namespace OpenSim.Region.OptionalModules
m_dialogModule = scene.RequestModuleInterface();
}
- private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene)
+ private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition)
{
- ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
+ ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
- string response = DoCommonChecks(objectCount, ownerID, lo, scene);
+ string response = DoCommonChecks(objectCount, ownerID, lo);
if (response != null)
{
@@ -120,12 +122,12 @@ namespace OpenSim.Region.OptionalModules
}
//OnDuplicateObject
- private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene)
+ private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp)
{
Vector3 objectPosition = sog.AbsolutePosition;
- ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
+ ILandObject lo = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
- string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo, scene);
+ string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo);
if (response != null)
{
@@ -135,18 +137,18 @@ namespace OpenSim.Region.OptionalModules
return true;
}
- private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint, Scene scene)
+ private bool CanObjectEnter(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
{
float newX = newPoint.X;
float newY = newPoint.Y;
- if (newX < -1.0f || newX > (scene.RegionInfo.RegionSizeX + 1.0f) ||
- newY < -1.0f || newY > (scene.RegionInfo.RegionSizeY + 1.0f) )
+ if (newX < -1.0f || newX > (m_scene.RegionInfo.RegionSizeX + 1.0f) ||
+ newY < -1.0f || newY > (m_scene.RegionInfo.RegionSizeY + 1.0f) )
return true;
if (sog == null)
return false;
- ILandObject newParcel = scene.LandChannel.GetLandObject(newX, newY);
+ ILandObject newParcel = m_scene.LandChannel.GetLandObject(newX, newY);
if (newParcel == null)
return true;
@@ -154,7 +156,7 @@ namespace OpenSim.Region.OptionalModules
if(!enteringRegion)
{
Vector3 oldPoint = sog.AbsolutePosition;
- ILandObject oldParcel = scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
+ ILandObject oldParcel = m_scene.LandChannel.GetLandObject(oldPoint.X, oldPoint.Y);
if(oldParcel != null && oldParcel.Equals(newParcel))
return true;
}
@@ -163,7 +165,7 @@ namespace OpenSim.Region.OptionalModules
// TODO: Add Special Case here for temporary prims
- string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel, scene);
+ string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
if (response != null)
{
@@ -174,25 +176,25 @@ namespace OpenSim.Region.OptionalModules
return true;
}
- private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo, Scene scene)
+ private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo)
{
string response = null;
int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{
- response = "Unable to rez object because the region is too full";
+ response = "Unable to rez object because the parcel is full";
}
else
{
- int maxPrimsPerUser = scene.RegionInfo.MaxPrimsPerUser;
+ int maxPrimsPerUser = m_scene.RegionInfo.MaxPrimsPerUser;
if (maxPrimsPerUser >= 0)
{
// per-user prim limit is set
if (ownerID != lo.LandData.OwnerID || lo.LandData.IsGroupOwned)
{
// caller is not the sole Parcel owner
- EstateSettings estateSettings = scene.RegionInfo.EstateSettings;
+ EstateSettings estateSettings = m_scene.RegionInfo.EstateSettings;
if (ownerID != estateSettings.EstateOwner)
{
// caller is NOT the Estate owner
--
cgit v1.1
From 4b9c94a3aa57faa2c18c1e9a4570f9e10ef3f84a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 13:10:57 +0000
Subject: bug fix: wrong enabled check
---
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 3 ---
.../Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | 7 ++-----
2 files changed, 2 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index a369c30..c00112b 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -349,9 +349,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (!m_Enabled)
return;
- if(scene != m_scene)
- return;
-
m_scene.UnregisterModuleInterface(this);
scenePermissions.OnBypassPermissions -= BypassPermissions;
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index 6f2eedc..af32d05 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -78,9 +78,8 @@ namespace OpenSim.Region.OptionalModules
public void AddRegion(Scene scene)
{
if (!m_enabled)
- {
return;
- }
+
m_scene = scene;
scene.Permissions.OnRezObject += CanRezObject;
scene.Permissions.OnObjectEntry += CanObjectEnter;
@@ -91,10 +90,8 @@ namespace OpenSim.Region.OptionalModules
public void RemoveRegion(Scene scene)
{
- if (m_enabled)
- {
+ if (!m_enabled)
return;
- }
m_scene.Permissions.OnRezObject -= CanRezObject;
m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
--
cgit v1.1
From f76ea3bb767e2af69d6764adb8223c62582cad12 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 20:07:02 +0000
Subject: parcels must be loaded before objects, so they can be added to them
---
OpenSim/Region/Application/OpenSimBase.cs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index b33e2c2..8a0536a 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -459,15 +459,14 @@ namespace OpenSim
while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
SetUpEstateOwner(scene);
+ scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
+
// Prims have to be loaded after module configuration since some modules may be invoked during the load
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
// TODO : Try setting resource for region xstats here on scene
MainServer.Instance.AddStreamHandler(new RegionStatsHandler(regionInfo));
- scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
- scene.EventManager.TriggerParcelPrimCountUpdate();
-
if (scene.SnmpService != null)
{
scene.SnmpService.BootInfo("Grid Registration in progress", scene);
--
cgit v1.1
From 0091c37ed3fd3f9ed4edf079a61f986daadca16b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 20:21:24 +0000
Subject: several changes relative to objects return and parcel prim counts:
avoid null refs, report correct count of returned objects, make obkects
counts by ownership coerent with return rules, etc
---
.../CoreModules/World/Land/LandManagementModule.cs | 15 ++++++----
.../Region/CoreModules/World/Land/LandObject.cs | 8 +++--
.../CoreModules/World/Land/PrimCountModule.cs | 35 ++++++----------------
.../World/Permissions/PermissionsModule.cs | 32 ++++++++++----------
.../World/Vegetation/VegetationModule.cs | 3 +-
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 21 ++++++++-----
.../Framework/Scenes/Scene.PacketHandlers.cs | 5 +++-
.../Region/Framework/Scenes/Scene.Permissions.cs | 13 ++++++--
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +--
.../Region/Framework/Scenes/SceneObjectGroup.cs | 4 +--
.../World/TreePopulator/TreePopulatorModule.cs | 2 +-
11 files changed, 74 insertions(+), 68 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 66be5e5..dfa7095 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -149,9 +149,11 @@ namespace OpenSim.Region.CoreModules.World.Land
parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
+ m_scene.EventManager.OnObjectAddedToScene += EventManagerOnParcelPrimCountAdd;
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
- m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
+
m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
+ m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
@@ -815,6 +817,9 @@ namespace OpenSim.Region.CoreModules.World.Land
throw new Exception("Error: Parcel not found at point " + x + ", " + y);
}
+ if(m_landList.Count == 0 || m_landIDList == null)
+ return null;
+
lock (m_landIDList)
{
try
@@ -826,8 +831,6 @@ namespace OpenSim.Region.CoreModules.World.Land
return null;
}
}
-
- return m_landList[m_landIDList[x / 4, y / 4]];
}
// Create a 'parcel is here' bitmap for the parcel identified by the passed landID
@@ -1642,9 +1645,9 @@ namespace OpenSim.Region.CoreModules.World.Land
foreach (HashSet objs in returns.Values)
{
List objs2 = new List(objs);
- if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2))
+ if (m_scene.Permissions.CanReturnObjects(null, remoteClient, objs2))
{
- m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId);
+ m_scene.returnObjects(objs2.ToArray(), remoteClient);
}
else
{
@@ -2037,7 +2040,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
SceneObjectGroup[] objs = new SceneObjectGroup[1];
objs[0] = obj;
- ((Scene)client.Scene).returnObjects(objs, client.AgentId);
+ ((Scene)client.Scene).returnObjects(objs, client);
}
Dictionary Timers = new Dictionary();
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 8c0edc8..9d84e66 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1664,7 +1664,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
SceneObjectGroup[] objs = new SceneObjectGroup[1];
objs[0] = obj;
- m_scene.returnObjects(objs, obj.OwnerID);
+ m_scene.returnObjects(objs, null);
}
public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
@@ -1695,6 +1695,8 @@ namespace OpenSim.Region.CoreModules.World.Land
{
if (obj.GroupID == LandData.GroupID)
{
+ if (obj.OwnerID == LandData.OwnerID)
+ continue;
if (!returns.ContainsKey(obj.OwnerID))
returns[obj.OwnerID] =
new List();
@@ -1736,8 +1738,8 @@ namespace OpenSim.Region.CoreModules.World.Land
foreach (List ol in returns.Values)
{
- if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol))
- m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
+ if (m_scene.Permissions.CanReturnObjects(this, remote_client, ol))
+ m_scene.returnObjects(ol.ToArray(), remote_client);
}
}
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 857f919..2a720db 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -92,10 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land
m_Scene.RegisterModuleInterface(this);
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
- m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
- OnObjectBeingRemovedFromScene;
- m_Scene.EventManager.OnParcelPrimCountTainted +=
- OnParcelPrimCountTainted;
+ m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene;
+ m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted;
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
}
@@ -215,29 +213,15 @@ namespace OpenSim.Region.CoreModules.World.Land
else
parcelCounts.Users[obj.OwnerID] = partCount;
- if (obj.IsSelected)
- {
+ if (obj.IsSelected || obj.GetSittingAvatarsCount() > 0)
parcelCounts.Selected += partCount;
- }
+
+ if (obj.OwnerID == landData.OwnerID)
+ parcelCounts.Owner += partCount;
+ else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
+ parcelCounts.Group += partCount;
else
- {
- if (landData.IsGroupOwned)
- {
- if (obj.OwnerID == landData.GroupID)
- parcelCounts.Owner += partCount;
- else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
- parcelCounts.Group += partCount;
- else
- parcelCounts.Others += partCount;
- }
- else
- {
- if (obj.OwnerID == landData.OwnerID)
- parcelCounts.Owner += partCount;
- else
- parcelCounts.Others += partCount;
- }
- }
+ parcelCounts.Others += partCount;
}
}
@@ -393,7 +377,6 @@ namespace OpenSim.Region.CoreModules.World.Land
count = counts.Owner;
count += counts.Group;
count += counts.Others;
- count += counts.Selected;
}
}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index c00112b..279b966 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -282,9 +282,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnTerraformLand += CanTerraformLand;
scenePermissions.OnBuyLand += CanBuyLand;
+ scenePermissions.OnReturnObjects += CanReturnObjects;
+
scenePermissions.OnRezObject += CanRezObject;
scenePermissions.OnObjectEntry += CanObjectEntry;
- scenePermissions.OnReturnObjects += CanReturnObjects;
scenePermissions.OnDuplicateObject += CanDuplicateObject;
scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
@@ -1621,19 +1622,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
- private bool CanReturnObjects(ILandObject land, UUID user, List objects)
+ private bool CanReturnObjects(ILandObject land, ScenePresence sp, List objects)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
- ScenePresence sp = m_scene.GetScenePresence(user);
- if (sp == null)
- return false;
+ if(sp == null)
+ return true; // assuming that in this case rights are as owner
- bool isPrivUser = sp.IsGod || IsEstateManager(user);
+ UUID userID = sp.UUID;
+ bool isPrivUser = sp.IsGod || IsEstateManager(userID);
IClientAPI client = sp.ControllingClient;
- GroupPowers powers;
+
+ ulong powers = 0;
ILandObject l;
foreach (SceneObjectGroup g in new List(objects))
@@ -1644,7 +1646,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
continue;
}
- if (isPrivUser || g.OwnerID == user)
+ if (isPrivUser || g.OwnerID == userID)
continue;
// This is a short cut for efficiency. If land is non-null,
@@ -1671,7 +1673,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
LandData ldata = l.LandData;
// If we own the land outright, then allow
//
- if (ldata.OwnerID == user)
+ if (ldata.OwnerID == userID)
continue;
// Group voodoo
@@ -1679,19 +1681,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (ldata.IsGroupOwned)
{
UUID lGroupID = ldata.GroupID;
- powers = (GroupPowers)client.GetGroupPowers(lGroupID);
// Not a group member, or no rights at all
//
- if (powers == (GroupPowers)0)
+ powers = client.GetGroupPowers(lGroupID);
+ if(powers == 0)
{
objects.Remove(g);
continue;
}
-
+
// Group deeded object?
//
if (g.OwnerID == lGroupID &&
- (powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0)
+ (powers & (ulong)GroupPowers.ReturnGroupOwned) == 0)
{
objects.Remove(g);
continue;
@@ -1700,13 +1702,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// Group set object?
//
if (g.GroupID == lGroupID &&
- (powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0)
+ (powers & (ulong)GroupPowers.ReturnGroupSet) == 0)
{
objects.Remove(g);
continue;
}
- if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0)
+ if ((powers & (ulong)GroupPowers.ReturnNonGroup) == 0)
{
objects.Remove(g);
continue;
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index 04b6f00..167f6b5 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -105,8 +105,9 @@ namespace OpenSim.Region.CoreModules.World.Vegetation
if (rootPart.Shape.PCode != (byte)PCode.Grass)
AdaptTree(ref shape);
- m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
+ m_scene.AddNewSceneObject(sceneObject, true);
+ sceneObject.AggregatePerms();
return sceneObject;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index dbc7def..2f016fa 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2085,7 +2085,7 @@ namespace OpenSim.Region.Framework.Scenes
/// DeRezAction
/// User folder ID to place derezzed object
public virtual void DeRezObjects(
- IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID)
+ IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true)
{
// First, see of we can perform the requested action and
// build a list of eligible objects
@@ -2094,7 +2094,11 @@ namespace OpenSim.Region.Framework.Scenes
List takeGroups = new List();
List takeDeleteGroups = new List();
- ScenePresence sp = remoteClient.SceneAgent as ScenePresence;
+ ScenePresence sp = null;
+ if(remoteClient != null)
+ sp = remoteClient.SceneAgent as ScenePresence;
+ else if(action != DeRezAction.Return)
+ return; // only Return can be called without a client
// Start with true for both, then remove the flags if objects
// that we can't derez are part of the selection
@@ -2201,13 +2205,14 @@ namespace OpenSim.Region.Framework.Scenes
{
if (Permissions.CanReturnObjects(
null,
- remoteClient.AgentId,
+ remoteClient,
new List() {grp}))
{
permissionToTake = true;
permissionToDelete = true;
-
- AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
+ if(AddToReturns)
+ AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition,
+ "parcel owner return");
}
}
else // Auto return passes through here with null agent
@@ -2641,7 +2646,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
- UUID AgentId)
+ IClientAPI client)
{
List localIDs = new List();
@@ -2651,8 +2656,8 @@ namespace OpenSim.Region.Framework.Scenes
"parcel owner return");
localIDs.Add(grp.RootPart.LocalId);
}
- DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return,
- UUID.Zero);
+ DeRezObjects(client, localIDs, UUID.Zero, DeRezAction.Return,
+ UUID.Zero, false);
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 940f80c..4fef9c3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -185,8 +185,10 @@ namespace OpenSim.Region.Framework.Scenes
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
{
+ bool oldsel = part.IsSelected;
part.IsSelected = true;
- EventManager.TriggerParcelPrimCountTainted();
+ if(!oldsel)
+ EventManager.TriggerParcelPrimCountTainted();
}
part.SendPropertiesToClient(remoteClient);
@@ -228,6 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
if (so.OwnerID == remoteClient.AgentId)
{
so.SetGroup(groupID, remoteClient);
+ EventManager.TriggerParcelPrimCountTainted();
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 45d710a..6d3b82f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
- public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List objects);
+ public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List objects);
public delegate bool InstantMessageHandler(UUID user, UUID target);
public delegate bool InventoryTransferHandler(UUID user, UUID target);
public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
@@ -556,17 +556,24 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region RETURN OBJECT
- public bool CanReturnObjects(ILandObject land, UUID user, List objects)
+ public bool CanReturnObjects(ILandObject land, IClientAPI client, List objects)
{
bool result = true;
ReturnObjectsHandler handler = OnReturnObjects;
if (handler != null)
{
+ if(objects == null)
+ return false;
+
+ ScenePresence sp = null;
+ if(client != null && client.SceneAgent != null)
+ sp = client.SceneAgent as ScenePresence;
+
Delegate[] list = handler.GetInvocationList();
foreach (ReturnObjectsHandler h in list)
{
- if (h(land, user, objects) == false)
+ if (h(land, sp, objects) == false)
{
result = false;
break;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4fca4ed..5f99b73 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2604,8 +2604,8 @@ namespace OpenSim.Region.Framework.Scenes
{
// Otherwise, use this default creation code;
sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
- AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
+ AddNewSceneObject(sceneObject, true);
if (AgentPreferencesService != null) // This will override the brave new full perm world!
{
@@ -2784,7 +2784,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if (toReturn.Count > 0)
{
- returnObjects(toReturn.ToArray(), UUID.Zero);
+ returnObjects(toReturn.ToArray(), null);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index dff242e..45196bb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Framework.Scenes
localIDs.Add(sog.RootPart.LocalId);
sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
"Returned at region cross");
- sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero);
+ sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
}
catch (Exception)
{
@@ -2254,7 +2254,7 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.UUID);
m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero,
- DeRezAction.Return, UUID.Zero);
+ DeRezAction.Return, UUID.Zero, false);
return;
}
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index bf74849..b26fa32 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -523,8 +523,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
rootPart.AddFlag(PrimFlags.Phantom);
- m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
+ m_scene.AddNewSceneObject(sceneObject, true);
sceneObject.AggregatePerms();
return sceneObject;
}
--
cgit v1.1
From d4111ff6707e59278d1391479d6513bb069b4c3d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 20:59:56 +0000
Subject: fix SimwideArea again
---
OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index dfa7095..53b9796 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1581,6 +1581,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
}
+ FinalizeLandPrimCountUpdate(); // update simarea information
}
}
--
cgit v1.1
From 056ccaed90eb41a2449dcc5677c982d5427da2d4 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 21:43:25 +0000
Subject: update parcel select or sat on stats on sit and stand
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index c4d4f8f..a5af7e1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3117,6 +3117,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose;
m_pos = standPos;
+
}
// We need to wait until we have calculated proper stand positions before sitting up the physical
@@ -3131,6 +3132,7 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
SendAvatarDataToAllAgents();
+ m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on
}
// reset to default sitAnimation
@@ -3263,6 +3265,7 @@ namespace OpenSim.Region.Framework.Scenes
// Moved here to avoid a race with default sit anim
// The script event needs to be raised after the default sit anim is set.
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
+ m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on
}
}
@@ -3412,6 +3415,7 @@ namespace OpenSim.Region.Framework.Scenes
Animator.SetMovementAnimations("SIT");
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
+ m_scene.EventManager.TriggerParcelPrimCountTainted(); // update select/ sat on
}
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
--
cgit v1.1
From a17db1b3cdae29f1d8681747cd96b1bada185f6c Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 30 Jan 2017 12:58:15 +0000
Subject: Comment two very spammy debug messages that the usr can't do anything
about Make a third one conditional.
---
OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | 3 ++-
OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index 52fa908..3d2de82 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -329,7 +329,8 @@ namespace OpenSim.Region.OptionalModules.Materials
AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
{
- m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
+ if (id != UUID.Zero)
+ m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
return;
}
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
index 163f439..0117800 100644
--- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs
@@ -454,7 +454,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
if (physicsParms == null)
{
- m_log.WarnFormat("[MESH]: unknown mesh type for prim {0}",primName);
+ //m_log.WarnFormat("[MESH]: unknown mesh type for prim {0}",primName);
return false;
}
@@ -712,7 +712,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
else
{
// if neither mesh or decomposition present, warn and use convex
- m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName);
+ //m_log.WarnFormat("[MESH]: Data for PRIM shape type ( mesh or decomposition) not found for prim {0}",primName);
}
}
vs.Clear();
--
cgit v1.1
From 5a18ea31cf9d9a97fc1a65f8623b633c244221c2 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 30 Jan 2017 13:59:05 +0000
Subject: Make negative asset caching actually work
Also fixes some merge artefacts in HGAssetBroker where cached assets
were requested but not actually used and completely squelch a materials
debug message because there is nothing the user can do to fix it anyway.
---
.../Agent/TextureSender/J2KDecoderModule.cs | 3 +-
.../Region/CoreModules/Asset/CenomeAssetCache.cs | 4 ++-
OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 6 ++--
.../Region/CoreModules/Asset/FlotsamAssetCache.cs | 37 +++++++++++++++-------
.../CoreModules/Asset/GlynnTuckerAssetCache.cs | 4 ++-
.../Avatar/AvatarFactory/AvatarFactoryModule.cs | 3 +-
.../ServiceConnectorsOut/Asset/HGAssetBroker.cs | 34 +++++++++++++++-----
.../Asset/LocalAssetServiceConnector.cs | 36 +++++++++++++++++----
.../OptionalModules/Materials/MaterialsModule.cs | 3 +-
9 files changed, 97 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 2242e42..594b6bb 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -369,7 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
else if (Cache != null)
{
string assetName = "j2kCache_" + AssetId.ToString();
- AssetBase layerDecodeAsset = Cache.Get(assetName);
+ bool negative;
+ AssetBase layerDecodeAsset = Cache.Get(assetName, out negative);
if (layerDecodeAsset != null)
{
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 23c1f03..136134f 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -260,8 +260,10 @@ namespace OpenSim.Region.CoreModules.Asset
/// Cache doesn't guarantee in any situation that asset is stored to it.
///
///
- public AssetBase Get(string id)
+ public AssetBase Get(string id, out bool negative)
{
+ negative = false;
+
m_getCount++;
AssetBase assetBase;
if (m_cache.TryGetValue(id, out assetBase))
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 51fc3d1..d655509 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -115,7 +115,8 @@ namespace OpenSim.Region.CoreModules.Asset
public bool Check(string id)
{
// XXX This is probably not an efficient implementation.
- return Get(id) != null;
+ bool negative;
+ return Get(id, out negative) != null;
}
public void Cache(AssetBase asset)
@@ -129,8 +130,9 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching
}
- public AssetBase Get(string id)
+ public AssetBase Get(string id, out bool negative)
{
+ negative = false;
return (AssetBase)m_Cache.Get(id);
}
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 187f090..b183a75 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -474,6 +474,8 @@ namespace OpenSim.Region.CoreModules.Asset
{
using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
{
+ if (stream.Length == 0) // Empty file will trigger exception below
+ return null;
BinaryFormatter bformatter = new BinaryFormatter();
asset = (AssetBase)bformatter.Deserialize(stream);
@@ -531,13 +533,25 @@ namespace OpenSim.Region.CoreModules.Asset
return found;
}
+ // For IAssetService
public AssetBase Get(string id)
{
+ bool negative;
+ return Get(id, out negative);
+ }
+
+ public AssetBase Get(string id, out bool negative)
+ {
+ negative = false;
+
m_Requests++;
object dummy;
if (m_negativeCache.TryGetValue(id, out dummy))
+ {
+ negative = true;
return null;
+ }
AssetBase asset = null;
asset = GetFromWeakReference(id);
@@ -578,12 +592,6 @@ namespace OpenSim.Region.CoreModules.Asset
GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
}
- if(asset == null)
- {
-
-
- }
-
return asset;
}
@@ -599,7 +607,8 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetBase GetCached(string id)
{
- return Get(id);
+ bool negative;
+ return Get(id, out negative);
}
public void Expire(string id)
@@ -1227,19 +1236,24 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetMetadata GetMetadata(string id)
{
- AssetBase asset = Get(id);
+ bool negative;
+ AssetBase asset = Get(id, out negative);
return asset.Metadata;
}
public byte[] GetData(string id)
{
- AssetBase asset = Get(id);
+ bool negative;
+ AssetBase asset = Get(id, out negative);
return asset.Data;
}
public bool Get(string id, object sender, AssetRetrieved handler)
{
- AssetBase asset = Get(id);
+ bool negative;
+ AssetBase asset = Get(id, out negative);
+ if (negative)
+ return false;
handler(id, sender, asset);
return true;
}
@@ -1270,7 +1284,8 @@ namespace OpenSim.Region.CoreModules.Asset
public bool UpdateContent(string id, byte[] data)
{
- AssetBase asset = Get(id);
+ bool negative;
+ AssetBase asset = Get(id, out negative);
asset.Data = data;
Cache(asset);
return true;
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 208963d..342d4d9 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -131,8 +131,10 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching
}
- public AssetBase Get(string id)
+ public AssetBase Get(string id, out bool negative)
{
+ negative = false;
+
Object asset = null;
m_Cache.TryGet(id, out asset);
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index fb408a4..3e47782 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -299,7 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (bakedTextureFace == null)
continue;
- AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString());
+ bool negative;
+ AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative);
if (asset != null && asset.Local)
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index f5aa971..ce61ff0 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -209,7 +209,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- asset = m_Cache.Get(id);
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+
+ if (negative)
+ return null;
if (asset != null)
return asset;
@@ -238,8 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public AssetBase GetCached(string id)
{
+ bool negative;
if (m_Cache != null)
- return m_Cache.Get(id);
+ return m_Cache.Get(id, out negative);
return null;
}
@@ -250,8 +255,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- if (m_Cache != null)
- m_Cache.Get(id);
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+
+ if (negative)
+ return null;
if (asset != null)
return asset.Metadata;
@@ -273,8 +281,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- if (m_Cache != null)
- m_Cache.Get(id);
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+
+ if (negative)
+ return null;
if (asset != null)
return asset.Data;
@@ -292,7 +303,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
- asset = m_Cache.Get(id);
+ {
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+
+ if (negative)
+ return false;
+ }
if (asset != null)
{
@@ -381,8 +398,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
AssetBase asset = null;
+ bool negative;
if (m_Cache != null)
- asset = m_Cache.Get(id);
+ asset = m_Cache.Get(id, out negative);
if (asset != null)
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 7190aa0..bbaed21 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -158,7 +158,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
- asset = m_Cache.Get(id);
+ {
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+
+ if (negative)
+ return null;
+ }
if (asset == null)
{
@@ -178,7 +184,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
if (m_Cache != null)
- return m_Cache.Get(id);
+ {
+ bool negative;
+ return m_Cache.Get(id, out negative);
+ }
return null;
}
@@ -187,7 +196,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
AssetBase asset = null;
if (m_Cache != null)
- asset = m_Cache.Get(id);
+ {
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+ if (negative)
+ return null;
+ }
if (asset != null)
return asset.Metadata;
@@ -210,7 +224,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
- asset = m_Cache.Get(id);
+ {
+ bool negative;
+ asset = m_Cache.Get(id, out negative);
+ if (negative)
+ return null;
+ }
if (asset != null)
return asset.Data;
@@ -232,7 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- AssetBase asset = m_Cache.Get(id);
+ bool negative;
+ AssetBase asset = m_Cache.Get(id, out negative);
+
+ if (negative)
+ return false;
if (asset != null)
{
@@ -286,8 +309,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public bool UpdateContent(string id, byte[] data)
{
AssetBase asset = null;
+ bool negative;
if (m_Cache != null)
- m_Cache.Get(id);
+ m_Cache.Get(id, out negative);
if (asset != null)
{
asset.Data = data;
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
index 3d2de82..e8cb052 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs
@@ -329,8 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials
AssetBase matAsset = m_scene.AssetService.Get(id.ToString());
if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 )
{
- if (id != UUID.Zero)
- m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
+ //m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id);
return;
}
--
cgit v1.1
From 5ceb315e3463eaa50abf43a4c07cb37d9486b1fd Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 1 Feb 2017 15:30:17 +0000
Subject: Secure sim stats with an (optional) password.
There is way too much in these stats to expose them to the world, at
least for some of us.
---
OpenSim/Region/Application/OpenSim.cs | 1 +
OpenSim/Region/Application/OpenSimBase.cs | 2 ++
2 files changed, 3 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 8022b1e..58178bc 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -211,6 +211,7 @@ namespace OpenSim
if (managedStatsURI != String.Empty)
{
string urlBase = String.Format("/{0}/", managedStatsURI);
+ StatsManager.StatsPassword = managedStatsPassword;
MainServer.Instance.AddHTTPHandler(urlBase, StatsManager.HandleStatsRequest);
m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase);
}
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index b33e2c2..34a9246 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -88,6 +88,7 @@ namespace OpenSim
public string userStatsURI = String.Empty;
public string managedStatsURI = String.Empty;
+ public string managedStatsPassword = String.Empty;
protected bool m_autoCreateClientStack = true;
@@ -239,6 +240,7 @@ namespace OpenSim
m_permsModules = new List(permissionModules.Split(','));
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
+ managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty);
}
// Load the simulation data service
--
cgit v1.1
From a5151bb337cfee14dff6045d7f8e293201ae94ac Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 1 Feb 2017 16:31:01 +0000
Subject: Refactor asset handling as per Ubit's suggestion
---
.../Agent/TextureSender/J2KDecoderModule.cs | 4 +--
.../Region/CoreModules/Asset/CenomeAssetCache.cs | 7 ++--
OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 12 ++++---
.../Region/CoreModules/Asset/FlotsamAssetCache.cs | 38 +++++++++++-----------
.../CoreModules/Asset/GlynnTuckerAssetCache.cs | 13 ++++----
.../Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 +--
.../ServiceConnectorsOut/Asset/HGAssetBroker.cs | 27 ++++-----------
.../Asset/LocalAssetServiceConnector.cs | 17 +++-------
8 files changed, 50 insertions(+), 72 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 594b6bb..6e4a710 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -369,8 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
else if (Cache != null)
{
string assetName = "j2kCache_" + AssetId.ToString();
- bool negative;
- AssetBase layerDecodeAsset = Cache.Get(assetName, out negative);
+ AssetBase layerDecodeAsset;
+ Cache.Get(assetName, out layerDecodeAsset);
if (layerDecodeAsset != null)
{
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 136134f..403236c 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -260,12 +260,9 @@ namespace OpenSim.Region.CoreModules.Asset
/// Cache doesn't guarantee in any situation that asset is stored to it.
///
///
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase assetBase)
{
- negative = false;
-
m_getCount++;
- AssetBase assetBase;
if (m_cache.TryGetValue(id, out assetBase))
m_hitCount++;
@@ -286,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Asset
// if (null == assetBase)
// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
- return assetBase;
+ return true;
}
#endregion
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index d655509..10c0e85 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -115,8 +115,10 @@ namespace OpenSim.Region.CoreModules.Asset
public bool Check(string id)
{
// XXX This is probably not an efficient implementation.
- bool negative;
- return Get(id, out negative) != null;
+ AssetBase asset;
+ if (!Get(id, out asset))
+ return false;
+ return asset != null;
}
public void Cache(AssetBase asset)
@@ -130,10 +132,10 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching
}
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase asset)
{
- negative = false;
- return (AssetBase)m_Cache.Get(id);
+ asset = (AssetBase)m_Cache.Get(id);
+ return true;
}
public void Expire(string id)
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index b183a75..f8a4461 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -536,24 +536,23 @@ namespace OpenSim.Region.CoreModules.Asset
// For IAssetService
public AssetBase Get(string id)
{
- bool negative;
- return Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
+ return asset;
}
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase asset)
{
- negative = false;
+ asset = null;
m_Requests++;
object dummy;
if (m_negativeCache.TryGetValue(id, out dummy))
{
- negative = true;
- return null;
+ return false;
}
- AssetBase asset = null;
asset = GetFromWeakReference(id);
if (asset != null && m_updateFileTimeOnCacheHit)
{
@@ -592,7 +591,7 @@ namespace OpenSim.Region.CoreModules.Asset
GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
}
- return asset;
+ return true;
}
public bool Check(string id)
@@ -607,8 +606,9 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetBase GetCached(string id)
{
- bool negative;
- return Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
+ return asset;
}
public void Expire(string id)
@@ -1236,23 +1236,22 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetMetadata GetMetadata(string id)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
return asset.Metadata;
}
public byte[] GetData(string id)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
return asset.Data;
}
public bool Get(string id, object sender, AssetRetrieved handler)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
- if (negative)
+ AssetBase asset;
+ if (!Get(id, out asset))
return false;
handler(id, sender, asset);
return true;
@@ -1284,8 +1283,9 @@ namespace OpenSim.Region.CoreModules.Asset
public bool UpdateContent(string id, byte[] data)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
+ AssetBase asset;
+ if (!Get(id, out asset))
+ return false;
asset.Data = data;
Cache(asset);
return true;
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 342d4d9..abe9b23 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -131,16 +131,15 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching
}
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase asset)
{
- negative = false;
+ Object a = null;
+ m_Cache.TryGet(id, out a);
- Object asset = null;
- m_Cache.TryGet(id, out asset);
-
- Debug(asset);
+ Debug(a);
- return (AssetBase)asset;
+ asset = (AssetBase)a;
+ return true;
}
public void Expire(string id)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 3e47782..535d946 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -299,8 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (bakedTextureFace == null)
continue;
- bool negative;
- AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative);
+ AssetBase asset;
+ cache.Get(bakedTextureFace.TextureID.ToString(), out asset);
if (asset != null && asset.Local)
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index ce61ff0..bf9327c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -209,10 +209,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
if (asset != null)
@@ -242,9 +239,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public AssetBase GetCached(string id)
{
- bool negative;
+ AssetBase asset = null;
if (m_Cache != null)
- return m_Cache.Get(id, out negative);
+ m_Cache.Get(id, out asset);
return null;
}
@@ -255,10 +252,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
if (asset != null)
@@ -281,10 +275,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
if (asset != null)
@@ -304,10 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return false;
}
@@ -398,9 +386,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
AssetBase asset = null;
- bool negative;
if (m_Cache != null)
- asset = m_Cache.Get(id, out negative);
+ m_Cache.Get(id, out asset);
if (asset != null)
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index bbaed21..2fe9733 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -159,10 +159,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
}
@@ -183,13 +180,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
+ AssetBase asset = null;
if (m_Cache != null)
- {
- bool negative;
- return m_Cache.Get(id, out negative);
- }
+ m_Cache.Get(id, out asset);
- return null;
+ return asset;
}
public AssetMetadata GetMetadata(string id)
@@ -197,9 +192,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
}
--
cgit v1.1
From 60cf3f759fbadb3405ac7e266ddd13106ae3cbb2 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 1 Feb 2017 16:34:07 +0000
Subject: Refactor part II
---
.../Asset/LocalAssetServiceConnector.cs | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 2fe9733..37a48bb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -218,9 +218,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
}
@@ -244,10 +242,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- AssetBase asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ AssetBase asset;
+ if (!m_Cache.Get(id, out asset))
return false;
if (asset != null)
@@ -302,9 +298,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public bool UpdateContent(string id, byte[] data)
{
AssetBase asset = null;
- bool negative;
if (m_Cache != null)
- m_Cache.Get(id, out negative);
+ m_Cache.Get(id, out asset);
if (asset != null)
{
asset.Data = data;
--
cgit v1.1
From 047e87458bc0e2061f2006f8e180231e14f90655 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Wed, 1 Feb 2017 18:10:27 +0000
Subject: Correct whimsical spelling on a log message
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 1e9711d..827f91e 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -3161,7 +3161,7 @@ namespace OpenSim.Region.Framework.Scenes
{
foreach (Action d in handler.GetInvocationList())
{
- m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoque {0}", d.Method.Name.ToString());
+ m_log.InfoFormat("[EVENT MANAGER]: TriggerSceneShuttingDown invoke {0}", d.Method.Name.ToString());
try
{
d(s);
--
cgit v1.1
From 6164573766efff2802f3e78af5aa65b50f4ff9c6 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 2 Feb 2017 15:22:27 +0000
Subject: Fix an error that would cause a rebake loop on HG grids
---
OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index bf9327c..92ae36f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
m_Cache.Get(id, out asset);
- return null;
+ return asset;
}
public AssetMetadata GetMetadata(string id)
--
cgit v1.1
From efed73b2c33689e4c06344d21a068100424e7160 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 30 Mar 2017 16:27:14 +0100
Subject: mantis 8131: make the new Offline IM code optional and disabled by
default, since it is not compatible with current central servers, like in
osgrid.
---
.../Avatar/InstantMessage/OfflineMessageModule.cs | 87 ++++++++++++++--------
1 file changed, 55 insertions(+), 32 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 297346a..315ce1b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool enabled = true;
+ private bool m_UseNewAvnCode = false;
private List m_SceneList = new List();
private string m_RestURL = String.Empty;
IMessageTransferModule m_TransferModule = null;
@@ -82,6 +83,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
}
m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", m_ForwardOfflineGroupMessages);
+ m_UseNewAvnCode = cnf.GetBoolean("UseNewAvnCode", m_UseNewAvnCode);
}
public void AddRegion(Scene scene)
@@ -244,51 +246,72 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
return;
}
- Scene scene = FindScene(new UUID(im.fromAgentID));
- if (scene == null)
- scene = m_SceneList[0];
+ if(m_UseNewAvnCode)
+ {
+ Scene scene = FindScene(new UUID(im.fromAgentID));
+ if (scene == null)
+ scene = m_SceneList[0];
- SendReply reply = SynchronousRestObjectRequester.MakeRequest(
- "POST", m_RestURL+"/SaveMessage/?scope=" +
- scene.RegionInfo.ScopeID.ToString(), im);
+ UUID scopeID = scene.RegionInfo.ScopeID;
+ SendReply reply = SynchronousRestObjectRequester.MakeRequest(
+ "POST", m_RestURL+"/SaveMessage/?scope=" + scopeID.ToString(), im, 20000);
- if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
- {
- IClientAPI client = FindClient(new UUID(im.fromAgentID));
- if (client == null)
- return;
+ if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
+ {
+ IClientAPI client = FindClient(new UUID(im.fromAgentID));
+ if (client == null)
+ return;
- if (reply.Message == String.Empty)
- reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
+ if (string.IsNullOrEmpty(reply.Message))
+ reply.Message = "User is not logged in. " + (reply.Success ? "Message saved." : "Message not saved");
- bool sendReply = true;
+ bool sendReply = true;
- switch (reply.Disposition)
- {
- case 0: // Normal
- break;
- case 1: // Only once per user
- if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
+ switch (reply.Disposition)
{
- sendReply = false;
+ case 0: // Normal
+ break;
+ case 1: // Only once per user
+ if (m_repliesSent.ContainsKey(client) && m_repliesSent[client].Contains(new UUID(im.toAgentID)))
+ sendReply = false;
+ else
+ {
+ if (!m_repliesSent.ContainsKey(client))
+ m_repliesSent[client] = new List();
+ m_repliesSent[client].Add(new UUID(im.toAgentID));
+ }
+ break;
}
- else
+
+ if (sendReply)
{
- if (!m_repliesSent.ContainsKey(client))
- m_repliesSent[client] = new List();
- m_repliesSent[client].Add(new UUID(im.toAgentID));
+ client.SendInstantMessage(new GridInstantMessage(
+ null, new UUID(im.toAgentID),
+ "System", new UUID(im.fromAgentID),
+ (byte)InstantMessageDialog.MessageFromAgent,
+ reply.Message,
+ false, new Vector3()));
}
- break;
}
+ }
+ else
+ {
+ bool success = SynchronousRestObjectRequester.MakeRequest(
+ "POST", m_RestURL+"/SaveMessage/", im, 20000);
- if (sendReply)
+ if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
{
+ IClientAPI client = FindClient(new UUID(im.fromAgentID));
+ if (client == null)
+ return;
+
client.SendInstantMessage(new GridInstantMessage(
- null, new UUID(im.toAgentID),
- "System", new UUID(im.fromAgentID),
- (byte)InstantMessageDialog.MessageFromAgent,
- reply.Message,
- false, new Vector3()));
+ null, new UUID(im.toAgentID),
+ "System", new UUID(im.fromAgentID),
+ (byte)InstantMessageDialog.MessageFromAgent,
+ "User is not logged in. "+
+ (success ? "Message saved." : "Message not saved"),
+ false, new Vector3()));
}
}
}
--
cgit v1.1
From 9a01fddd1cefea0508b6b1616771e6ef8eabef87 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 30 Mar 2017 17:39:21 +0100
Subject: add CanSellObject() permitions check functions
---
.../Region/CoreModules/World/Land/LandObject.cs | 3 +-
.../World/Objects/BuySell/BuySellModule.cs | 21 ++--
.../World/Permissions/PermissionsModule.cs | 87 ++++++++++++++++-
.../Region/Framework/Scenes/Scene.Permissions.cs | 106 +++++++++++----------
4 files changed, 151 insertions(+), 66 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 9d84e66..2b5cb31 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1649,8 +1649,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
foreach (SceneObjectGroup obj in primsOverMe)
{
- if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero &&
- (obj.EffectiveOwnerPerms & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0)
+ if(m_scene.Permissions.CanSellObject(previousOwner,obj, (byte)SaleType.Original))
m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0);
}
}
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 142c8b7..90d65c7 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -89,28 +89,23 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
if (part == null)
return;
- if (part.ParentGroup.IsDeleted)
+ SceneObjectGroup sog = part.ParentGroup;
+ if (sog == null || sog.IsDeleted)
return;
- if (part.OwnerID != part.GroupID && part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId)))
- return;
-
- if (part.OwnerID == part.GroupID) // Group owned
+ // Does the user have the power to put the object on sale?
+ if (!m_scene.Permissions.CanSellObject(client, sog, saleType))
{
- // Does the user have the power to put the object on sale?
- if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID))
- {
- client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
- return;
- }
+ client.SendAgentAlertMessage("You don't have permission to set object on sale", false);
+ return;
}
- part = part.ParentGroup.RootPart;
+ part = sog.RootPart;
part.ObjectSaleType = saleType;
part.SalePrice = salePrice;
- part.ParentGroup.HasGroupChanged = true;
+ sog.HasGroupChanged = true;
part.SendPropertiesToClient(client);
}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 279b966..7f2b29a 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -300,6 +300,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnDelinkObject += CanDelinkObject;
scenePermissions.OnDeedObject += CanDeedObject;
scenePermissions.OnSellGroupObject += CanSellGroupObject;
+ scenePermissions.OnSellObjectByUserID += CanSellObjectByUserID;
+ scenePermissions.OnSellObject += CanSellObject;
scenePermissions.OnCreateObjectInventory += CanCreateObjectInventory;
scenePermissions.OnEditObjectInventory += CanEditObjectInventory;
@@ -393,7 +395,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnLinkObject -= CanLinkObject;
scenePermissions.OnDelinkObject -= CanDelinkObject;
scenePermissions.OnDeedObject -= CanDeedObject;
+
scenePermissions.OnSellGroupObject -= CanSellGroupObject;
+ scenePermissions.OnSellObjectByUserID -= CanSellObjectByUserID;
+ scenePermissions.OnSellObject -= CanSellObject;
scenePermissions.OnCreateObjectInventory -= CanCreateObjectInventory;
scenePermissions.OnEditObjectInventory -= CanEditObjectInventory;
@@ -1826,6 +1831,86 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
}
+ private bool CanSellObjectByUserID(SceneObjectGroup sog, UUID userID, byte saleType)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ if (sog == null || sog.IsDeleted || userID == UUID.Zero)
+ return false;
+
+ // sell is not a attachment op
+ if(sog.IsAttachment)
+ return false;
+
+ if(IsAdministrator(userID))
+ return true;
+
+ uint sogEffectiveOwnerPerms = sog.EffectiveOwnerPerms;
+ if((sogEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+
+ if(saleType == (byte)SaleType.Copy &&
+ (sogEffectiveOwnerPerms & (uint)PermissionMask.Copy) == 0)
+ return false;
+
+ UUID sogOwnerID = sog.OwnerID;
+
+ if(sogOwnerID == userID)
+ return true;
+
+ // else only group owned can be sold by members with powers
+ UUID sogGroupID = sog.GroupID;
+ if(sog.OwnerID != sogGroupID || sogGroupID == UUID.Zero)
+ return false;
+
+ return IsGroupMember(sogGroupID, userID, (ulong)GroupPowers.ObjectSetForSale);
+ }
+
+ private bool CanSellObject(SceneObjectGroup sog, ScenePresence sp, byte saleType)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+ if (m_bypassPermissions) return m_bypassPermissionsValue;
+
+ if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
+ return false;
+
+ // sell is not a attachment op
+ if(sog.IsAttachment)
+ return false;
+
+ if(sp.IsGod)
+ return true;
+
+ uint sogEffectiveOwnerPerms = sog.EffectiveOwnerPerms;
+ if((sogEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
+ return false;
+
+ if(saleType == (byte)SaleType.Copy &&
+ (sogEffectiveOwnerPerms & (uint)PermissionMask.Copy) == 0)
+ return false;
+
+ UUID userID = sp.UUID;
+ UUID sogOwnerID = sog.OwnerID;
+
+ if(sogOwnerID == userID)
+ return true;
+
+ // else only group owned can be sold by members with powers
+ UUID sogGroupID = sog.GroupID;
+ if(sog.OwnerID != sogGroupID || sogGroupID == UUID.Zero)
+ return false;
+
+ ulong powers = 0;
+ if(!GroupMemberPowers(sogGroupID, sp, ref powers))
+ return false;
+
+ if((powers & (ulong)GroupPowers.ObjectSetForSale) == 0)
+ return false;
+
+ return true;
+ }
+
private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
{
// ignore locked, viewers shell ask for confirmation
@@ -1835,7 +1920,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
return false;
- // take is not a attachment op
+ // take is not a attachment op
if(sog.IsAttachment)
return false;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 6d3b82f..7d69a9b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -47,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
+ public delegate bool SellObjectHandlerByUserID(SceneObjectGroup sog, UUID userID, byte saleType);
+ public delegate bool SellObjectHandler(SceneObjectGroup sog, ScenePresence sp, byte saleType);
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
@@ -121,7 +123,11 @@ namespace OpenSim.Region.Framework.Scenes
public event DeleteObjectHandler OnDeleteObject;
public event TransferObjectHandler OnTransferObject;
public event TakeObjectHandler OnTakeObject;
+
public event SellGroupObjectHandler OnSellGroupObject;
+ public event SellObjectHandlerByUserID OnSellObjectByUserID;
+ public event SellObjectHandler OnSellObject;
+
public event TakeCopyObjectHandler OnTakeCopyObject;
public event DuplicateObjectHandler OnDuplicateObject;
public event EditObjectByIDsHandler OnEditObjectByIDs;
@@ -281,14 +287,11 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
-
return result;
}
public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
{
- bool result = true;
-
DeleteObjectHandler handler = OnDeleteObject;
if (handler != null)
{
@@ -301,20 +304,15 @@ namespace OpenSim.Region.Framework.Scenes
foreach (DeleteObjectHandler h in list)
{
if (h(sog, sp) == false)
- {
- result = false;
- break;
- }
+ return false;
}
}
- return result;
+ return true;
}
public bool CanTransferObject(UUID objectID, UUID recipient)
{
- bool result = true;
-
TransferObjectHandler handler = OnTransferObject;
if (handler != null)
{
@@ -322,14 +320,10 @@ namespace OpenSim.Region.Framework.Scenes
foreach (TransferObjectHandler h in list)
{
if (h(objectID, recipient) == false)
- {
- result = false;
- break;
- }
+ return false;
}
}
-
- return result;
+ return true;
}
#endregion
@@ -337,8 +331,6 @@ namespace OpenSim.Region.Framework.Scenes
#region TAKE OBJECT
public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
{
- bool result = true;
-
TakeObjectHandler handler = OnTakeObject;
if (handler != null)
{
@@ -349,18 +341,13 @@ namespace OpenSim.Region.Framework.Scenes
foreach (TakeObjectHandler h in list)
{
if (h(sog, sp) == false)
- {
- result = false;
- break;
- }
+ return false;
}
}
-
// m_log.DebugFormat(
// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}",
// objectID, AvatarTakingUUID, result);
-
- return result;
+ return true;
}
#endregion
@@ -368,8 +355,6 @@ namespace OpenSim.Region.Framework.Scenes
#region SELL GROUP OBJECT
public bool CanSellGroupObject(UUID userID, UUID groupID)
{
- bool result = true;
-
SellGroupObjectHandler handler = OnSellGroupObject;
if (handler != null)
{
@@ -377,18 +362,52 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SellGroupObjectHandler h in list)
{
if (h(userID, groupID) == false)
- {
- result = false;
- break;
- }
+ return false;
}
}
-
//m_log.DebugFormat(
// "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
// userID, groupID, result);
+ return true;
+ }
- return result;
+ #endregion
+
+ #region SELL OBJECT
+ public bool CanSellObject(IClientAPI client, SceneObjectGroup sog, byte saleType)
+ {
+ SellObjectHandler handler = OnSellObject;
+ if (handler != null)
+ {
+ if(sog == null || client == null || client.SceneAgent == null)
+ return false;
+
+ ScenePresence sp = client.SceneAgent as ScenePresence;
+ Delegate[] list = handler.GetInvocationList();
+ foreach (SellObjectHandler h in list)
+ {
+ if (h(sog, sp, saleType) == false)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public bool CanSellObject(UUID userID, SceneObjectGroup sog, byte saleType)
+ {
+ SellObjectHandlerByUserID handler = OnSellObjectByUserID;
+ if (handler != null)
+ {
+ if(sog == null)
+ return false;
+ Delegate[] list = handler.GetInvocationList();
+ foreach (SellObjectHandlerByUserID h in list)
+ {
+ if (h(sog, userID, saleType) == false)
+ return false;
+ }
+ }
+ return true;
}
#endregion
@@ -397,8 +416,6 @@ namespace OpenSim.Region.Framework.Scenes
#region TAKE COPY OBJECT
public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
{
- bool result = true;
-
TakeCopyObjectHandler handler = OnTakeCopyObject;
if (handler != null)
{
@@ -408,18 +425,13 @@ namespace OpenSim.Region.Framework.Scenes
foreach (TakeCopyObjectHandler h in list)
{
if (h(sog, sp) == false)
- {
- result = false;
- break;
- }
+ return false;
}
}
-
// m_log.DebugFormat(
// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}",
// objectID, userID, result);
-
- return result;
+ return true;
}
#endregion
@@ -558,8 +570,6 @@ namespace OpenSim.Region.Framework.Scenes
#region RETURN OBJECT
public bool CanReturnObjects(ILandObject land, IClientAPI client, List objects)
{
- bool result = true;
-
ReturnObjectsHandler handler = OnReturnObjects;
if (handler != null)
{
@@ -574,18 +584,14 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ReturnObjectsHandler h in list)
{
if (h(land, sp, objects) == false)
- {
- result = false;
- break;
- }
+ return false;
}
}
-
// m_log.DebugFormat(
// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}",
// user, objects.Count, land.LandData.Name, result);
- return result;
+ return true;
}
#endregion
--
cgit v1.1
From caaf9f7fc19d6c272f9cab669ed78c486b11fded Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 9 Feb 2017 23:13:37 +0000
Subject: Squelch an error that happens when the asset cache was mounted RO.
Nothing we can do about that, blame Docker.
---
OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index f8a4461..610e279 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -806,6 +806,9 @@ namespace OpenSim.Region.CoreModules.Asset
return;
}
+ catch (UnauthorizedAccessException e)
+ {
+ }
finally
{
if (stream != null)
--
cgit v1.1
From 27fdf3094d6bf20325ab261b41d3d4831c14c204 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 9 Feb 2017 23:14:35 +0000
Subject: A god is a god is a god. Let gods access scripts and NCs
Support staff are not of much help if they can't see the script a user
has issues with.
---
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b60cd93..86f0a58 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -1732,6 +1732,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
+ // A god is a god is a god
+ if (IsAdministrator(user))
+ return true;
+
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
@@ -1828,6 +1832,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
+ // A god is a god is a god
+ if (IsAdministrator(user))
+ return true;
+
if (objectID == UUID.Zero) // User inventory
{
IInventoryService invService = m_scene.InventoryService;
--
cgit v1.1
From 91f142bbd2f11580da86c66fad2c08d176b09c97 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 9 Feb 2017 23:16:23 +0000
Subject: Add the option to link a scene object with a monitoring object
For debugging purposes.
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 ++
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 +++++++++++++
2 files changed, 15 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 3f531be..6332beb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -376,6 +376,8 @@ namespace OpenSim.Region.Framework.Scenes
public bool m_dupeInProgress = false;
internal Dictionary m_savedScriptState;
+ public UUID MonitoringObject { get; set; }
+
#region Properties
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 45bdb41..9c67395 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -424,6 +424,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return lease;
}
+ protected SceneObjectPart MonitoringObject()
+ {
+ UUID m = m_host.ParentGroup.MonitoringObject;
+ if (m == UUID.Zero)
+ return null;
+
+ SceneObjectPart p = m_ScriptEngine.World.GetSceneObjectPart(m);
+ if (p == null)
+ m_host.ParentGroup.MonitoringObject = UUID.Zero;
+
+ return p;
+ }
+
protected virtual void ScriptSleep(int delay)
{
delay = (int)((float)delay * m_ScriptDelayFactor);
--
cgit v1.1
From 995e750c561d3faebe7b7aceb729d2823dd8bb38 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 24 Feb 2017 01:30:20 +0000
Subject: Change a misleading message that could lead users to believe a grid
is down
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2137b42..2a0bd3c 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1520,6 +1520,8 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Debug("[SCENE]: Persisting changed objects");
Backup(true);
+ m_log.Debug("[SCENE]: Closing scene");
+
m_sceneGraph.Close();
base.Close();
@@ -3983,7 +3985,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!LoginsEnabled)
{
- reason = "Logins Disabled";
+ reason = "Logins to this region are disabled";
return false;
}
--
cgit v1.1
From 5109dc955fa25562675b7ae37a79bf5504f2e394 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Mon, 13 Mar 2017 12:48:55 +0000
Subject: Set a startup marker to let external scripts know the scene is up.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2a0bd3c..f4bf0b2 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1212,6 +1212,28 @@ namespace OpenSim.Region.Framework.Scenes
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
+ IConfig restartConfig = config.Configs["RestartModule"];
+ if (restartConfig != null)
+ {
+ string markerPath = restartConfig.GetString("MarkerPath", String.Empty);
+
+ if (markerPath != String.Empty)
+ {
+ string path = Path.Combine(markerPath, RegionInfo.RegionID.ToString() + ".started");
+ try
+ {
+ string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString();
+ FileStream fs = File.Create(path);
+ System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+ Byte[] buf = enc.GetBytes(pidstring);
+ fs.Write(buf, 0, buf.Length);
+ fs.Close();
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
}
public Scene(RegionInfo regInfo)
--
cgit v1.1
From 3e880cee45ea0d85297c51d3ed87490d47a5bd94 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 23 Mar 2017 23:00:14 +0000
Subject: Allow short-circuiting region restart delays of there are no users
left
---
.../CoreModules/World/Region/RestartModule.cs | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index 8bac9e6..bf6592f 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -61,6 +61,8 @@ namespace OpenSim.Region.CoreModules.World.Region
protected IDialogModule m_DialogModule = null;
protected string m_MarkerPath = String.Empty;
private int[] m_CurrentAlerts = null;
+ protected bool m_shortCircuitDelays = false;
+ protected bool m_rebootAll = false;
public void Initialise(IConfigSource config)
{
@@ -69,6 +71,9 @@ namespace OpenSim.Region.CoreModules.World.Region
{
m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty);
}
+ IConfig startupConfig = config.Configs["Startup"];
+ m_shortCircuitDelays = startupConfig.GetBoolean("SkipDelayOnEmptyRegion", false);
+ m_rebootAll = startupConfig.GetBoolean("InworldRestartShutsDown", false);
}
public void AddRegion(Scene scene)
@@ -250,6 +255,14 @@ namespace OpenSim.Region.CoreModules.World.Region
private void OnTimer(object source, ElapsedEventArgs e)
{
int nextInterval = DoOneNotice(true);
+ if (m_shortCircuitDelays)
+ {
+ if (CountAgents() == 0)
+ {
+ m_Scene.RestartNow();
+ return;
+ }
+ }
SetTimer(nextInterval);
}
@@ -349,5 +362,35 @@ namespace OpenSim.Region.CoreModules.World.Region
{
}
}
+
+ int CountAgents()
+ {
+ m_log.Info("[RESTART MODULE]: Counting affected avatars");
+ int agents = 0;
+
+ if (m_rebootAll)
+ {
+ foreach (Scene s in SceneManager.Instance.Scenes)
+ {
+ foreach (ScenePresence sp in s.GetScenePresences())
+ {
+ if (!sp.IsChildAgent)
+ agents++;
+ }
+ }
+ }
+ else
+ {
+ foreach (ScenePresence sp in m_Scene.GetScenePresences())
+ {
+ if (!sp.IsChildAgent)
+ agents++;
+ }
+ }
+
+ m_log.InfoFormat("[RESTART MODULE]: Avatars in region: {0}", agents);
+
+ return agents;
+ }
}
}
--
cgit v1.1
From 75915bd0f3be487a0fa05e4a91d46b23b488ce82 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 31 Mar 2017 13:46:01 +0100
Subject: Add the ability to post to and act uponconfiguration in etcd
Etcd is a distributed, highly available name-value store that is
the basis of many clustered applications. However, it can also be
run on a standalone machine. Using etcd allows live monitoring
and possibly changing configuration while the sim is running.
---
OpenSim/Region/Framework/Interfaces/IEtcdModule.cs | 37 ++++
OpenSim/Region/Framework/Scenes/Scene.cs | 47 ++++-
.../Framework/Monitoring/EtcdMonitoringModule.cs | 195 +++++++++++++++++++++
3 files changed, 276 insertions(+), 3 deletions(-)
create mode 100644 OpenSim/Region/Framework/Interfaces/IEtcdModule.cs
create mode 100644 OpenSim/Region/OptionalModules/Framework/Monitoring/EtcdMonitoringModule.cs
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Interfaces/IEtcdModule.cs b/OpenSim/Region/Framework/Interfaces/IEtcdModule.cs
new file mode 100644
index 0000000..123cb67
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IEtcdModule.cs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+
+public interface IEtcdModule
+{
+ bool Store(string k, string v);
+ bool Store(string k, string v, int ttl);
+ string Get(string k);
+ void Watch(string k, Action callback);
+ void Delete(string k);
+}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f4bf0b2..fd13821 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -540,6 +540,9 @@ namespace OpenSim.Region.Framework.Scenes
private Timer m_mapGenerationTimer = new Timer();
private bool m_generateMaptiles;
+ protected int m_lastHealth = -1;
+ protected int m_lastUsers = -1;
+
#endregion Fields
#region Properties
@@ -1234,6 +1237,8 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
+
+ StartTimerWatchdog();
}
public Scene(RegionInfo regInfo)
@@ -1504,6 +1509,14 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
+ IEtcdModule etcd = RequestModuleInterface();
+ if (etcd != null)
+ {
+ etcd.Delete("Health");
+ etcd.Delete("HealthFlags");
+ etcd.Delete("RootAgents");
+ }
+
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
@@ -5536,23 +5549,24 @@ Label_GroupsDone:
return 0;
}
- if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
+ if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 2000)
{
health+=1;
flags |= 1;
}
- if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000)
+ if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 2000)
{
health+=1;
flags |= 2;
}
- if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000)
+ if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 2000)
{
health+=1;
flags |= 4;
}
+ /*
else
{
int pid = System.Diagnostics.Process.GetCurrentProcess().Id;
@@ -5565,6 +5579,7 @@ proc.WaitForExit();
Thread.Sleep(1000);
Environment.Exit(1);
}
+ */
if (flags != 7)
return health;
@@ -6329,6 +6344,32 @@ Environment.Exit(1);
public void TimerWatchdog(object sender, ElapsedEventArgs e)
{
CheckHeartbeat();
+
+ IEtcdModule etcd = RequestModuleInterface();
+ int flags;
+ string message;
+ if (etcd != null)
+ {
+ int health = GetHealth(out flags, out message);
+ if (health != m_lastHealth)
+ {
+ m_lastHealth = health;
+
+ etcd.Store("Health", health.ToString(), 300000);
+ etcd.Store("HealthFlags", flags.ToString(), 300000);
+ }
+
+ int roots = 0;
+ foreach (ScenePresence sp in GetScenePresences())
+ if (!sp.IsChildAgent && !sp.IsNPC)
+ roots++;
+
+ if (m_lastUsers != roots)
+ {
+ m_lastUsers = roots;
+ etcd.Store("RootAgents", roots.ToString(), 300000);
+ }
+ }
}
/// This method deals with movement when an avatar is automatically moving (but this is distinct from the
diff --git a/OpenSim/Region/OptionalModules/Framework/Monitoring/EtcdMonitoringModule.cs b/OpenSim/Region/OptionalModules/Framework/Monitoring/EtcdMonitoringModule.cs
new file mode 100644
index 0000000..921bbfb
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Framework/Monitoring/EtcdMonitoringModule.cs
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using log4net;
+using Mono.Addins;
+using Nini.Config;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Framework.Console;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using netcd;
+using netcd.Serialization;
+using netcd.Advanced;
+using netcd.Advanced.Requests;
+
+namespace OpenSim.Region.OptionalModules.Framework.Monitoring
+{
+ ///
+ /// Allows to store monitoring data in etcd, a high availability
+ /// name-value store.
+ ///
+ [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EtcdMonitoringModule")]
+ public class EtcdMonitoringModule : INonSharedRegionModule, IEtcdModule
+ {
+ private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ protected Scene m_scene;
+ protected IEtcdClient m_client;
+ protected bool m_enabled = false;
+ protected string m_etcdBasePath = String.Empty;
+ protected bool m_appendRegionID = true;
+
+ public string Name
+ {
+ get { return "EtcdMonitoringModule"; }
+ }
+
+ public Type ReplaceableInterface
+ {
+ get { return null; }
+ }
+
+ public void Initialise(IConfigSource source)
+ {
+ if (source.Configs["Etcd"] == null)
+ return;
+
+ IConfig etcdConfig = source.Configs["Etcd"];
+
+ string etcdUrls = etcdConfig.GetString("EtcdUrls", String.Empty);
+ if (etcdUrls == String.Empty)
+ return;
+
+ m_etcdBasePath = etcdConfig.GetString("BasePath", m_etcdBasePath);
+ m_appendRegionID = etcdConfig.GetBoolean("AppendRegionID", m_appendRegionID);
+
+ if (!m_etcdBasePath.EndsWith("/"))
+ m_etcdBasePath += "/";
+
+ try
+ {
+ string[] endpoints = etcdUrls.Split(new char[] {','});
+ List uris = new List();
+ foreach (string endpoint in endpoints)
+ uris.Add(new Uri(endpoint.Trim()));
+
+ m_client = new EtcdClient(uris.ToArray(), new DefaultSerializer(), new DefaultSerializer());
+ }
+ catch (Exception e)
+ {
+ m_log.DebugFormat("[ETCD]: Error initializing connection: " + e.ToString());
+ return;
+ }
+
+ m_log.DebugFormat("[ETCD]: Etcd module configured");
+ m_enabled = true;
+ }
+
+ public void Close()
+ {
+ //m_client = null;
+ m_scene = null;
+ }
+
+ public void AddRegion(Scene scene)
+ {
+ m_scene = scene;
+
+ if (m_enabled)
+ {
+ if (m_appendRegionID)
+ m_etcdBasePath += m_scene.RegionInfo.RegionID.ToString() + "/";
+
+ m_log.DebugFormat("[ETCD]: Using base path {0} for all keys", m_etcdBasePath);
+
+ try
+ {
+ m_client.Advanced.CreateDirectory(new CreateDirectoryRequest() {Key = m_etcdBasePath});
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("Exception trying to create base path {0}: " + e.ToString(), m_etcdBasePath);
+ }
+
+ scene.RegisterModuleInterface(this);
+ }
+ }
+
+ public void RemoveRegion(Scene scene)
+ {
+ }
+
+ public void RegionLoaded(Scene scene)
+ {
+ }
+
+ public bool Store(string k, string v)
+ {
+ return Store(k, v, 0);
+ }
+
+ public bool Store(string k, string v, int ttl)
+ {
+ Response resp = m_client.Advanced.SetKey(new SetKeyRequest() { Key = m_etcdBasePath + k, Value = v, TimeToLive = ttl });
+
+ if (resp == null)
+ return false;
+
+ if (resp.ErrorCode.HasValue)
+ {
+ m_log.DebugFormat("[ETCD]: Error {0} ({1}) storing {2} => {3}", resp.Cause, (int)resp.ErrorCode, m_etcdBasePath + k, v);
+
+ return false;
+ }
+
+ return true;
+ }
+
+ public string Get(string k)
+ {
+ Response resp = m_client.Advanced.GetKey(new GetKeyRequest() { Key = m_etcdBasePath + k });
+
+ if (resp == null)
+ return String.Empty;
+
+ if (resp.ErrorCode.HasValue)
+ {
+ m_log.DebugFormat("[ETCD]: Error {0} ({1}) getting {2}", resp.Cause, (int)resp.ErrorCode, m_etcdBasePath + k);
+
+ return String.Empty;
+ }
+
+ return resp.Node.Value;
+ }
+
+ public void Delete(string k)
+ {
+ m_client.Advanced.DeleteKey(new DeleteKeyRequest() { Key = m_etcdBasePath + k });
+ }
+
+ public void Watch(string k, Action callback)
+ {
+ m_client.Advanced.WatchKey(new WatchKeyRequest() { Key = m_etcdBasePath + k, Callback = (x) => { callback(x.Node.Value); } });
+ }
+ }
+}
--
cgit v1.1
From a6ecedb72a44dbf9c2b9ec4c8f51ec70fce06b78 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 31 Mar 2017 13:50:28 +0100
Subject: Also ignore NPCs in short-circuiting region restarts
---
OpenSim/Region/CoreModules/World/Region/RestartModule.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index bf6592f..bb3b860 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -374,7 +374,7 @@ namespace OpenSim.Region.CoreModules.World.Region
{
foreach (ScenePresence sp in s.GetScenePresences())
{
- if (!sp.IsChildAgent)
+ if (!sp.IsChildAgent && !sp.IsNPC)
agents++;
}
}
@@ -383,7 +383,7 @@ namespace OpenSim.Region.CoreModules.World.Region
{
foreach (ScenePresence sp in m_Scene.GetScenePresences())
{
- if (!sp.IsChildAgent)
+ if (!sp.IsChildAgent && !sp.IsNPC)
agents++;
}
}
--
cgit v1.1
From 59f7cf79c9925ea07a79d975bf480aba7b5d6498 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 31 Mar 2017 13:51:42 +0100
Subject: Prevent error spew when script send IM to HG users before HG is up
---
.../Framework/UserManagement/UserManagementModule.cs | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 51f973a..32cb5a3 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -957,9 +957,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public virtual bool IsLocalGridUser(UUID uuid)
{
- UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
- if (account == null || (account != null && !account.LocalToGrid))
- return false;
+ lock (m_Scenes)
+ {
+ if (m_Scenes.Count == 0)
+ return true;
+ UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
+ if (account == null || (account != null && !account.LocalToGrid))
+ return false;
+ }
return true;
}
--
cgit v1.1
From b033a2559ea0f027a3668f5a3969f0ca368f2877 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 31 Mar 2017 14:55:54 +0100
Subject: Adapt to a variable name that has changed in core
---
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index bc86076..ab8fb51 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -2033,7 +2033,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_bypassPermissions) return m_bypassPermissionsValue;
// A god is a god is a god
- if (IsAdministrator(user))
+ if (IsAdministrator(userID))
return true;
if (objectID == UUID.Zero) // User inventory
@@ -2126,7 +2126,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (m_bypassPermissions) return m_bypassPermissionsValue;
// A god is a god is a god
- if (IsAdministrator(user))
+ if (IsAdministrator(userID))
return true;
if (objectID == UUID.Zero) // User inventory
--
cgit v1.1
From 6a35a965ff7085b5962745437a10d798c0fb611d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 31 Mar 2017 20:55:48 +0100
Subject: add OSSL functions to override linksets total mass, center of mass
and inertia. replacing the crude automatic estimation based on prims known to
physics and density. Changed parameters are still not saved, and are lost on
region crossings. only suported by UbODE. EXPERIMENTAL feature, only test it
for now.. don't try to use in products.
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 41 ++++
.../PhysicsModules/SharedBase/PhysicsActor.cs | 36 +++
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 253 +++++++++++++++++----
.../Shared/Api/Implementation/OSSL_Api.cs | 213 +++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 8 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 26 +++
6 files changed, 531 insertions(+), 46 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bf4d60c..77658ef 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -5010,6 +5010,47 @@ namespace OpenSim.Region.Framework.Scenes
return Ptot;
}
+ public void GetInertiaData(out float TotalMass, out Vector3 CenterOfMass, out Vector3 Inertia, out Vector4 aux )
+ {
+ PhysicsActor pa = RootPart.PhysActor;
+
+ if(((RootPart.Flags & PrimFlags.Physics) !=0) && pa !=null)
+ {
+ PhysicsInertiaData inertia;
+
+ inertia = pa.GetInertiaData();
+
+ TotalMass = inertia.TotalMass;
+ CenterOfMass = inertia.CenterOfMass;
+ Inertia = inertia.Inertia;
+ aux = inertia.InertiaRotation;
+
+ return;
+ }
+
+ TotalMass = GetMass();
+ CenterOfMass = GetCenterOfMass() - AbsolutePosition;
+ CenterOfMass *= Quaternion.Conjugate(RootPart.RotationOffset);
+ Inertia = Vector3.Zero;
+ aux = Vector4.Zero;
+ }
+
+ public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux )
+ {
+ PhysicsActor pa = RootPart.PhysActor;
+
+ if(pa !=null)
+ {
+ PhysicsInertiaData inertia = new PhysicsInertiaData();
+ inertia.TotalMass = TotalMass;
+ inertia.CenterOfMass = CenterOfMass;
+ inertia.Inertia = Inertia;
+ inertia.InertiaRotation = aux;
+ pa.SetInertiaData(inertia);
+ }
+ }
+
+
///
/// Set the user group to which this scene object belongs.
///
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index 33f0337..ad9b28f 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -55,6 +55,28 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
Absolute
}
+ public class PhysicsInertiaData
+ {
+ public float TotalMass; // the total mass of a linkset
+ public Vector3 CenterOfMass; // the center of mass position relative to root part position
+ public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords
+ public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation
+ // or the upper triangle of the inertia tensor
+ // Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy))
+
+ public PhysicsInertiaData()
+ {
+ }
+
+ public PhysicsInertiaData(PhysicsInertiaData source)
+ {
+ TotalMass = source.TotalMass;
+ CenterOfMass = source.CenterOfMass;
+ Inertia = source.Inertia;
+ InertiaRotation = source.InertiaRotation;
+ }
+ }
+
public struct CameraData
{
public Quaternion CameraRotation;
@@ -463,6 +485,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
+ public virtual PhysicsInertiaData GetInertiaData()
+ {
+ PhysicsInertiaData data = new PhysicsInertiaData();
+ data.TotalMass = this.Mass;
+ data.CenterOfMass = CenterOfMass - Position;
+ data.Inertia = Vector3.Zero;
+ data.InertiaRotation = Vector4.Zero;
+ return data;
+ }
+
+ public virtual void SetInertiaData(PhysicsInertiaData inertia)
+ {
+ }
+
// Warning in a parent part it returns itself, not null
public virtual PhysicsActor ParentActor { get { return this; } }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 45ef273..d560b41 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -182,14 +182,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private float m_streamCost;
public d.Mass primdMass; // prim inertia information on it's own referencial
+ private PhysicsInertiaData m_InertiaOverride;
float primMass; // prim own mass
float primVolume; // prim own volume;
- float _mass; // object mass acording to case
+ float m_mass; // object mass acording to case
public int givefakepos;
private Vector3 fakepos;
public int givefakeori;
private Quaternion fakeori;
+ private PhysicsInertiaData m_fakeInertiaOverride;
private int m_eventsubscription;
private int m_cureventsubscription;
@@ -465,10 +467,110 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
+ public override PhysicsInertiaData GetInertiaData()
+ {
+ PhysicsInertiaData inertia;
+ if(childPrim)
+ {
+ if(_parent != null)
+ return _parent.GetInertiaData();
+ else
+ {
+ inertia = new PhysicsInertiaData();
+ inertia.TotalMass = -1;
+ return inertia;
+ }
+ }
+
+ inertia = new PhysicsInertiaData();
+
+ // double buffering
+ if(m_fakeInertiaOverride != null)
+ {
+ d.Mass objdmass = new d.Mass();
+ objdmass.I.M00 = m_fakeInertiaOverride.Inertia.X;
+ objdmass.I.M11 = m_fakeInertiaOverride.Inertia.Y;
+ objdmass.I.M22 = m_fakeInertiaOverride.Inertia.Z;
+
+ objdmass.mass = m_fakeInertiaOverride.TotalMass;
+
+ if(Math.Abs(m_fakeInertiaOverride.InertiaRotation.W) < 0.999)
+ {
+ d.Matrix3 inertiarotmat = new d.Matrix3();
+ d.Quaternion inertiarot = new d.Quaternion();
+
+ inertiarot.X = m_fakeInertiaOverride.InertiaRotation.X;
+ inertiarot.Y = m_fakeInertiaOverride.InertiaRotation.Y;
+ inertiarot.Z = m_fakeInertiaOverride.InertiaRotation.Z;
+ inertiarot.W = m_fakeInertiaOverride.InertiaRotation.W;
+ d.RfromQ(out inertiarotmat, ref inertiarot);
+ d.MassRotate(ref objdmass, ref inertiarotmat);
+ }
+
+ inertia.TotalMass = m_fakeInertiaOverride.TotalMass;
+ inertia.CenterOfMass = m_fakeInertiaOverride.CenterOfMass;
+ inertia.Inertia.X = objdmass.I.M00;
+ inertia.Inertia.Y = objdmass.I.M11;
+ inertia.Inertia.Z = objdmass.I.M22;
+ inertia.InertiaRotation.X = objdmass.I.M01;
+ inertia.InertiaRotation.Y = objdmass.I.M02;
+ inertia.InertiaRotation.Z = objdmass.I.M12;
+ return inertia;
+ }
+
+ inertia.TotalMass = m_mass;
+
+ if(Body == IntPtr.Zero || prim_geom == IntPtr.Zero)
+ {
+ inertia.CenterOfMass = Vector3.Zero;
+ inertia.Inertia = Vector3.Zero;
+ inertia.InertiaRotation = Vector4.Zero;
+ return inertia;
+ }
+
+ d.Vector3 dtmp;
+ d.Mass m = new d.Mass();
+ lock(_parent_scene.OdeLock)
+ {
+ d.AllocateODEDataForThread(0);
+ dtmp = d.GeomGetOffsetPosition(prim_geom);
+ d.BodyGetMass(Body, out m);
+ }
+
+ Vector3 cm = new Vector3(-dtmp.X, -dtmp.Y, -dtmp.Z);
+ inertia.CenterOfMass = cm;
+ inertia.Inertia = new Vector3(m.I.M00, m.I.M11, m.I.M22);
+ inertia.InertiaRotation = new Vector4(m.I.M01, m.I.M02 , m.I.M12, 0);
+
+ return inertia;
+ }
+
+ public override void SetInertiaData(PhysicsInertiaData inertia)
+ {
+ if(childPrim)
+ {
+ if(_parent != null)
+ _parent.SetInertiaData(inertia);
+ return;
+ }
+
+ if(inertia.TotalMass > 0)
+ m_fakeInertiaOverride = new PhysicsInertiaData(inertia);
+ else
+ m_fakeInertiaOverride = null;
+
+ if (inertia.TotalMass > _parent_scene.maximumMassObject)
+ inertia.TotalMass = _parent_scene.maximumMassObject;
+ AddChange(changes.SetInertia,(object)m_fakeInertiaOverride);
+ }
+
public override Vector3 CenterOfMass
{
get
{
+ if(!childPrim && m_fakeInertiaOverride != null)
+ return m_fakeInertiaOverride.CenterOfMass;
+
lock (_parent_scene.OdeLock)
{
d.AllocateODEDataForThread(0);
@@ -922,8 +1024,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
float old = m_density;
m_density = value / 100f;
- if(m_density != old)
- UpdatePrimBodyData();
+ // if(m_density != old)
+ // UpdatePrimBodyData();
}
}
public override float GravModifier
@@ -1716,26 +1818,29 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_log.Warn("[PHYSICS]: MakeBody root geom already had a body");
}
- d.Matrix3 mymat = new d.Matrix3();
- d.Quaternion myrot = new d.Quaternion();
- d.Mass objdmass = new d.Mass { };
+ bool noInertiaOverride = (m_InertiaOverride == null);
Body = d.BodyCreate(_parent_scene.world);
- objdmass = primdMass;
+ d.Matrix3 mymat = new d.Matrix3();
+ d.Quaternion myrot = new d.Quaternion();
+ d.Mass objdmass = new d.Mass { };
- // rotate inertia
myrot.X = _orientation.X;
myrot.Y = _orientation.Y;
myrot.Z = _orientation.Z;
myrot.W = _orientation.W;
-
d.RfromQ(out mymat, ref myrot);
- d.MassRotate(ref objdmass, ref mymat);
// set the body rotation
d.BodySetRotation(Body, ref mymat);
+ if(noInertiaOverride)
+ {
+ objdmass = primdMass;
+ d.MassRotate(ref objdmass, ref mymat);
+ }
+
// recompute full object inertia if needed
if (childrenPrim.Count > 0)
{
@@ -1758,27 +1863,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
continue;
}
- tmpdmass = prm.primdMass;
-
- // apply prim current rotation to inertia
quat.X = prm._orientation.X;
quat.Y = prm._orientation.Y;
quat.Z = prm._orientation.Z;
quat.W = prm._orientation.W;
d.RfromQ(out mat, ref quat);
- d.MassRotate(ref tmpdmass, ref mat);
-
- Vector3 ppos = prm._position;
- ppos.X -= rcm.X;
- ppos.Y -= rcm.Y;
- ppos.Z -= rcm.Z;
- // refer inertia to root prim center of mass position
- d.MassTranslate(ref tmpdmass,
- ppos.X,
- ppos.Y,
- ppos.Z);
-
- d.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia
+
// fix prim colision cats
if (d.GeomGetBody(prm.prim_geom) != IntPtr.Zero)
@@ -1791,6 +1881,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.GeomSetBody(prm.prim_geom, Body);
prm.Body = Body;
d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation
+
+ if(noInertiaOverride)
+ {
+ tmpdmass = prm.primdMass;
+
+ d.MassRotate(ref tmpdmass, ref mat);
+ Vector3 ppos = prm._position;
+ ppos.X -= rcm.X;
+ ppos.Y -= rcm.Y;
+ ppos.Z -= rcm.Z;
+ // refer inertia to root prim center of mass position
+ d.MassTranslate(ref tmpdmass,
+ ppos.X,
+ ppos.Y,
+ ppos.Z);
+
+ d.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia
+ }
}
}
}
@@ -1799,19 +1907,60 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// associate root geom with body
d.GeomSetBody(prim_geom, Body);
- d.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z);
+ if(noInertiaOverride)
+ d.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z);
+ else
+ {
+ Vector3 ncm = m_InertiaOverride.CenterOfMass * _orientation;
+ d.BodySetPosition(Body,
+ _position.X + ncm.X,
+ _position.Y + ncm.Y,
+ _position.Z + ncm.Z);
+ }
+
d.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z);
- d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
- myrot.X = -myrot.X;
- myrot.Y = -myrot.Y;
- myrot.Z = -myrot.Z;
+ if(noInertiaOverride)
+ {
+ d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
+ myrot.X = -myrot.X;
+ myrot.Y = -myrot.Y;
+ myrot.Z = -myrot.Z;
- d.RfromQ(out mymat, ref myrot);
- d.MassRotate(ref objdmass, ref mymat);
+ d.RfromQ(out mymat, ref myrot);
+ d.MassRotate(ref objdmass, ref mymat);
- d.BodySetMass(Body, ref objdmass);
- _mass = objdmass.mass;
+ d.BodySetMass(Body, ref objdmass);
+ m_mass = objdmass.mass;
+ }
+ else
+ {
+ objdmass.c.X = 0;
+ objdmass.c.Y = 0;
+ objdmass.c.Z = 0;
+
+ objdmass.I.M00 = m_InertiaOverride.Inertia.X;
+ objdmass.I.M11 = m_InertiaOverride.Inertia.Y;
+ objdmass.I.M22 = m_InertiaOverride.Inertia.Z;
+
+ objdmass.mass = m_InertiaOverride.TotalMass;
+
+ if(Math.Abs(m_InertiaOverride.InertiaRotation.W) < 0.999)
+ {
+ d.Matrix3 inertiarotmat = new d.Matrix3();
+ d.Quaternion inertiarot = new d.Quaternion();
+
+ inertiarot.X = m_InertiaOverride.InertiaRotation.X;
+ inertiarot.Y = m_InertiaOverride.InertiaRotation.Y;
+ inertiarot.Z = m_InertiaOverride.InertiaRotation.Z;
+ inertiarot.W = m_InertiaOverride.InertiaRotation.W;
+ d.RfromQ(out inertiarotmat, ref inertiarot);
+ d.MassRotate(ref objdmass, ref inertiarotmat);
+ }
+ d.BodySetMass(Body, ref objdmass);
+
+ m_mass = objdmass.mass;
+ }
// disconnect from world gravity so we can apply buoyancy
d.BodySetGravityMode(Body, false);
@@ -1990,7 +2139,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SetInStaticSpace(prm);
}
prm.Body = IntPtr.Zero;
- prm._mass = prm.primMass;
+ prm.m_mass = prm.primMass;
prm.m_collisionscore = 0;
}
}
@@ -2004,7 +2153,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
Body = IntPtr.Zero;
}
- _mass = primMass;
+ m_mass = primMass;
m_collisionscore = 0;
}
@@ -2081,7 +2230,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
d.BodySetMass(Body, ref objdmass);
- _mass = objdmass.mass;
+ m_mass = objdmass.mass;
}
private void FixInertia(Vector3 NewPos)
@@ -2145,7 +2294,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
d.BodySetMass(Body, ref objdmass);
- _mass = objdmass.mass;
+ m_mass = objdmass.mass;
}
private void FixInertia(Quaternion newrot)
@@ -2211,7 +2360,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z);
d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body
d.BodySetMass(Body, ref objdmass);
- _mass = objdmass.mass;
+ m_mass = objdmass.mass;
}
@@ -2226,7 +2375,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (primMass > _parent_scene.maximumMassObject)
primMass = _parent_scene.maximumMassObject;
- _mass = primMass; // just in case
+ m_mass = primMass; // just in case
d.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z);
@@ -3306,6 +3455,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_useHoverPID = active;
}
+ private void changeInertia(PhysicsInertiaData inertia)
+ {
+ m_InertiaOverride = inertia;
+
+ if (Body != IntPtr.Zero)
+ DestroyBody();
+ MakeBody();
+ }
+
#endregion
public void Move()
@@ -3346,7 +3504,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
float fy = 0;
float fz = 0;
- float m_mass = _mass;
+ float mass = m_mass;
if (m_usePID && m_PIDTau > 0)
{
@@ -3453,9 +3611,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
fz = _parent_scene.gravityz * b;
}
- fx *= m_mass;
- fy *= m_mass;
- fz *= m_mass;
+ fx *= mass;
+ fy *= mass;
+ fz *= mass;
// constant force
fx += m_force.X;
@@ -3941,6 +4099,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
changePIDHoverActive((bool)arg);
break;
+ case changes.SetInertia:
+ changeInertia((PhysicsInertiaData) arg);
+ break;
+
case changes.Null:
donullchange();
break;
@@ -3957,7 +4119,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
_parent_scene.AddChange((PhysicsActor) this, what, arg);
}
-
private struct strVehicleBoolParam
{
public int param;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4c3f7ee..6c094ee 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4404,5 +4404,218 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.ScriptSetVolumeDetect(detect != 0);
}
+ ///
+ /// Get inertial data
+ ///
+ ///
+ ///
+ ///
+ /// a LSL list with contents:
+ /// LSL_Float mass, the total mass of a linkset
+ /// LSL_Vector CenterOfMass, center mass relative to root prim
+ /// LSL_Vector Inertia, elements of diagonal of inertia Ixx,Iyy,Izz divided by total mass
+ /// LSL_Vector aux, elements of upper triagle of inertia Ixy (= Iyx), Ixz (= Izx), Iyz(= Izy) divided by total mass
+ ///
+ public LSL_List osGetInertiaData()
+ {
+ LSL_List result = new LSL_List();
+ float TotalMass;
+ Vector3 CenterOfMass;
+ Vector3 Inertia;
+ Vector4 aux;
+
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return result;
+
+ sog.GetInertiaData(out TotalMass, out CenterOfMass, out Inertia, out aux );
+ if(TotalMass > 0)
+ {
+ float t = 1.0f/TotalMass;
+ Inertia.X *= t;
+ Inertia.Y *= t;
+ Inertia.Z *= t;
+
+ aux.X *= t;
+ aux.Y *= t;
+ aux.Z *= t;
+ }
+
+ result.Add(new LSL_Float(TotalMass));
+ result.Add(new LSL_Vector(CenterOfMass.X, CenterOfMass.Y, CenterOfMass.Z));
+ result.Add(new LSL_Vector(Inertia.X, Inertia.Y, Inertia.Z));
+ result.Add(new LSL_Vector(aux.X, aux.Y, aux.Z));
+ return result;
+ }
+
+ ///
+ /// set inertial data
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// location of center of mass relative to root prim in local coords
+ /// moment of inertia relative to principal axis and center of mass,Ixx, Iyy, Izz divided by mass
+ /// rotation of the inertia, relative to local axis
+ ///
+ /// the inertia argument is is inertia divided by mass, so corresponds only to the geometric distribution of mass and both can be changed independently.
+ ///
+
+ public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0 || principalInertiaScaled.x < 0 || principalInertiaScaled.y < 0 || principalInertiaScaled.z < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float m = (float)mass;
+
+ Inertia.X = m * (float)principalInertiaScaled.x;
+ Inertia.Y = m * (float)principalInertiaScaled.y;
+ Inertia.Z = m * (float)principalInertiaScaled.z;
+
+ Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.y, (float)lslrot.s);
+ rot.Normalize();
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, rot );
+ }
+
+ ///
+ /// set inertial data as a sphere
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// size of the Box
+ /// location of center of mass relative to root prim in local coords
+ /// rotation of the box, and so inertia, relative to local axis
+ ///
+ ///
+ public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float lx = (float)boxSize.x;
+ float ly = (float)boxSize.y;
+ float lz = (float)boxSize.z;
+ float m = (float)mass;
+ float t = m / 12.0f;
+
+ Inertia.X = t * (ly*ly + lz*lz);
+ Inertia.Y = t * (lx*lx + lz*lz);
+ Inertia.Z = t * (lx*lx + ly*ly);
+
+ Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.z, (float)lslrot.s);
+ rot.Normalize();
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, rot );
+ }
+
+ ///
+ /// set inertial data as a sphere
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// radius of the sphere
+ /// location of center of mass relative to root prim in local coords
+ ///
+ ///
+ public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float r = (float)radius;
+ float m = (float)mass;
+ float t = 0.4f * m * r * r;
+
+ Inertia.X = t;
+ Inertia.Y = t;
+ Inertia.Z = t;
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, new Vector4(0f, 0f, 0f,1.0f));
+ }
+
+ ///
+ /// set inertial data as a cylinder
+ /// replaces the automatic calculation of mass, center of mass and inertia
+ ///
+ ///
+ /// total mass of linkset
+ /// radius of the cylinder
+ /// lenght of the cylinder
+ /// location of center of mass relative to root prim in local coords
+ /// rotation of the cylinder, and so inertia, relative to local axis
+ ///
+ /// cylinder axis aligned with Z axis. For other orientations provide the rotation.
+ ///
+ public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ if(mass < 0)
+ return;
+
+ // need more checks
+
+ Vector3 CenterOfMass = new Vector3((float)centerOfMass.x,(float)centerOfMass.y,(float)centerOfMass.z);
+ Vector3 Inertia;
+ float m = (float)mass;
+ float r = (float)radius;
+ r *= r;
+ Inertia.Z = 0.5f * m * r;
+ float t = (float)lenght;
+ t *= t;
+ t += 3.0f * r;
+ t *= 8.333333e-2f * m;
+
+ Inertia.X = t;
+ Inertia.Y = t;
+
+ Vector4 rot = new Vector4((float)lslrot.x, (float)lslrot.y, (float)lslrot.z, (float)lslrot.s);
+ rot.Normalize();
+
+ sog.SetInertiaData(m, CenterOfMass, Inertia, rot);
+ }
+
+ ///
+ /// removes inertial data manual override
+ /// default automatic calculation is used again
+ ///
+ ///
+ public void osClearInertia()
+ {
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero );
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index bee060a..f76ff7f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -38,6 +38,7 @@ using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
+
namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
{
///
@@ -486,6 +487,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String osRequestURL(LSL_List options);
LSL_String osRequestSecureURL(LSL_List options);
void osCollisionSound(string impact_sound, double impact_volume);
+
void osVolumeDetect(int detect);
+
+ LSL_List osGetInertiaData();
+ void osClearInertia();
+ void osSetInertiaAsBox(LSL_Float mass, vector boxSize, vector centerOfMass, rotation rot);
+ void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass);
+ void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 6164734..09337e5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1114,5 +1114,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osVolumeDetect(detect);
}
+
+ public LSL_List osGetInertiaData()
+ {
+ return m_OSSL_Functions.osGetInertiaData();
+ }
+
+ public void osSetInertiaAsBox(LSL_Float mass, vector boxSize, vector centerOfMass, rotation rot)
+ {
+ m_OSSL_Functions.osSetInertiaAsBox(mass, boxSize, centerOfMass, rot);
+ }
+
+ public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass)
+ {
+ m_OSSL_Functions.osSetInertiaAsSphere(mass, radius, centerOfMass);
+ }
+
+ public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot)
+ {
+ m_OSSL_Functions.osSetInertiaAsCylinder( mass, radius, lenght, centerOfMass, lslrot);
+ }
+
+ public void osClearInertia()
+ {
+ m_OSSL_Functions.osClearInertia();
+ }
+
}
}
--
cgit v1.1
From 24b7903cd02a2d86cdf535f86b093af0a63c99a2 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 31 Mar 2017 21:03:18 +0100
Subject: add missing file. Changes of inertia data of objects running does
not produce correct physical results, namely linear and angular momentum
are not conserved.
---
OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index bed66cc..6279d6a 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -155,6 +155,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
VehicleRotationParam,
VehicleFlags,
SetVehicle,
+ SetInertia,
Null //keep this last used do dim the methods array. does nothing but pulsing the prim
}
@@ -502,7 +503,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.WorldSetGravity(world, gravityx, gravityy, gravityz);
- d.WorldSetLinearDamping(world, 0.002f);
+ d.WorldSetLinearDamping(world, 0.001f);
d.WorldSetAngularDamping(world, 0.002f);
d.WorldSetAngularDampingThreshold(world, 0f);
d.WorldSetLinearDampingThreshold(world, 0f);
--
cgit v1.1
From 443fc60cdf399a49832e787ca58c2644bef7e457 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 1 Apr 2017 17:49:17 +0100
Subject: store the physics inertia override in Mysql and add it to
serializer. run prebuild is required
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 20 ++++++++++---------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 21 +++++++++++++++++++-
.../Scenes/Serialization/SceneObjectSerializer.cs | 23 +++++++++++++++++++++-
.../PhysicsModules/SharedBase/PhysicsActor.cs | 22 ---------------------
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 3 ---
5 files changed, 53 insertions(+), 36 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 77658ef..719a5dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -5037,20 +5037,22 @@ namespace OpenSim.Region.Framework.Scenes
public void SetInertiaData(float TotalMass, Vector3 CenterOfMass, Vector3 Inertia, Vector4 aux )
{
- PhysicsActor pa = RootPart.PhysActor;
+ PhysicsInertiaData inertia = new PhysicsInertiaData();
+ inertia.TotalMass = TotalMass;
+ inertia.CenterOfMass = CenterOfMass;
+ inertia.Inertia = Inertia;
+ inertia.InertiaRotation = aux;
+
+ if(TotalMass < 0)
+ RootPart.PhysicsInertia = null;
+ else
+ RootPart.PhysicsInertia = new PhysicsInertiaData(inertia);
+ PhysicsActor pa = RootPart.PhysActor;
if(pa !=null)
- {
- PhysicsInertiaData inertia = new PhysicsInertiaData();
- inertia.TotalMass = TotalMass;
- inertia.CenterOfMass = CenterOfMass;
- inertia.Inertia = Inertia;
- inertia.InertiaRotation = aux;
pa.SetInertiaData(inertia);
- }
}
-
///
/// Set the user group to which this scene object belongs.
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index bf0e31b..46b7b86 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -406,6 +406,8 @@ namespace OpenSim.Region.Framework.Scenes
private SOPVehicle m_vehicleParams = null;
+ private PhysicsInertiaData m_physicsInertia;
+
public KeyframeMotion KeyframeMotion
{
get; set;
@@ -3548,6 +3550,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
Force = force;
}
+ public PhysicsInertiaData PhysicsInertia
+ {
+ get
+ {
+ return m_physicsInertia;
+ }
+ set
+ {
+ m_physicsInertia = value;
+ }
+ }
+
public SOPVehicle VehicleParams
{
get
@@ -4748,8 +4762,13 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
if (VolumeDetectActive) // change if not the default only
pa.SetVolumeDetect(1);
+
+ bool isroot = (m_localId == ParentGroup.RootPart.LocalId);
+
+ if(isroot && m_physicsInertia != null)
+ pa.SetInertiaData(m_physicsInertia);
- if (m_vehicleParams != null && m_localId == ParentGroup.RootPart.LocalId)
+ if (isroot && m_vehicleParams != null )
{
m_vehicleParams.SetVehicle(pa);
if(isPhysical && !isPhantom && m_vehicleParams.CameraDecoupled)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index a12a401..87d1ace 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -453,9 +453,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("Torque", ProcessTorque);
m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
-
m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
+ m_SOPXmlProcessors.Add("PhysicsInertia", ProcessPhysicsInertia);
+
m_SOPXmlProcessors.Add("RotationAxisLocks", ProcessRotationAxisLocks);
m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
m_SOPXmlProcessors.Add("Density", ProcessDensity);
@@ -781,6 +782,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
+ private static void ProcessPhysicsInertia(SceneObjectPart obj, XmlReader reader)
+ {
+ PhysicsInertiaData pdata = PhysicsInertiaData.FromXml2(reader);
+
+ if (pdata == null)
+ {
+ obj.PhysicsInertia = null;
+ m_log.DebugFormat(
+ "[SceneObjectSerializer]: Parsing PhysicsInertiaData for object part {0} {1} encountered errors. Please see earlier log entries.",
+ obj.Name, obj.UUID);
+ }
+ else
+ {
+ obj.PhysicsInertia = pdata;
+ }
+ }
+
private static void ProcessShape(SceneObjectPart obj, XmlReader reader)
{
List errorNodeNames;
@@ -1498,6 +1516,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (sop.VehicleParams != null)
sop.VehicleParams.ToXml2(writer);
+ if (sop.PhysicsInertia != null)
+ sop.PhysicsInertia.ToXml2(writer);
+
if(sop.RotationAxisLocks != 0)
writer.WriteElementString("RotationAxisLocks", sop.RotationAxisLocks.ToString().ToLower());
writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index ad9b28f..d23d9c1 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -55,28 +55,6 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
Absolute
}
- public class PhysicsInertiaData
- {
- public float TotalMass; // the total mass of a linkset
- public Vector3 CenterOfMass; // the center of mass position relative to root part position
- public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords
- public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation
- // or the upper triangle of the inertia tensor
- // Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy))
-
- public PhysicsInertiaData()
- {
- }
-
- public PhysicsInertiaData(PhysicsInertiaData source)
- {
- TotalMass = source.TotalMass;
- CenterOfMass = source.CenterOfMass;
- Inertia = source.Inertia;
- InertiaRotation = source.InertiaRotation;
- }
- }
-
public struct CameraData
{
public Quaternion CameraRotation;
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index d560b41..f784990 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -568,9 +568,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
get
{
- if(!childPrim && m_fakeInertiaOverride != null)
- return m_fakeInertiaOverride.CenterOfMass;
-
lock (_parent_scene.OdeLock)
{
d.AllocateODEDataForThread(0);
--
cgit v1.1
From eb11505d19be8c2b22776d927ac5b836bd5493c3 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 3 Apr 2017 16:10:05 +0100
Subject: add bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject
land) permissions check
---
.../World/Permissions/PermissionsModule.cs | 52 ++++++++++++++++++++++
.../Region/Framework/Scenes/Scene.Permissions.cs | 17 +++++++
.../PrimLimitsModule/PrimLimitsModule.cs | 22 +++++++++
3 files changed, 91 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index ab8fb51..8eee864 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -286,6 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnRezObject += CanRezObject;
scenePermissions.OnObjectEntry += CanObjectEntry;
+ scenePermissions.OnObjectEnterWithScripts += OnObjectEnterWithScripts;
scenePermissions.OnDuplicateObject += CanDuplicateObject;
scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
@@ -381,6 +382,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnRezObject -= CanRezObject;
scenePermissions.OnObjectEntry -= CanObjectEntry;
+ scenePermissions.OnObjectEnterWithScripts -= OnObjectEnterWithScripts;
+
scenePermissions.OnReturnObjects -= CanReturnObjects;
scenePermissions.OnDuplicateObject -= CanDuplicateObject;
@@ -1627,6 +1630,55 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false;
}
+ private bool OnObjectEnterWithScripts(SceneObjectGroup sog, ILandObject parcel)
+ {
+ DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
+
+ if(sog == null || sog.IsDeleted)
+ return false;
+
+ if (m_bypassPermissions)
+ return m_bypassPermissionsValue;
+
+ if (parcel == null)
+ return true;
+
+ int checkflags = ((int)ParcelFlags.AllowAPrimitiveEntry);
+ bool scripts = (sog.ScriptCount() > 0);
+ if(scripts)
+ checkflags |= ((int)ParcelFlags.AllowOtherScripts);
+
+ if ((parcel.LandData.Flags & checkflags) == checkflags)
+ return true;
+
+ UUID userID = sog.OwnerID;
+ LandData landdata = parcel.LandData;
+
+ if (landdata.OwnerID == userID)
+ return true;
+
+ if (IsAdministrator(userID))
+ return true;
+
+ UUID landGroupID = landdata.GroupID;
+ if (landGroupID != UUID.Zero)
+ {
+ checkflags = (int)ParcelFlags.AllowGroupObjectEntry;
+ if(scripts)
+ checkflags |= ((int)ParcelFlags.AllowGroupScripts);
+
+ if ((parcel.LandData.Flags & checkflags) == checkflags)
+ return IsGroupMember(landGroupID, userID, 0);
+
+ if (landdata.IsGroupOwned && IsGroupMember(landGroupID, userID, (ulong)GroupPowers.AllowRez))
+ return true;
+ }
+
+ //Otherwise, false!
+ return false;
+ }
+
+
private bool CanReturnObjects(ILandObject land, ScenePresence sp, List objects)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 7d69a9b..c55a7a6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
+ public delegate bool ObjectEnterWithScriptsHandler(SceneObjectGroup sog, ILandObject land);
public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List objects);
public delegate bool InstantMessageHandler(UUID user, UUID target);
public delegate bool InventoryTransferHandler(UUID user, UUID target);
@@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
public event EditObjectInventoryHandler OnEditObjectInventory;
public event MoveObjectHandler OnMoveObject;
public event ObjectEntryHandler OnObjectEntry;
+ public event ObjectEnterWithScriptsHandler OnObjectEnterWithScripts;
public event ReturnObjectsHandler OnReturnObjects;
public event InstantMessageHandler OnInstantMessage;
public event InventoryTransferHandler OnInventoryTransfer;
@@ -565,6 +567,21 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
+ public bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land)
+ {
+ ObjectEnterWithScriptsHandler handler = OnObjectEnterWithScripts;
+ if (handler != null)
+ {
+ Delegate[] list = handler.GetInvocationList();
+ foreach (ObjectEnterWithScriptsHandler h in list)
+ {
+ if (h(sog, land) == false)
+ return false;
+ }
+ }
+ return true;
+ }
+
#endregion
#region RETURN OBJECT
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
index af32d05..61b6d68 100644
--- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
+++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs
@@ -83,6 +83,7 @@ namespace OpenSim.Region.OptionalModules
m_scene = scene;
scene.Permissions.OnRezObject += CanRezObject;
scene.Permissions.OnObjectEntry += CanObjectEnter;
+ scene.Permissions.OnObjectEnterWithScripts += CanObjectEnterWithScripts;
scene.Permissions.OnDuplicateObject += CanDuplicateObject;
m_log.DebugFormat("[PRIM LIMITS]: Region {0} added", scene.RegionInfo.RegionName);
@@ -95,6 +96,7 @@ namespace OpenSim.Region.OptionalModules
m_scene.Permissions.OnRezObject -= CanRezObject;
m_scene.Permissions.OnObjectEntry -= CanObjectEnter;
+ scene.Permissions.OnObjectEnterWithScripts -= CanObjectEnterWithScripts;
m_scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
}
@@ -173,6 +175,26 @@ namespace OpenSim.Region.OptionalModules
return true;
}
+ private bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject newParcel)
+ {
+ if (sog == null)
+ return false;
+
+ if (newParcel == null)
+ return true;
+
+ int objectCount = sog.PrimCount;
+
+ // TODO: Add Special Case here for temporary prims
+
+ string response = DoCommonChecks(objectCount, sog.OwnerID, newParcel);
+
+ if (response != null)
+ return false;
+
+ return true;
+ }
+
private string DoCommonChecks(int objectCount, UUID ownerID, ILandObject lo)
{
string response = null;
--
cgit v1.1
From 2bb5e985740b7c6aa75cd31aa057d39d56f024b6 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 3 Apr 2017 17:19:28 +0100
Subject: add EXPERIMENTAL osObjectTeleport(LSL_Key objectUUID, LSL_Vector
targetPos, LSL_Rotation rotation, LSL_Integer stop)
---
OpenSim/Region/Framework/Scenes/Scene.cs | 31 ++++++--
.../Region/Framework/Scenes/SceneObjectGroup.cs | 85 ++++++++++++++++++++++
.../Shared/Api/Implementation/OSSL_Api.cs | 46 ++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 +
5 files changed, 161 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c5b082c..3b9f551 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -808,6 +808,8 @@ namespace OpenSim.Region.Framework.Scenes
private float m_minReprioritizationDistance = 32f;
public bool ObjectsCullingByDistance = false;
+ private ExpiringCache TeleportTargetsCoolDown = new ExpiringCache();
+
public AgentCircuitManager AuthenticateHandler
{
get { return m_authenticateHandler; }
@@ -2983,15 +2985,14 @@ namespace OpenSim.Region.Framework.Scenes
// Return 'true' if position inside region.
public bool PositionIsInCurrentRegion(Vector3 pos)
{
- bool ret = false;
- int xx = (int)Math.Floor(pos.X);
- int yy = (int)Math.Floor(pos.Y);
- if (xx < 0 || yy < 0)
+ int xx = (int)pos.X;
+ if (xx < 0 || xx >= RegionInfo.RegionSizeX)
return false;
- if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
- ret = true;
- return ret;
+ int yy = (int)pos.Y;
+ if (yy < 0 || yy >= RegionInfo.RegionSizeX)
+ return false;
+ return true;
}
///
@@ -6526,5 +6527,21 @@ Environment.Exit(1);
m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty);
}
+
+ public bool InTeleportTargetsCoolDown(UUID sourceID, UUID targetID, double timeout)
+ {
+ lock(TeleportTargetsCoolDown)
+ {
+ UUID lastSource = UUID.Zero;
+ TeleportTargetsCoolDown.TryGetValue(targetID, out lastSource);
+ if(lastSource == UUID.Zero)
+ {
+ TeleportTargetsCoolDown.Add(targetID, sourceID, timeout);
+ return false;
+ }
+ TeleportTargetsCoolDown.AddOrUpdate(targetID, sourceID, timeout);
+ return lastSource == sourceID;
+ }
+ }
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 719a5dd..402e5f7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -853,6 +853,91 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
}
*/
+ public void ObjectTeleport(UUID sourceID, Vector3 targetPosition, Quaternion rotation, bool stop)
+ {
+ if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null)
+ return;
+
+ inTransit = true;
+
+ PhysicsActor pa = RootPart.PhysActor;
+ if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/)
+ {
+ inTransit = false;
+ return;
+ }
+
+ if(Scene.PositionIsInCurrentRegion(targetPosition))
+ {
+ if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0))
+ {
+ inTransit = false;
+ return;
+ }
+
+ Vector3 curPos = AbsolutePosition;
+ ILandObject curLand = Scene.LandChannel.GetLandObject(curPos.X, curPos.Y);
+ float posX = targetPosition.X;
+ float posY = targetPosition.Y;
+ ILandObject land = Scene.LandChannel.GetLandObject(posX, posY);
+ if(land != null && land != curLand)
+ {
+ if(!Scene.Permissions.CanObjectEnterWithScripts(this, land))
+ {
+ inTransit = false;
+ return;
+ }
+
+ UUID agentID;
+ foreach (ScenePresence av in m_sittingAvatars)
+ {
+ agentID = av.UUID;
+ if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID))
+ {
+ inTransit = false;
+ return;
+ }
+ }
+ }
+
+ if(stop)
+ RootPart.Stop();
+ else
+ {
+ rotation.Normalize();
+ if(Math.Abs(rotation.W) < 0.999)
+ {
+ Quaternion rot = RootPart.RotationOffset;
+ Vector3 vel = RootPart.Velocity;
+ Vector3 avel = RootPart.AngularVelocity;
+ Vector3 acc = RootPart.Acceleration;
+
+ rot *= rotation;
+ vel *= rotation;
+ avel *= rotation;
+ acc *= rotation;
+
+ RootPart.RotationOffset = rot;
+ RootPart.Velocity = vel;
+ RootPart.AngularVelocity = avel;
+ RootPart.Acceleration = acc;
+ }
+ }
+
+ Vector3 s = RootPart.Scale * RootPart.RotationOffset;
+ float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f;
+ if(targetPosition.Z < h)
+ targetPosition.Z = h;
+
+ inTransit = false;
+ AbsolutePosition = targetPosition;
+ RootPart.ScheduleTerseUpdate();
+ return;
+ }
+
+ inTransit = false;
+ }
+
public override Vector3 Velocity
{
get { return RootPart.Velocity; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6c094ee..ddf5078 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4418,6 +4418,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List osGetInertiaData()
{
+ m_host.AddScriptLPS(1);
+
LSL_List result = new LSL_List();
float TotalMass;
Vector3 CenterOfMass;
@@ -4463,6 +4465,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4499,6 +4502,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4538,6 +4543,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4575,6 +4581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4611,11 +4618,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osClearInertia()
{
+ m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
sog.SetInertiaData(-1, Vector3.Zero, Vector3.Zero, Vector4.Zero );
}
+
+ ///
+ /// teleports a object (full linkset)
+ ///
+ /// the id of the linkset to teleport
+ /// target position
+ /// a rotation to apply
+ /// if TRUE (!=0) stop at destination
+ ///
+ /// only does teleport local to region
+ /// object owner must have rights to run scripts on target location
+ /// object owner must have rights to enter ojects on target location
+ /// target location parcel must have enought free prims capacity for the linkset prims
+ /// all avatars siting on the object must have access to target location
+ /// has a cool down time. retries before expire reset it
+ /// fail conditions are silent ignored
+ ///
+ public void osObjectTeleport(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer stop)
+ {
+ CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
+ m_host.AddScriptLPS(1);
+
+ UUID objUUID;
+ if (!UUID.TryParse(objectUUID, out objUUID))
+ {
+ OSSLShoutError("osObjectTeleport() invalid object Key");
+ return;
+ }
+
+ SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID);
+ if(sog== null || sog.IsDeleted)
+ return;
+
+ UUID myid = m_host.ParentGroup.UUID;
+
+ sog.ObjectTeleport(myid, targetPos, rotation, stop != 0);
+ // a delay here may break vehicles
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index f76ff7f..4722fed 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -495,5 +495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetInertiaAsBox(LSL_Float mass, vector boxSize, vector centerOfMass, rotation rot);
void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass);
void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot);
+
+ void osObjectTeleport(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer stop);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 09337e5..37e7a17 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1140,5 +1140,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osClearInertia();
}
+ public void osObjectTeleport(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer stop)
+ {
+ m_OSSL_Functions.osObjectTeleport(objectUUID, targetPos, targetrotation, stop);
+ }
}
}
--
cgit v1.1
From 1264069b412822cd50a080576460d5dd8c165017 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 3 Apr 2017 17:29:02 +0100
Subject: fix typo
---
OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3b9f551..0fb62a4 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2990,8 +2990,9 @@ namespace OpenSim.Region.Framework.Scenes
return false;
int yy = (int)pos.Y;
- if (yy < 0 || yy >= RegionInfo.RegionSizeX)
+ if (yy < 0 || yy >= RegionInfo.RegionSizeY)
return false;
+
return true;
}
--
cgit v1.1
From 4bb27917f4c4caf8eece794b80d5cf89e5e1398c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 3 Apr 2017 18:09:48 +0100
Subject: oops
---
OpenSim/Region/Framework/Scenes/Scene.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0fb62a4..715ae5c 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2985,12 +2985,12 @@ namespace OpenSim.Region.Framework.Scenes
// Return 'true' if position inside region.
public bool PositionIsInCurrentRegion(Vector3 pos)
{
- int xx = (int)pos.X;
- if (xx < 0 || xx >= RegionInfo.RegionSizeX)
+ float t = pos.X;
+ if (t < 0 || t >= RegionInfo.RegionSizeX)
return false;
- int yy = (int)pos.Y;
- if (yy < 0 || yy >= RegionInfo.RegionSizeY)
+ t = pos.Y;
+ if (t < 0 || t >= RegionInfo.RegionSizeY)
return false;
return true;
--
cgit v1.1
From c6150c206618fe50a45bd8673e010f862147daba Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 00:30:19 +0100
Subject: mantis 8140: fix objectTeleport rotation if stop TRUE
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 402e5f7..24cdc7a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -900,11 +900,19 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ rotation.Normalize();
if(stop)
+ {
RootPart.Stop();
+ if(Math.Abs(rotation.W) < 0.999)
+ {
+ Quaternion rot = RootPart.RotationOffset;
+ rot *= rotation;
+ RootPart.RotationOffset = rot;
+ }
+ }
else
{
- rotation.Normalize();
if(Math.Abs(rotation.W) < 0.999)
{
Quaternion rot = RootPart.RotationOffset;
--
cgit v1.1
From 056b765fbc17b2702ca35c9211144db881f7b9e3 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 12:38:23 +0100
Subject: mantis 8130: improve keyframes motion
---
OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 133 ++++++++++------------
1 file changed, 63 insertions(+), 70 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index e4aa196..d81d8a2 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -495,6 +495,7 @@ namespace OpenSim.Region.Framework.Scenes
m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.AngularVelocity = Vector3.Zero;
+ m_skippedUpdates = 1000;
m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
}
@@ -517,6 +518,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
if (m_running && !m_waitingCrossing)
StartTimer();
+ m_skippedUpdates = 1000;
}
}
@@ -643,10 +645,15 @@ namespace OpenSim.Region.Framework.Scenes
m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.AngularVelocity = Vector3.Zero;
m_group.SendGroupRootTerseUpdate();
- // m_group.RootPart.ScheduleTerseUpdate();
+
m_frames.Clear();
}
+ Vector3 m_lastPosUpdate;
+ Quaternion m_lastRotationUpdate;
+ Vector3 m_currentVel;
+ int m_skippedUpdates;
+
private void DoOnTimer(double tickDuration)
{
if (m_skipLoops > 0)
@@ -665,6 +672,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_group.RootPart.Velocity != Vector3.Zero)
{
m_group.RootPart.Velocity = Vector3.Zero;
+ m_skippedUpdates = 1000;
m_group.SendGroupRootTerseUpdate();
}
return;
@@ -677,7 +685,9 @@ namespace OpenSim.Region.Framework.Scenes
// retry to set the position that evtually caused the outbound
// if still outside region this will call startCrossing below
m_isCrossing = false;
+ m_skippedUpdates = 1000;
m_group.AbsolutePosition = m_nextPosition;
+
if (!m_isCrossing)
{
StopTimer();
@@ -700,10 +710,12 @@ namespace OpenSim.Region.Framework.Scenes
}
m_currentFrame = m_frames[0];
- m_currentFrame.TimeMS += (int)tickDuration;
}
- //force a update on a keyframe transition
m_nextPosition = m_group.AbsolutePosition;
+ m_currentVel = (Vector3)m_currentFrame.Position - m_nextPosition;
+ m_currentVel /= (m_currentFrame.TimeMS * 0.001f);
+
+ m_currentFrame.TimeMS += (int)tickDuration;
update = true;
}
@@ -712,7 +724,7 @@ namespace OpenSim.Region.Framework.Scenes
// Do the frame processing
double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration;
- if (remainingSteps <= 0.0)
+ if (remainingSteps <= 1.0)
{
m_group.RootPart.Velocity = Vector3.Zero;
m_group.RootPart.AngularVelocity = Vector3.Zero;
@@ -720,92 +732,71 @@ namespace OpenSim.Region.Framework.Scenes
m_nextPosition = (Vector3)m_currentFrame.Position;
m_group.AbsolutePosition = m_nextPosition;
- // we are sending imediate updates, no doing force a extra terseUpdate
- // m_group.UpdateGroupRotationR((Quaternion)m_currentFrame.Rotation);
-
m_group.RootPart.RotationOffset = (Quaternion)m_currentFrame.Rotation;
lock (m_frames)
{
m_frames.RemoveAt(0);
if (m_frames.Count > 0)
+ {
m_currentFrame = m_frames[0];
+ m_currentVel = (Vector3)m_currentFrame.Position - m_nextPosition;
+ m_currentVel /= (m_currentFrame.TimeMS * 0.001f);
+ m_group.RootPart.Velocity = m_currentVel;
+ m_currentFrame.TimeMS += (int)tickDuration;
+ }
+ else
+ m_group.RootPart.Velocity = Vector3.Zero;
}
-
update = true;
}
else
{
- float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
- bool lastStep = m_currentFrame.TimeMS <= tickDuration;
-
- Vector3 v = (Vector3)m_currentFrame.Position - m_group.AbsolutePosition;
- Vector3 motionThisFrame = v / (float)remainingSteps;
- v = v * 1000 / m_currentFrame.TimeMS;
+ bool lastSteps = remainingSteps < 4;
+ Vector3 currentPosition = m_group.AbsolutePosition;
+ Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition;
+ motionThisFrame /= (float)remainingSteps;
+
+ m_nextPosition = currentPosition + motionThisFrame;
- m_nextPosition = m_group.AbsolutePosition + motionThisFrame;
-
- if (Vector3.Mag(motionThisFrame) >= 0.05f)
- update = true;
-
- //int totalSteps = m_currentFrame.TimeTotal / (int)tickDuration;
- //m_log.DebugFormat("KeyframeMotion.OnTimer: step {0}/{1}, curPosition={2}, finalPosition={3}, motionThisStep={4} (scene {5})",
- // totalSteps - remainingSteps + 1, totalSteps, m_group.AbsolutePosition, m_currentFrame.Position, motionThisStep, m_scene.RegionInfo.RegionName);
-
- if ((Quaternion)m_currentFrame.Rotation != m_group.GroupRotation)
+ Quaternion currentRotation = m_group.GroupRotation;
+ if ((Quaternion)m_currentFrame.Rotation != currentRotation)
{
- Quaternion current = m_group.GroupRotation;
-
+ float completed = ((float)m_currentFrame.TimeTotal - (float)m_currentFrame.TimeMS) / (float)m_currentFrame.TimeTotal;
Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed);
step.Normalize();
- /* use simpler change detection
- * float angle = 0;
-
- float aa = current.X * current.X + current.Y * current.Y + current.Z * current.Z + current.W * current.W;
- float bb = step.X * step.X + step.Y * step.Y + step.Z * step.Z + step.W * step.W;
- float aa_bb = aa * bb;
-
- if (aa_bb == 0)
- {
- angle = 0;
- }
- else
- {
- float ab = current.X * step.X +
- current.Y * step.Y +
- current.Z * step.Z +
- current.W * step.W;
- float q = (ab * ab) / aa_bb;
-
- if (q > 1.0f)
- {
- angle = 0;
- }
- else
- {
- angle = (float)Math.Acos(2 * q - 1);
- }
- }
-
- if (angle > 0.01f)
- */
- if (Math.Abs(step.X - current.X) > 0.001f
- || Math.Abs(step.Y - current.Y) > 0.001f
- || Math.Abs(step.Z - current.Z) > 0.001f)
- // assuming w is a dependente var
- {
-// m_group.UpdateGroupRotationR(step);
- m_group.RootPart.RotationOffset = step;
-
- //m_group.RootPart.UpdateAngularVelocity(m_currentFrame.AngularVelocity / 2);
+ m_group.RootPart.RotationOffset = step;
+ if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f
+ || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f
+ || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f)
update = true;
- }
}
- }
- if (update)
- {
m_group.AbsolutePosition = m_nextPosition;
+ if(lastSteps)
+ m_group.RootPart.Velocity = Vector3.Zero;
+ else
+ m_group.RootPart.Velocity = m_currentVel;
+
+ if(!update && (
+ lastSteps ||
+ m_skippedUpdates * tickDuration > 0.5 ||
+ Math.Abs(m_nextPosition.X - currentPosition.X) > 5f ||
+ Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f ||
+ Math.Abs(m_nextPosition.Z - currentPosition.Z) > 5f
+ ))
+ {
+ update = true;
+ }
+ else
+ m_skippedUpdates++;
+
+ }
+ if(update)
+ {
+ m_lastPosUpdate = m_nextPosition;
+ m_lastRotationUpdate = m_group.GroupRotation;
+ m_skippedUpdates = 0;
m_group.SendGroupRootTerseUpdate();
}
}
@@ -850,6 +841,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_group.RootPart.Velocity != Vector3.Zero)
{
m_group.RootPart.Velocity = Vector3.Zero;
+ m_skippedUpdates = 1000;
m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
}
@@ -862,6 +854,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_group != null)
{
m_group.RootPart.Velocity = Vector3.Zero;
+ m_skippedUpdates = 1000;
m_group.SendGroupRootTerseUpdate();
// m_group.RootPart.ScheduleTerseUpdate();
--
cgit v1.1
From ca250e0b0b564efaaeb5c0b80760126cfd710c5e Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 14:34:25 +0100
Subject: mantis 8740: rename osObjectTeleport as osTeleportObject, replaced
the stop parameter by flags, add flags OSTPOBJ_STOPATTARRGET and
OSTPOBJ_SETROT
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 34 +++++++++++++++-------
.../Shared/Api/Implementation/OSSL_Api.cs | 8 ++---
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +-
.../Shared/Api/Runtime/LSL_Constants.cs | 7 +++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 +--
5 files changed, 37 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 24cdc7a..a0d7bfd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -853,7 +853,13 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
}
*/
- public void ObjectTeleport(UUID sourceID, Vector3 targetPosition, Quaternion rotation, bool stop)
+
+ // copy from LSL_constants.cs
+ const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination
+ const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails
+ const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation
+
+ public void TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags)
{
if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null)
return;
@@ -900,38 +906,44 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ bool stop = (flags & OSTPOBJ_STOPATTARRGET) != 0;
+ bool setrot = (flags & OSTPOBJ_SETROT) != 0;
+
rotation.Normalize();
+ bool dorot = (Math.Abs(rotation.W) < 0.999);
+
+ Quaternion currentRot = RootPart.RotationOffset;
+ if(dorot && setrot)
+ rotation = rotation * Quaternion.Conjugate(currentRot);
+
if(stop)
{
RootPart.Stop();
- if(Math.Abs(rotation.W) < 0.999)
- {
- Quaternion rot = RootPart.RotationOffset;
- rot *= rotation;
- RootPart.RotationOffset = rot;
- }
}
else
{
- if(Math.Abs(rotation.W) < 0.999)
+ if(dorot)
{
- Quaternion rot = RootPart.RotationOffset;
Vector3 vel = RootPart.Velocity;
Vector3 avel = RootPart.AngularVelocity;
Vector3 acc = RootPart.Acceleration;
- rot *= rotation;
vel *= rotation;
avel *= rotation;
acc *= rotation;
- RootPart.RotationOffset = rot;
RootPart.Velocity = vel;
RootPart.AngularVelocity = avel;
RootPart.Acceleration = acc;
}
}
+ if(dorot)
+ {
+ currentRot *= rotation;
+ RootPart.RotationOffset = currentRot;
+ }
+
Vector3 s = RootPart.Scale * RootPart.RotationOffset;
float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f;
if(targetPosition.Z < h)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index ddf5078..b50ae28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4632,17 +4632,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// the id of the linkset to teleport
/// target position
/// a rotation to apply
- /// if TRUE (!=0) stop at destination
+ /// several flags/param>
///
/// only does teleport local to region
- /// object owner must have rights to run scripts on target location
+ /// if object has scripts, owner must have rights to run scripts on target location
/// object owner must have rights to enter ojects on target location
/// target location parcel must have enought free prims capacity for the linkset prims
/// all avatars siting on the object must have access to target location
/// has a cool down time. retries before expire reset it
/// fail conditions are silent ignored
///
- public void osObjectTeleport(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer stop)
+ public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
{
CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
m_host.AddScriptLPS(1);
@@ -4660,7 +4660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID myid = m_host.ParentGroup.UUID;
- sog.ObjectTeleport(myid, targetPos, rotation, stop != 0);
+ sog.TeleportObject(myid, targetPos, rotation, flags);
// a delay here may break vehicles
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 4722fed..879fe51 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -496,6 +496,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass);
void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot);
- void osObjectTeleport(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer stop);
+ void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 3a90c77..59493a3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -853,5 +853,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
/// process message parameter as regex
///
public const int OS_LISTEN_REGEX_MESSAGE = 0x2;
+
+ // for osTeleportObject
+ public const int OSTPOBJ_NONE = 0x0;
+ public const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination
+ public const int OSTPOBJ_STOPONFAIL = 0x2; // stops at jump point if tp fails
+ public const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation
+
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 37e7a17..3c8e02d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1140,9 +1140,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osClearInertia();
}
- public void osObjectTeleport(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer stop)
+ public void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags)
{
- m_OSSL_Functions.osObjectTeleport(objectUUID, targetPos, targetrotation, stop);
+ m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
}
}
}
--
cgit v1.1
From e237e1b2fa444b0bf0077036c9436f919e344e2b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 19:27:45 +0100
Subject: add LSL_Integer osGetLinkNumber(LSL_String name). uses a cache for
the string to linknumber map, cache invalidations may still be missing :(
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +
.../Region/Framework/Scenes/SceneObjectGroup.cs | 61 ++++++++++++++++++++++
.../Shared/Api/Implementation/OSSL_Api.cs | 9 ++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++
4 files changed, 77 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 49e98e7..6b29ec1 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1985,6 +1985,7 @@ namespace OpenSim.Region.Framework.Scenes
{
newRoot.TriggerScriptChangedEvent(Changed.LINK);
newRoot.ParentGroup.HasGroupChanged = true;
+ newRoot.ParentGroup.InvalidatePartsLinkMaps();
newRoot.ParentGroup.ScheduleGroupForFullUpdate();
}
}
@@ -2001,6 +2002,7 @@ namespace OpenSim.Region.Framework.Scenes
// from the database. They will be rewritten immediately,
// minus the rows for the unlinked child prims.
m_parentScene.SimulationDataService.RemoveObject(g.UUID, m_parentScene.RegionInfo.RegionID);
+ g.InvalidatePartsLinkMaps();
g.TriggerScriptChangedEvent(Changed.LINK);
g.HasGroupChanged = true; // Persist
g.ScheduleGroupForFullUpdate();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a0d7bfd..b410b74 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2004,6 +2004,7 @@ namespace OpenSim.Region.Framework.Scenes
if (part.LinkNum == 2)
RootPart.LinkNum = 1;
+ InvalidatePartsLinkMaps();
}
///
@@ -2560,6 +2561,7 @@ namespace OpenSim.Region.Framework.Scenes
dupe.ScheduleGroupForFullUpdate();
}
+ dupe.InvalidatePartsLinkMaps();
m_dupeInProgress = false;
return dupe;
}
@@ -3321,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes
ResetChildPrimPhysicsPositions();
InvalidBoundsRadius();
+ InvalidatePartsLinkMaps();
if (m_rootPart.PhysActor != null)
m_rootPart.PhysActor.Building = false;
@@ -3477,6 +3480,7 @@ namespace OpenSim.Region.Framework.Scenes
objectGroup.HasGroupChangedDueToDelink = true;
InvalidBoundsRadius();
+ InvalidatePartsLinkMaps();
objectGroup.AggregatePerms();
if (sendEvents)
@@ -5333,6 +5337,63 @@ namespace OpenSim.Region.Framework.Scenes
m_PlaySoundSlavePrims.Clear();
m_LoopSoundMasterPrim = null;
m_targets.Clear();
+ m_partsNameToLinkMap.Clear();
+ }
+
+ Dictionary m_partsNameToLinkMap = new Dictionary();
+
+ // this scales bad but so does GetLinkNumPart
+ public int GetLinkNumber(string name)
+ {
+ if(String.IsNullOrEmpty(name) || name == "Object")
+ return -1;
+
+ lock(m_partsNameToLinkMap)
+ {
+ if(m_partsNameToLinkMap.Count == 0)
+ {
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ {
+ string s = parts[i].Name;
+ if(String.IsNullOrEmpty(s) || s == "Object" || s == "Primitive")
+ continue;
+
+ if(m_partsNameToLinkMap.ContainsKey(s))
+ {
+ int ol = parts[i].LinkNum;
+ if(ol < m_partsNameToLinkMap[s])
+ m_partsNameToLinkMap[s] = ol;
+ }
+ else
+ m_partsNameToLinkMap[s] = parts[i].LinkNum;
+ }
+ }
+
+ if(m_partsNameToLinkMap.ContainsKey(name))
+ return m_partsNameToLinkMap[name];
+ }
+
+ if(m_sittingAvatars.Count > 0)
+ {
+ int j = m_parts.Count;
+ if(j > 1)
+ j++;
+ ScenePresence[] avs = m_sittingAvatars.ToArray();
+ for (int i = 0; i < avs.Length; i++, j++)
+ {
+ if (avs[i].Name == name)
+ return j;
+ }
+ }
+
+ return -1;
+ }
+
+ public void InvalidatePartsLinkMaps()
+ {
+ lock(m_partsNameToLinkMap)
+ m_partsNameToLinkMap.Clear();
}
#endregion
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b50ae28..0275cf4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4663,5 +4663,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
sog.TeleportObject(myid, targetPos, rotation, flags);
// a delay here may break vehicles
}
+
+ public LSL_Integer osGetLinkNumber(LSL_String name)
+ {
+ m_host.AddScriptLPS(1);
+ SceneObjectGroup sog = m_host.ParentGroup;
+ if(sog== null || sog.IsDeleted)
+ return -1;
+ return sog.GetLinkNumber(name);
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 3c8e02d..7c08628 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1144,5 +1144,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
}
+
+ public LSL_Integer osGetLinkNumber(LSL_String name)
+ {
+ return m_OSSL_Functions.osGetLinkNumber(name);
+ }
}
}
--
cgit v1.1
From d085c337a9d08788837a2f54a2400e91c807f59f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 4 Apr 2017 20:11:11 +0100
Subject: add a little speedup on repeated requests for same name on
osGetLinkNumber.
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 35 +++++++++++++++++-----
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 +
2 files changed, 29 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b410b74..d3490c2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -5340,7 +5340,9 @@ namespace OpenSim.Region.Framework.Scenes
m_partsNameToLinkMap.Clear();
}
- Dictionary m_partsNameToLinkMap = new Dictionary();
+ private Dictionary m_partsNameToLinkMap = new Dictionary();
+ private string GetLinkNumber_lastname;
+ private int GetLinkNumber_lastnumber;
// this scales bad but so does GetLinkNumPart
public int GetLinkNumber(string name)
@@ -5352,6 +5354,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if(m_partsNameToLinkMap.Count == 0)
{
+ GetLinkNumber_lastname = String.Empty;
+ GetLinkNumber_lastnumber = -1;
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
{
@@ -5370,20 +5374,33 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ if(name == GetLinkNumber_lastname)
+ return GetLinkNumber_lastnumber;
+
if(m_partsNameToLinkMap.ContainsKey(name))
- return m_partsNameToLinkMap[name];
- }
+ {
+ lock(m_partsNameToLinkMap)
+ {
+ GetLinkNumber_lastname = name;
+ GetLinkNumber_lastnumber = m_partsNameToLinkMap[name];
+ return GetLinkNumber_lastnumber;
+ }
+ }
+ }
if(m_sittingAvatars.Count > 0)
{
- int j = m_parts.Count;
- if(j > 1)
- j++;
+ int j = m_parts.Count + 1;
+
ScenePresence[] avs = m_sittingAvatars.ToArray();
for (int i = 0; i < avs.Length; i++, j++)
{
if (avs[i].Name == name)
- return j;
+ {
+ GetLinkNumber_lastname = name;
+ GetLinkNumber_lastnumber = j;
+ return j;
+ }
}
}
@@ -5393,7 +5410,11 @@ namespace OpenSim.Region.Framework.Scenes
public void InvalidatePartsLinkMaps()
{
lock(m_partsNameToLinkMap)
+ {
m_partsNameToLinkMap.Clear();
+ GetLinkNumber_lastname = String.Empty;
+ GetLinkNumber_lastnumber = -1;
+ }
}
#endregion
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 879fe51..08b144a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -497,5 +497,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot);
void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags);
+ LSL_Integer osGetLinkNumber(LSL_String name);
}
}
--
cgit v1.1
From 2805cb9dec567cdfb7a25d771527510b7a6284af Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 5 Apr 2017 01:15:44 +0100
Subject: give osTeleportObject proper OSFunctionThreatLevel setting on
osslEnable.ini
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 0275cf4..a6f6a80 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4644,13 +4644,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
{
- CheckThreatLevel(ThreatLevel.Severe, "osTeleportAgent");
+ CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject");
m_host.AddScriptLPS(1);
UUID objUUID;
if (!UUID.TryParse(objectUUID, out objUUID))
{
- OSSLShoutError("osObjectTeleport() invalid object Key");
+ OSSLShoutError("osTeleportObject() invalid object Key");
return;
}
--
cgit v1.1
From c0904a32cb281bad39497b091e758f2433adc196 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 5 Apr 2017 15:11:19 +0100
Subject: OSSL CheckThreatLevel() with no arguments only tests if OSSL is
enabled. Faster test for safe functions that are always allowed with OSSL
enabled. other name could be CheckOSSLenabled, but this name preserves
functions template.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 32 +++++++++++++++++++---
1 file changed, 28 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a6f6a80..b3bd8c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -260,7 +260,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
}
- // Returns of the function is allowed. Throws a script exception if not allowed.
+ // Returns if OSSL is enabled. Throws a script exception if OSSL is not allowed..
+ // for safe funtions always active
+ public void CheckThreatLevel()
+ {
+ if (!m_OSFunctionsEnabled)
+ OSSLError(String.Format("{0} permission denied. All OS functions are disabled.")); // throws
+ }
+
+ // Returns if the function is allowed. Throws a script exception if not allowed.
public void CheckThreatLevel(ThreatLevel level, string function)
{
if (!m_OSFunctionsEnabled)
@@ -1716,7 +1724,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer osCheckODE()
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
LSL_Integer ret = 0; // false
if (m_ScriptEngine.World.PhysicsScene != null)
{
@@ -1757,10 +1767,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public string osGetPhysicsEngineName()
{
- // not doing security checks
- // this whould limit the use of this
-
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
string ret = "NoEngine";
if (m_ScriptEngine.World.PhysicsScene != null)
{
@@ -1771,6 +1780,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
return ret;
}
+
public string osGetSimulatorVersion()
{
// High because it can be used to target attacks to known weaknesses
@@ -4364,6 +4374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osCollisionSound(string impact_sound, double impact_volume)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
if(impact_sound == "")
@@ -4396,6 +4407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// still not very usefull, detector is lost on rez, restarts, etc
public void osVolumeDetect(int detect)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted || m_host.ParentGroup.IsAttachment)
@@ -4418,6 +4430,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public LSL_List osGetInertiaData()
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
LSL_List result = new LSL_List();
@@ -4465,7 +4478,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void osSetInertia(LSL_Float mass, LSL_Vector centerOfMass, LSL_Vector principalInertiaScaled, LSL_Rotation lslrot)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4502,6 +4517,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsBox(LSL_Float mass, LSL_Vector boxSize, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
SceneObjectGroup sog = m_host.ParentGroup;
@@ -4543,7 +4559,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, LSL_Vector centerOfMass)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4581,7 +4599,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, LSL_Vector centerOfMass, LSL_Rotation lslrot)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4618,7 +4638,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
///
public void osClearInertia()
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return;
@@ -4666,7 +4688,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer osGetLinkNumber(LSL_String name)
{
+ CheckThreatLevel();
m_host.AddScriptLPS(1);
+
SceneObjectGroup sog = m_host.ParentGroup;
if(sog== null || sog.IsDeleted)
return -1;
--
cgit v1.1
From a41924d1f851c4aa807da71dc44d665d187473bf Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Wed, 5 Apr 2017 19:42:55 +0100
Subject: add missing invalidation of osGetLinkNumber cache
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 46b7b86..8d04c9f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -638,6 +638,8 @@ namespace OpenSim.Region.Framework.Scenes
set
{
m_name = value;
+ if(ParentGroup != null)
+ ParentGroup.InvalidatePartsLinkMaps();
PhysicsActor pa = PhysActor;
--
cgit v1.1
From 1848b1fdb143462e6d0db47142e5f50bd8a9632c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 6 Apr 2017 12:56:00 +0100
Subject: mantis 8740: fix osTeleportObject set rotation
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d3490c2..af70848 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -910,11 +910,12 @@ namespace OpenSim.Region.Framework.Scenes
bool setrot = (flags & OSTPOBJ_SETROT) != 0;
rotation.Normalize();
- bool dorot = (Math.Abs(rotation.W) < 0.999);
-
Quaternion currentRot = RootPart.RotationOffset;
- if(dorot && setrot)
- rotation = rotation * Quaternion.Conjugate(currentRot);
+
+ if(setrot)
+ rotation = Quaternion.Conjugate(currentRot) * rotation;
+
+ bool dorot = setrot | (Math.Abs(rotation.W) < 0.999);
if(stop)
{
--
cgit v1.1
From 9d8220ac9fe4fe01676beaf9b2a82db82d37a7f8 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 14 Apr 2017 03:14:41 +0100
Subject: some reduction on large colision repulsive force on non physical
placement of physical prims
---
.../PhysicsModules/SharedBase/PhysicsActor.cs | 4 +
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 357 ++++++++++++++-------
OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 18 +-
3 files changed, 255 insertions(+), 124 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
index d23d9c1..2fa98b5 100644
--- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
+++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs
@@ -256,6 +256,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
///
public string SOPName;
+ public virtual void CrossingStart() { }
public abstract void CrossingFailure();
public abstract void link(PhysicsActor obj);
@@ -462,6 +463,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public abstract bool SubscribedEvents();
public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
+ public virtual void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact) { }
public virtual PhysicsInertiaData GetInertiaData()
{
@@ -477,6 +479,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
{
}
+ public virtual float SimulationSuspended { get; set; }
+
// Warning in a parent part it returns itself, not null
public virtual PhysicsActor ParentActor { get { return this; } }
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index f784990..98bea09 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -109,8 +109,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private float m_waterHeight;
private float m_buoyancy; //KF: m_buoyancy should be set by llSetBuoyancy() for non-vehicle.
- private int body_autodisable_frames;
- public int bodydisablecontrol = 0;
+ private int m_body_autodisable_frames;
+ public int m_bodydisablecontrol = 0;
+ public int m_bodyMoveCoolDown = 0;
private float m_gravmod = 1.0f;
// Default we're a Geometry
@@ -196,6 +197,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private int m_eventsubscription;
private int m_cureventsubscription;
private CollisionEventUpdate CollisionEventsThisFrame = null;
+ private CollisionEventUpdate CollisionVDTCEventsThisFrame = null;
private bool SentEmptyCollisionsEvent;
public volatile bool childPrim;
@@ -668,7 +670,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
if (value.IsFinite())
{
- AddChange(changes.Velocity, value);
+ if(m_outbounds)
+ _velocity = value;
+ else
+ AddChange(changes.Velocity, value);
}
else
{
@@ -972,31 +977,70 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override void CrossingFailure()
{
- if (m_outbounds)
+ lock(_parent_scene.OdeLock)
{
- _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
- _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
- _position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f);
+ if (m_outbounds)
+ {
+ _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
+ _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
+ _position.Z = Util.Clip(_position.Z + 0.2f, -100f, 50000f);
- m_lastposition = _position;
- _velocity.X = 0;
- _velocity.Y = 0;
- _velocity.Z = 0;
+ m_lastposition = _position;
+ _velocity.X = 0;
+ _velocity.Y = 0;
+ _velocity.Z = 0;
- d.AllocateODEDataForThread(0);
+ d.AllocateODEDataForThread(0);
- m_lastVelocity = _velocity;
- if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
- m_vehicle.Stop();
+ m_lastVelocity = _velocity;
+ if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
+ m_vehicle.Stop();
+ if(Body != IntPtr.Zero)
+ d.BodySetLinearVel(Body, 0, 0, 0); // stop it
+ if (prim_geom != IntPtr.Zero)
+ d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
+
+ m_outbounds = false;
+ changeDisable(false);
+ base.RequestPhysicsterseUpdate();
+ }
+ }
+ }
+
+ public override void CrossingStart()
+ {
+ lock(_parent_scene.OdeLock)
+ {
+ if (m_outbounds || childPrim)
+ return;
+
+ m_outbounds = true;
+
+ m_lastposition = _position;
+ m_lastorientation = _orientation;
+
+ d.AllocateODEDataForThread(0);
if(Body != IntPtr.Zero)
- d.BodySetLinearVel(Body, 0, 0, 0); // stop it
- if (prim_geom != IntPtr.Zero)
- d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
+ {
+ if(m_bodyMoveCoolDown >= 0)
+ {
+ d.Vector3 dtmp = d.BodyGetAngularVel(Body);
+ m_rotationalVelocity.X = dtmp.X;
+ m_rotationalVelocity.Y = dtmp.Y;
+ m_rotationalVelocity.Z = dtmp.Z;
- m_outbounds = false;
- changeDisable(false);
- base.RequestPhysicsterseUpdate();
+ dtmp = d.BodyGetLinearVel(Body);
+ _velocity.X = dtmp.X;
+ _velocity.Y = dtmp.Y;
+ _velocity.Z = dtmp.Z;
+ }
+ d.BodySetLinearVel(Body, 0, 0, 0); // stop it
+ d.BodySetAngularVel(Body, 0, 0, 0);
+ }
+ d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
+ disableBodySoft(); // stop collisions
+ UnSubscribeEvents();
}
}
@@ -1090,11 +1134,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_cureventsubscription = 0;
if (CollisionEventsThisFrame == null)
CollisionEventsThisFrame = new CollisionEventUpdate();
+ if (CollisionVDTCEventsThisFrame == null)
+ CollisionVDTCEventsThisFrame = new CollisionEventUpdate();
SentEmptyCollisionsEvent = false;
}
public override void UnSubscribeEvents()
{
+ if (CollisionVDTCEventsThisFrame != null)
+ {
+ CollisionVDTCEventsThisFrame.Clear();
+ CollisionVDTCEventsThisFrame = null;
+ }
if (CollisionEventsThisFrame != null)
{
CollisionEventsThisFrame.Clear();
@@ -1113,21 +1164,44 @@ namespace OpenSim.Region.PhysicsModule.ubOde
_parent_scene.AddCollisionEventReporting(this);
}
+ public override void AddVDTCCollisionEvent(uint CollidedWith, ContactPoint contact)
+ {
+ if (CollisionVDTCEventsThisFrame == null)
+ CollisionVDTCEventsThisFrame = new CollisionEventUpdate();
+
+ CollisionVDTCEventsThisFrame.AddCollider(CollidedWith, contact);
+ _parent_scene.AddCollisionEventReporting(this);
+ }
+
internal void SleeperAddCollisionEvents()
{
- if (CollisionEventsThisFrame == null)
- return;
- if(CollisionEventsThisFrame.m_objCollisionList.Count == 0)
- return;
- foreach(KeyValuePair kvp in CollisionEventsThisFrame.m_objCollisionList)
+ if(CollisionEventsThisFrame != null && CollisionEventsThisFrame.m_objCollisionList.Count != 0)
+ {
+ foreach(KeyValuePair kvp in CollisionEventsThisFrame.m_objCollisionList)
+ {
+ if(kvp.Key == 0)
+ continue;
+ OdePrim other = _parent_scene.getPrim(kvp.Key);
+ if(other == null)
+ continue;
+ ContactPoint cp = kvp.Value;
+ cp.SurfaceNormal = - cp.SurfaceNormal;
+ cp.RelativeSpeed = -cp.RelativeSpeed;
+ other.AddCollisionEvent(ParentActor.LocalID,cp);
+ }
+ }
+ if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.m_objCollisionList.Count != 0)
{
- OdePrim other = _parent_scene.getPrim(kvp.Key);
- if(other == null)
- continue;
- ContactPoint cp = kvp.Value;
- cp.SurfaceNormal = - cp.SurfaceNormal;
- cp.RelativeSpeed = -cp.RelativeSpeed;
- other.AddCollisionEvent(ParentActor.LocalID,cp);
+ foreach(KeyValuePair kvp in CollisionVDTCEventsThisFrame.m_objCollisionList)
+ {
+ OdePrim other = _parent_scene.getPrim(kvp.Key);
+ if(other == null)
+ continue;
+ ContactPoint cp = kvp.Value;
+ cp.SurfaceNormal = - cp.SurfaceNormal;
+ cp.RelativeSpeed = -cp.RelativeSpeed;
+ other.AddCollisionEvent(ParentActor.LocalID,cp);
+ }
}
}
@@ -1160,6 +1234,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
CollisionEventsThisFrame.Clear();
}
}
+ if(CollisionVDTCEventsThisFrame != null && (Body == IntPtr.Zero || d.BodyIsEnabled(Body)))
+ CollisionVDTCEventsThisFrame.Clear();
}
public override bool SubscribedEvents()
@@ -1192,7 +1268,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_invTimeStep = 1f / m_timeStep;
m_density = parent_scene.geomDefaultDensity;
- body_autodisable_frames = parent_scene.bodyFramesAutoDisable;
+ m_body_autodisable_frames = parent_scene.bodyFramesAutoDisable;
prim_geom = IntPtr.Zero;
collide_geom = IntPtr.Zero;
@@ -1257,6 +1333,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce;
m_building = true; // control must set this to false when done
+ m_bodyMoveCoolDown = 0;
AddChange(changes.Add, null);
@@ -1963,7 +2040,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.BodySetGravityMode(Body, false);
d.BodySetAutoDisableFlag(Body, true);
- d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
+ d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames);
d.BodySetAutoDisableAngularThreshold(Body, 0.05f);
d.BodySetAutoDisableLinearThreshold(Body, 0.05f);
d.BodySetDamping(Body, .004f, .001f);
@@ -2055,11 +2132,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
+ /*
d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
+ */
_zeroFlag = false;
- bodydisablecontrol = 0;
+ m_bodydisablecontrol = 0;
}
+ m_bodyMoveCoolDown = -5;
_parent_scene.addActiveGroups(this);
}
@@ -2152,6 +2232,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
m_mass = primMass;
m_collisionscore = 0;
+ m_bodyMoveCoolDown = 0;
}
private void FixInertia(Vector3 NewPos,Quaternion newrot)
@@ -2814,6 +2895,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
_zeroFlag = true;
d.BodyEnable(Body);
+ m_bodyMoveCoolDown = -5;
}
}
// else if (_parent != null)
@@ -2856,6 +2938,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
_position = newPos;
+ m_bodyMoveCoolDown = -5;
}
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
{
@@ -2915,8 +2998,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
myrot.W = newOri.W;
d.GeomSetQuaternion(prim_geom, ref myrot);
_orientation = newOri;
- if (Body != IntPtr.Zero && m_angularlocks != 0)
- createAMotor(m_angularlocks);
+
+ if (Body != IntPtr.Zero)
+ {
+ if(m_angularlocks != 0)
+ createAMotor(m_angularlocks);
+ m_bodyMoveCoolDown = -5;
+ }
}
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
{
@@ -3212,7 +3300,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private void changeSetTorque(Vector3 newtorque)
{
- if (!m_isSelected)
+ if (!m_isSelected && !m_outbounds)
{
if (m_isphysical && Body != IntPtr.Zero)
{
@@ -3229,14 +3317,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private void changeForce(Vector3 force)
{
m_force = force;
- if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
+ if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
d.BodyEnable(Body);
}
private void changeAddForce(Vector3 theforce)
{
m_forceacc += theforce;
- if (!m_isSelected)
+ if (!m_isSelected && !m_outbounds)
{
lock (this)
{
@@ -3257,7 +3345,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private void changeAddAngularImpulse(Vector3 aimpulse)
{
m_angularForceacc += aimpulse * m_invTimeStep;
- if (!m_isSelected)
+ if (!m_isSelected && !m_outbounds)
{
lock (this)
{
@@ -3282,7 +3370,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
newVel *= len;
}
- if (!m_isSelected)
+ if (!m_isSelected && !m_outbounds)
{
if (Body != IntPtr.Zero)
{
@@ -3290,8 +3378,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
enableBodySoft();
else if (!d.BodyIsEnabled(Body))
d.BodyEnable(Body);
-
- d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
+ if(m_bodyMoveCoolDown >= 0)
+ d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
}
//resetCollisionAccounting();
}
@@ -3307,7 +3395,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
newAngVel *= len;
}
- if (!m_isSelected)
+ if (!m_isSelected && !m_outbounds)
{
if (Body != IntPtr.Zero)
{
@@ -3316,8 +3404,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
else if (!d.BodyIsEnabled(Body))
d.BodyEnable(Body);
-
- d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
+ if(m_bodyMoveCoolDown >= 0);
+ d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
}
//resetCollisionAccounting();
}
@@ -3468,13 +3556,33 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (!childPrim && m_isphysical && Body != IntPtr.Zero &&
!m_disabled && !m_isSelected && !m_building && !m_outbounds)
{
+ if(m_bodyMoveCoolDown < 0)
+ {
+ m_bodyMoveCoolDown++;
+// if(!IsColliding)
+// m_bodyCoolDown +=2;
+ if(m_bodyMoveCoolDown >= 0)
+ {
+ d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
+ d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
+ }
+ else
+ {
+ d.BodySetAngularVel(Body, 0, 0, 0);
+ d.BodySetLinearVel(Body, 0, 0, 0);
+ m_forceacc = Vector3.Zero;
+ m_angularForceacc = Vector3.Zero;
+ _zeroFlag = false;
+ return;
+ }
+ }
if (!d.BodyIsEnabled(Body))
{
// let vehicles sleep
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
return;
- if (++bodydisablecontrol < 50)
+ if (++m_bodydisablecontrol < 50)
return;
// clear residuals
@@ -3482,11 +3590,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.BodySetLinearVel(Body,0f,0f,0f);
_zeroFlag = true;
d.BodyEnable(Body);
- bodydisablecontrol = -4;
+ m_bodydisablecontrol = -4;
}
- if(bodydisablecontrol < 0)
- bodydisablecontrol ++;
+ if(m_bodydisablecontrol < 0)
+ m_bodydisablecontrol ++;
d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator
@@ -3655,7 +3763,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
bool bodyenabled = d.BodyIsEnabled(Body);
- if(bodydisablecontrol < 0)
+ if(m_bodydisablecontrol < 0)
return;
if (bodyenabled || !_zeroFlag)
@@ -3723,15 +3831,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_lastposition = _position;
m_lastorientation = _orientation;
- d.Vector3 dtmp = d.BodyGetAngularVel(Body);
- m_rotationalVelocity.X = dtmp.X;
- m_rotationalVelocity.Y = dtmp.Y;
- m_rotationalVelocity.Z = dtmp.Z;
-
- dtmp = d.BodyGetLinearVel(Body);
- _velocity.X = dtmp.X;
- _velocity.Y = dtmp.Y;
- _velocity.Z = dtmp.Z;
+ if(m_bodyMoveCoolDown >= 0)
+ {
+ d.Vector3 dtmp = d.BodyGetAngularVel(Body);
+ m_rotationalVelocity.X = dtmp.X;
+ m_rotationalVelocity.Y = dtmp.Y;
+ m_rotationalVelocity.Z = dtmp.Z;
+
+ dtmp = d.BodyGetLinearVel(Body);
+ _velocity.X = dtmp.X;
+ _velocity.Y = dtmp.Y;
+ _velocity.Z = dtmp.Z;
+ }
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
d.BodySetAngularVel(Body, 0, 0, 0);
@@ -3756,30 +3867,33 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
- float poserror;
- float angerror;
- if(_zeroFlag)
- {
- poserror = 0.01f;
- angerror = 0.001f;
- }
- else
+ if(m_bodyMoveCoolDown >= 0)
{
- poserror = 0.005f;
- angerror = 0.0005f;
- }
+ float poserror;
+ float angerror;
+ if(_zeroFlag)
+ {
+ poserror = 0.01f;
+ angerror = 0.001f;
+ }
+ else
+ {
+ poserror = 0.005f;
+ angerror = 0.0005f;
+ }
- if (
- (Math.Abs(_position.X - lpos.X) < poserror)
- && (Math.Abs(_position.Y - lpos.Y) < poserror)
- && (Math.Abs(_position.Z - lpos.Z) < poserror)
- && (Math.Abs(_orientation.X - ori.X) < angerror)
- && (Math.Abs(_orientation.Y - ori.Y) < angerror)
- && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W
- )
- _zeroFlag = true;
- else
- _zeroFlag = false;
+ if (
+ (Math.Abs(_position.X - lpos.X) < poserror)
+ && (Math.Abs(_position.Y - lpos.Y) < poserror)
+ && (Math.Abs(_position.Z - lpos.Z) < poserror)
+ && (Math.Abs(_orientation.X - ori.X) < angerror)
+ && (Math.Abs(_orientation.Y - ori.Y) < angerror)
+ && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W
+ )
+ _zeroFlag = true;
+ else
+ _zeroFlag = false;
+ }
}
// update position
@@ -3805,46 +3919,49 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
- d.Vector3 vel = d.BodyGetLinearVel(Body);
+ if(m_bodyMoveCoolDown >= 0)
+ {
+ d.Vector3 vel = d.BodyGetLinearVel(Body);
- _acceleration = _velocity;
+ _acceleration = _velocity;
- if ((Math.Abs(vel.X) < 0.005f) &&
- (Math.Abs(vel.Y) < 0.005f) &&
- (Math.Abs(vel.Z) < 0.005f))
- {
- _velocity = Vector3.Zero;
- float t = -m_invTimeStep;
- _acceleration = _acceleration * t;
- }
- else
- {
- _velocity.X = vel.X;
- _velocity.Y = vel.Y;
- _velocity.Z = vel.Z;
- _acceleration = (_velocity - _acceleration) * m_invTimeStep;
- }
+ if ((Math.Abs(vel.X) < 0.005f) &&
+ (Math.Abs(vel.Y) < 0.005f) &&
+ (Math.Abs(vel.Z) < 0.005f))
+ {
+ _velocity = Vector3.Zero;
+ float t = -m_invTimeStep;
+ _acceleration = _acceleration * t;
+ }
+ else
+ {
+ _velocity.X = vel.X;
+ _velocity.Y = vel.Y;
+ _velocity.Z = vel.Z;
+ _acceleration = (_velocity - _acceleration) * m_invTimeStep;
+ }
- if ((Math.Abs(_acceleration.X) < 0.01f) &&
- (Math.Abs(_acceleration.Y) < 0.01f) &&
- (Math.Abs(_acceleration.Z) < 0.01f))
- {
- _acceleration = Vector3.Zero;
- }
+ if ((Math.Abs(_acceleration.X) < 0.01f) &&
+ (Math.Abs(_acceleration.Y) < 0.01f) &&
+ (Math.Abs(_acceleration.Z) < 0.01f))
+ {
+ _acceleration = Vector3.Zero;
+ }
- vel = d.BodyGetAngularVel(Body);
- if ((Math.Abs(vel.X) < 0.0001) &&
- (Math.Abs(vel.Y) < 0.0001) &&
- (Math.Abs(vel.Z) < 0.0001)
- )
- {
- m_rotationalVelocity = Vector3.Zero;
- }
- else
- {
- m_rotationalVelocity.X = vel.X;
- m_rotationalVelocity.Y = vel.Y;
- m_rotationalVelocity.Z = vel.Z;
+ vel = d.BodyGetAngularVel(Body);
+ if ((Math.Abs(vel.X) < 0.0001) &&
+ (Math.Abs(vel.Y) < 0.0001) &&
+ (Math.Abs(vel.Z) < 0.0001)
+ )
+ {
+ m_rotationalVelocity = Vector3.Zero;
+ }
+ else
+ {
+ m_rotationalVelocity.X = vel.X;
+ m_rotationalVelocity.Y = vel.Y;
+ m_rotationalVelocity.Z = vel.Z;
+ }
}
}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 6279d6a..4a82f77 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -186,7 +186,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
float frictionMovementMult = 0.8f;
- float TerrainBounce = 0.1f;
+ float TerrainBounce = 0.001f;
float TerrainFriction = 0.3f;
public float AvatarFriction = 0;// 0.9f * 0.5f;
@@ -1083,9 +1083,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
case ActorTypes.Prim:
if (p2events)
{
- AddCollisionEventReporting(p2);
+ //AddCollisionEventReporting(p2);
p2.AddCollisionEvent(p1.ParentActor.LocalID, contact);
}
+ else if(p1.IsVolumeDtc)
+ p2.AddVDTCCollisionEvent(p1.ParentActor.LocalID, contact);
+
obj2LocalID = p2.ParentActor.LocalID;
break;
@@ -1099,9 +1102,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
contact.SurfaceNormal = -contact.SurfaceNormal;
contact.RelativeSpeed = -contact.RelativeSpeed;
- AddCollisionEventReporting(p1);
+ //AddCollisionEventReporting(p1);
p1.AddCollisionEvent(obj2LocalID, contact);
}
+ else if(p2.IsVolumeDtc)
+ {
+ contact.SurfaceNormal = -contact.SurfaceNormal;
+ contact.RelativeSpeed = -contact.RelativeSpeed;
+ //AddCollisionEventReporting(p1);
+ p1.AddVDTCCollisionEvent(obj2LocalID, contact);
+ }
break;
}
case ActorTypes.Ground:
@@ -1110,7 +1120,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
if (p2events && !p2.IsVolumeDtc)
{
- AddCollisionEventReporting(p2);
+ //AddCollisionEventReporting(p2);
p2.AddCollisionEvent(0, contact);
}
break;
--
cgit v1.1
From 63383bf3c5f5923b33e43ddd6b24b5616288ff4f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 14 Apr 2017 21:55:37 +0100
Subject: add functions to send entity updates imediatly, except for avatars
(or now) they should be use to bypass normal delayed updates, for debug
---
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 64 +++++++++++++++++++---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 45 +++++++++++++--
.../Server/IRCClientView.cs | 7 ++-
.../Region/OptionalModules/World/NPC/NPCAvatar.cs | 6 +-
4 files changed, 108 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 410ac00..4c77c18 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3950,24 +3950,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
/// Send an ObjectUpdate packet with information about an avatar
///
- public void SendAvatarDataImmediate(ISceneEntity avatar)
+ public void SendEntityFullUpdateImmediate(ISceneEntity ent)
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
// avatar.Name, avatar.UUID, Name, AgentId);
- ScenePresence presence = avatar as ScenePresence;
- if (presence == null)
+ if (ent == null)
return;
ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
objupdate.Header.Zerocoded = true;
- objupdate.RegionData.RegionHandle = presence.RegionHandle;
-// objupdate.RegionData.TimeDilation = ushort.MaxValue;
objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
- objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
+
+ if(ent is ScenePresence)
+ {
+ ScenePresence presence = ent as ScenePresence;
+ objupdate.RegionData.RegionHandle = presence.RegionHandle;
+ objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
+ }
+ else if(ent is SceneObjectPart)
+ {
+ SceneObjectPart part = ent as SceneObjectPart;
+ objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
+ objupdate.ObjectData[0] = CreatePrimUpdateBlock(part, (ScenePresence)SceneAgent);
+ }
+
+ OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
+
+ // We need to record the avatar local id since the root prim of an attachment points to this.
+// m_attachmentsSent.Add(avatar.LocalId);
+ }
+
+ public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
+ {
+// m_log.DebugFormat(
+// "[LLCLIENTVIEW]: Sending immediate object update for avatar {0} {1} to {2} {3}",
+// avatar.Name, avatar.UUID, Name, AgentId);
+
+ if (ent == null)
+ return;
+
+ ImprovedTerseObjectUpdatePacket objupdate =
+ (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
+ objupdate.Header.Zerocoded = true;
+
+ objupdate.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
+ objupdate.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
+
+ if(ent is ScenePresence)
+ {
+ ScenePresence presence = ent as ScenePresence;
+ objupdate.RegionData.RegionHandle = presence.RegionHandle;
+ objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
+ }
+ else if(ent is SceneObjectPart)
+ {
+ SceneObjectPart part = ent as SceneObjectPart;
+ objupdate.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
+ objupdate.ObjectData[0] = CreateImprovedTerseBlock(ent, false);
+ }
OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
@@ -4021,7 +4065,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Primitive Packet/Data Sending Methods
-
///
/// Generate one of the object update packets based on PrimUpdateFlags
/// and broadcast the packet to clients
@@ -4157,8 +4200,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
SceneObjectPart part = (SceneObjectPart)update.Entity;
SceneObjectGroup grp = part.ParentGroup;
- if (grp.inTransit)
+ if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
continue;
+ if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
+ {
+
+
+ }
if (grp.IsDeleted)
{
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a5af7e1..d50de27 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1778,6 +1778,20 @@ namespace OpenSim.Region.Framework.Scenes
private Dictionary m_knownChildRegionsSizeInfo = new Dictionary();
+ public void AddNeighbourRegion(GridRegion region, string capsPath)
+ {
+ lock (m_knownChildRegions)
+ {
+ ulong regionHandle = region.RegionHandle;
+ m_knownChildRegions.Add(regionHandle,capsPath);
+
+ spRegionSizeInfo sizeInfo = new spRegionSizeInfo();
+ sizeInfo.sizeX = region.RegionSizeX;
+ sizeInfo.sizeY = region.RegionSizeY;
+ m_knownChildRegionsSizeInfo[regionHandle] = sizeInfo;
+ }
+ }
+
public void AddNeighbourRegionSizeInfo(GridRegion region)
{
lock (m_knownChildRegions)
@@ -1826,6 +1840,12 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public bool knowsNeighbourRegion(ulong regionHandle)
+ {
+ lock (m_knownChildRegions)
+ return m_knownChildRegions.ContainsKey(regionHandle);
+ }
+
public void DropOldNeighbours(List oldRegions)
{
foreach (ulong handle in oldRegions)
@@ -2010,6 +2030,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
+
m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
if(!haveGroupInformation && !IsChildAgent && !IsNPC)
@@ -2069,6 +2090,16 @@ namespace OpenSim.Region.Framework.Scenes
if (!IsChildAgent)
{
+ if( ParentPart != null && !IsNPC && (crossingFlags & 0x08) != 0)
+ {
+
+// SceneObjectPart root = ParentPart.ParentGroup.RootPart;
+// if(root.LocalId != ParentPart.LocalId)
+// ControllingClient.SendEntityTerseUpdateImmediate(root);
+// ControllingClient.SendEntityTerseUpdateImmediate(ParentPart);
+ ParentPart.ParentGroup.SendFullUpdateToClient(ControllingClient);
+ }
+
// verify baked textures and cache
bool cachedbaked = false;
@@ -2130,6 +2161,7 @@ namespace OpenSim.Region.Framework.Scenes
// send avatar object to all presences including us, so they cross it into region
// then hide if necessary
+
SendInitialAvatarDataToAllAgents(allpresences);
// send this look
@@ -2237,13 +2269,18 @@ namespace OpenSim.Region.Framework.Scenes
m_lastChildAgentUpdateDrawDistance = DrawDistance;
m_lastChildAgentUpdatePosition = AbsolutePosition;
m_childUpdatesBusy = false; // allow them
+
+
}
m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts));
+
+
// send the rest of the world
if (m_teleportFlags > 0 && !IsNPC || m_currentParcelHide)
SendInitialDataToMe();
+
// priority uses avatar position only
// m_reprioritizationLastPosition = AbsolutePosition;
@@ -3979,7 +4016,7 @@ namespace OpenSim.Region.Framework.Scenes
int count = 0;
foreach (ScenePresence p in presences)
{
- p.ControllingClient.SendAvatarDataImmediate(this);
+ p.ControllingClient.SendEntityFullUpdateImmediate(this);
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
// either just kill the object
// p.ControllingClient.SendKillObject(new List {LocalId});
@@ -3992,7 +4029,7 @@ namespace OpenSim.Region.Framework.Scenes
public void SendInitialAvatarDataToAgent(ScenePresence p)
{
- p.ControllingClient.SendAvatarDataImmediate(this);
+ p.ControllingClient.SendEntityFullUpdateImmediate(this);
if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.IsViewerUIGod)
// either just kill the object
// p.ControllingClient.SendKillObject(new List {LocalId});
@@ -4009,12 +4046,12 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.IsViewerUIGod)
return;
- avatar.ControllingClient.SendAvatarDataImmediate(this);
+ avatar.ControllingClient.SendEntityFullUpdateImmediate(this);
}
public void SendAvatarDataToAgentNF(ScenePresence avatar)
{
- avatar.ControllingClient.SendAvatarDataImmediate(this);
+ avatar.ControllingClient.SendEntityFullUpdateImmediate(this);
}
///
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 83b534b..d39c224 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1097,7 +1097,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
- public void SendAvatarDataImmediate(ISceneEntity avatar)
+ public void SendEntityFullUpdateImmediate(ISceneEntity ent)
+ {
+
+ }
+
+ public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
{
}
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 6a7c735..151a202 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -813,7 +813,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
- public void SendAvatarDataImmediate(ISceneEntity avatar)
+ public void SendEntityFullUpdateImmediate(ISceneEntity avatar)
+ {
+ }
+
+ public void SendEntityTerseUpdateImmediate(ISceneEntity ent)
{
}
--
cgit v1.1
From 73be6cb269527348a2f1be7c74eac7b5145d583a Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 14 Apr 2017 22:02:40 +0100
Subject: increase the updates priority of linkset where avatar is sitting
---
OpenSim/Region/Framework/Scenes/Prioritizer.cs | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index cbf40c8..53ca849 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -172,14 +172,22 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectPart)
{
+ SceneObjectGroup sog = ((SceneObjectPart)entity).ParentGroup;
// Attachments are high priority,
- if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
+ if (sog.IsAttachment)
return 2;
+
+
+ if(presence.ParentPart != null)
+ {
+ if(presence.ParentPart.ParentGroup == sog)
+ return 2;
+ }
pqueue = ComputeDistancePriority(client, entity, false);
// Non physical prims are lower priority than physical prims
- PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
+ PhysicsActor physActor = sog.RootPart.PhysActor;
if (physActor == null || !physActor.IsPhysical)
pqueue++;
}
@@ -302,6 +310,17 @@ namespace OpenSim.Region.Framework.Scenes
else
{
SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup;
+ if(presence.ParentPart != null)
+ {
+ if(presence.ParentPart.ParentGroup == group)
+ return pqueue;
+ }
+ if(group.IsAttachment)
+ {
+ if(group.RootPart.LocalId == presence.LocalId)
+ return pqueue;
+ }
+
float bradius = group.GetBoundsRadius();
Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter();
distance = Vector3.Distance(presencePos, grppos);
--
cgit v1.1
From 4f8f04d9499f040631a4056dfd11aa2ff95761dd Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 15 Apr 2017 01:21:47 +0100
Subject: still issues with volume detectors and sleeping bodies
---
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 14 ++++---
OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 50 ++++++++++++++++---------
2 files changed, 41 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 98bea09..f8ee6c0 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -1210,14 +1210,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (m_cureventsubscription < 50000)
m_cureventsubscription += timestep;
+ if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 && (Body == IntPtr.Zero || d.BodyIsEnabled(Body)))
+ CollisionVDTCEventsThisFrame.Clear();
+
+ if (m_cureventsubscription < m_eventsubscription)
+ return;
+
if (CollisionEventsThisFrame == null)
return;
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
- if (m_cureventsubscription < m_eventsubscription)
- return;
-
if (!SentEmptyCollisionsEvent || ncolisions > 0)
{
base.SendCollisionUpdate(CollisionEventsThisFrame);
@@ -1234,8 +1237,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
CollisionEventsThisFrame.Clear();
}
}
- if(CollisionVDTCEventsThisFrame != null && (Body == IntPtr.Zero || d.BodyIsEnabled(Body)))
- CollisionVDTCEventsThisFrame.Clear();
}
public override bool SubscribedEvents()
@@ -2938,7 +2939,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
_position = newPos;
- m_bodyMoveCoolDown = -5;
+ if (Body != IntPtr.Zero && !m_disabled)
+ m_bodyMoveCoolDown = -5;
}
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
{
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 4a82f77..883038f 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -1668,11 +1668,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// d.WorldSetQuickStepNumIterations(world, curphysiteractions);
- int loopstartMS = Util.EnvironmentTickCount();
- int looptimeMS = 0;
- int changestimeMS = 0;
- int maxChangestime = (int)(reqTimeStep * 500f); // half the time
- int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
+ double loopstartMS = Util.GetTimeStampMS();
+ double looptimeMS = 0;
+ double changestimeMS = 0;
+ double maxChangestime = (int)(reqTimeStep * 500f); // half the time
+ double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
+
+// double collisionTime = 0;
+// double qstepTIme = 0;
+// double tmpTime = 0;
d.AllocateODEDataForThread(~0U);
@@ -1695,7 +1699,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
item.actor.Name, item.what.ToString());
}
}
- changestimeMS = Util.EnvironmentTickCountSubtract(loopstartMS);
+ changestimeMS = Util.GetTimeStampMS() - loopstartMS;
if (changestimeMS > maxChangestime)
break;
}
@@ -1740,9 +1744,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_rayCastManager.ProcessQueuedRequests();
+// tmpTime = Util.GetTimeStampMS();
collision_optimized();
- List sleepers = new List();
+// collisionTime += Util.GetTimeStampMS() - tmpTime;
+
+ lock(_collisionEventPrimRemove)
+ {
+ foreach (PhysicsActor obj in _collisionEventPrimRemove)
+ _collisionEventPrim.Remove(obj);
+
+ _collisionEventPrimRemove.Clear();
+ }
+ List sleepers = new List();
foreach (PhysicsActor obj in _collisionEventPrim)
{
if (obj == null)
@@ -1772,18 +1786,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
foreach(OdePrim prm in sleepers)
prm.SleeperAddCollisionEvents();
sleepers.Clear();
-
- lock(_collisionEventPrimRemove)
- {
- foreach (PhysicsActor obj in _collisionEventPrimRemove)
- _collisionEventPrim.Remove(obj);
-
- _collisionEventPrimRemove.Clear();
- }
-
+
// do a ode simulation step
+// tmpTime = Util.GetTimeStampMS();
d.WorldQuickStep(world, ODE_STEPSIZE);
d.JointGroupEmpty(contactgroup);
+// qstepTIme += Util.GetTimeStampMS() - tmpTime;
// update managed ideia of physical data and do updates to core
/*
@@ -1824,7 +1832,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
step_time -= ODE_STEPSIZE;
nodeframes++;
- looptimeMS = Util.EnvironmentTickCountSubtract(loopstartMS);
+ looptimeMS = Util.GetTimeStampMS() - loopstartMS;
if (looptimeMS > maxLoopTime)
break;
}
@@ -1893,6 +1901,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
int nbodies = d.NTotalBodies;
int ngeoms = d.NTotalGeoms;
*/
+/*
+ looptimeMS /= nodeframes;
+ if(looptimeMS > 0.080)
+ {
+ collisionTime /= nodeframes;
+ qstepTIme /= nodeframes;
+ }
+*/
// Finished with all sim stepping. If requested, dump world state to file for debugging.
// TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?
// TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots?
--
cgit v1.1
From 156ef0bbe37ae97c2ec75ddbb2662edc2156dbda Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 15 Apr 2017 02:48:58 +0100
Subject: still issues with volume detectors and sleeping bodies
---
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 8 ++++++--
OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index f8ee6c0..0d8eeec 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -1205,13 +1205,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
+ internal void clearSleeperCollisions()
+ {
+ if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 )
+ CollisionVDTCEventsThisFrame.Clear();
+ }
+
public void SendCollisions(int timestep)
{
if (m_cureventsubscription < 50000)
m_cureventsubscription += timestep;
- if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 && (Body == IntPtr.Zero || d.BodyIsEnabled(Body)))
- CollisionVDTCEventsThisFrame.Clear();
if (m_cureventsubscription < m_eventsubscription)
return;
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index 883038f..a4c3f92 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -1172,6 +1172,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
aprim.CollisionScore = 0;
aprim.IsColliding = false;
+ if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body))
+ aprim.clearSleeperCollisions();
}
}
lock (_activegroups)
--
cgit v1.1
From 0f7ffc56cee22aa95af58d19d3ea2193cea07340 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 15 Apr 2017 10:46:18 +0100
Subject: several changes for osTeleportObject
---
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +-
.../EntityTransfer/EntityTransferModule.cs | 92 ++++-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 407 ++++++++++++++-------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 35 +-
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 43 ++-
.../Shared/Api/Implementation/OSSL_Api.cs | 8 +-
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 3 +-
.../Shared/Api/Runtime/LSL_Constants.cs | 2 +-
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 +-
9 files changed, 409 insertions(+), 199 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 4c77c18..dc8d267 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4087,10 +4087,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
*/
if (entity is SceneObjectPart)
{
- SceneObjectPart e = (SceneObjectPart)entity;
- SceneObjectGroup g = e.ParentGroup;
+ SceneObjectPart p = (SceneObjectPart)entity;
+ SceneObjectGroup g = p.ParentGroup;
if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
return; // Don't send updates for other people's HUDs
+
+ if((updateFlags ^ PrimUpdateFlags.SendInTransit) == 0)
+ {
+ List partIDs = (new List {p.LocalId});
+ lock (m_entityProps.SyncRoot)
+ m_entityProps.Remove(partIDs);
+ lock (m_entityUpdates.SyncRoot)
+ m_entityUpdates.Remove(partIDs);
+ return;
+ }
}
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 92485a1..87b76dc 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1703,11 +1703,81 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return agent;
}
+ public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx)
+ {
+ ulong regionhandler = neighbourRegion.RegionHandle;
+
+ if(agent.knowsNeighbourRegion(regionhandler))
+ return true;
+
+ string reason;
+ ulong currentRegionHandler = agent.Scene.RegionInfo.RegionHandle;
+ GridRegion source = new GridRegion(agent.Scene.RegionInfo);
+
+ AgentCircuitData currentAgentCircuit =
+ agent.Scene.AuthenticateHandler.GetAgentCircuitData(agent.ControllingClient.CircuitCode);
+ AgentCircuitData agentCircuit = agent.ControllingClient.RequestClientInfo();
+ agentCircuit.startpos = pos;
+ agentCircuit.child = true;
+
+ agentCircuit.Appearance = new AvatarAppearance();
+ agentCircuit.Appearance.AvatarHeight = agent.Appearance.AvatarHeight;
+
+ if (currentAgentCircuit != null)
+ {
+ agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs;
+ agentCircuit.IPAddress = currentAgentCircuit.IPAddress;
+ agentCircuit.Viewer = currentAgentCircuit.Viewer;
+ agentCircuit.Channel = currentAgentCircuit.Channel;
+ agentCircuit.Mac = currentAgentCircuit.Mac;
+ agentCircuit.Id0 = currentAgentCircuit.Id0;
+ }
+
+ agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
+ agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath);
+
+ IPEndPoint endPoint = neighbourRegion.ExternalEndPoint;
+ if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
+ {
+ string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
+ int newSizeX = neighbourRegion.RegionSizeX;
+ int newSizeY = neighbourRegion.RegionSizeY;
+
+ if (m_eqModule != null)
+ {
+ #region IP Translation for NAT
+ IClientIPEndpoint ipepClient;
+ if (agent.ClientView.TryGet(out ipepClient))
+ endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
+
+ m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
+ "and EstablishAgentCommunication with seed cap {8}", LogHeader,
+ source.RegionName, agent.Name,
+ neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath);
+
+ m_eqModule.EnableSimulator(regionhandler,
+ endPoint, agent.UUID, newSizeX, newSizeY);
+ m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath,
+ regionhandler, newSizeX, newSizeY);
+ }
+ else
+ {
+ agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint);
+ }
+ return true;
+ }
+ agent.RemoveNeighbourRegion(regionhandler);
+ return false;
+ }
+
public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx)
{
int ts = Util.EnvironmentTickCount();
+ bool sucess = true;
+ string reason = String.Empty;
try
{
+
AgentData cAgent = new AgentData();
agent.CopyTo(cAgent,true);
@@ -1725,18 +1795,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Beyond this point, extra cleanup is needed beyond removing transit state
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.Transferring);
- if (!agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx))
+ if (sucess && !agent.Scene.SimulationService.UpdateAgent(neighbourRegion, cAgent, ctx))
+ {
+ sucess = false;
+ reason = "agent update failed";
+ }
+
+ if(!sucess)
{
// region doesn't take it
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
m_log.WarnFormat(
- "[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.",
- neighbourRegion.RegionName, agent.Name);
+ "[ENTITY TRANSFER MODULE]: agent {0} crossing to {1} failed: {2}",
+ agent.Name, neighbourRegion.RegionName, reason);
ReInstantiateScripts(agent);
if(agent.ParentID == 0 && agent.ParentUUID == UUID.Zero)
+ {
agent.AddToPhysicalScene(isFlying);
+ }
return false;
}
@@ -1777,7 +1855,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
- Vector3 vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
+ Vector3 vel2 = Vector3.Zero;
+ if((agent.crossingFlags & 2) != 0)
+ vel2 = new Vector3(agent.Velocity.X, agent.Velocity.Y, 0);
if (m_eqModule != null)
{
@@ -1804,7 +1884,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// this may need the attachments
- agent.HasMovedAway(true);
+ agent.HasMovedAway((agent.crossingFlags & 8) == 0);
agent.MakeChildAgent(neighbourRegion.RegionHandle);
@@ -2135,7 +2215,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
0f);
}
-
+ #endregion
#region NotFoundLocationCache class
// A collection of not found locations to make future lookups 'not found' lookups quick.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index af70848..0e7ac58 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -538,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes
public bool inTransit = false;
- public delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos);
+ private delegate SceneObjectGroup SOGCrossDelegate(SceneObjectGroup sog,Vector3 pos, TeleportObjectData tpData);
///
/// The absolute position of this scene object in the scene
@@ -560,7 +560,7 @@ namespace OpenSim.Region.Framework.Scenes
{
inTransit = true;
SOGCrossDelegate d = CrossAsync;
- d.BeginInvoke(this, val, CrossAsyncCompleted, d);
+ d.BeginInvoke(this, val, null, CrossAsyncCompleted, d);
}
return;
}
@@ -601,7 +601,6 @@ namespace OpenSim.Region.Framework.Scenes
av.sitSOGmoved();
}
-
// now that position is changed tell it to scripts
if (triggerScriptEvent)
{
@@ -617,64 +616,75 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val)
+ private SceneObjectGroup CrossAsync(SceneObjectGroup sog, Vector3 val, TeleportObjectData tpdata)
{
Scene sogScene = sog.m_scene;
- IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface();
+ SceneObjectPart root = sog.RootPart;
- Vector3 newpos = Vector3.Zero;
- OpenSim.Services.Interfaces.GridRegion destination = null;
+ bool isTeleport = tpdata != null;
- if (sog.RootPart.DIE_AT_EDGE)
+ if(!isTeleport)
{
- try
- {
- sogScene.DeleteSceneObject(sog, false);
- }
- catch (Exception)
+ if (root.DIE_AT_EDGE)
{
- m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
+ try
+ {
+ sogScene.DeleteSceneObject(sog, false);
+ }
+ catch (Exception)
+ {
+ m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
+ }
+ return sog;
}
- return sog;
- }
- if (sog.RootPart.RETURN_AT_EDGE)
- {
- // We remove the object here
- try
+ if (root.RETURN_AT_EDGE)
{
- List localIDs = new List();
- localIDs.Add(sog.RootPart.LocalId);
- sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
- "Returned at region cross");
- sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
- }
- catch (Exception)
- {
- m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
+ // We remove the object here
+ try
+ {
+ List localIDs = new List();
+ localIDs.Add(root.LocalId);
+ sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
+ "Returned at region cross");
+ sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
+ }
+ catch (Exception)
+ {
+ m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
+ }
+ return sog;
}
- return sog;
}
- if (sog.m_rootPart.KeyframeMotion != null)
- sog.m_rootPart.KeyframeMotion.StartCrossingCheck();
+ if (root.KeyframeMotion != null)
+ root.KeyframeMotion.StartCrossingCheck();
+
+ if(root.PhysActor != null)
+ root.PhysActor.CrossingStart();
+
+ IEntityTransferModule entityTransfer = sogScene.RequestModuleInterface();
if (entityTransfer == null)
return sog;
+ Vector3 newpos = Vector3.Zero;
+ OpenSim.Services.Interfaces.GridRegion destination = null;
+
destination = entityTransfer.GetObjectDestination(sog, val, out newpos);
if (destination == null)
return sog;
if (sog.m_sittingAvatars.Count == 0)
{
- entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, true);
+ entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, !isTeleport, true);
return sog;
}
string reason = String.Empty;
EntityTransferContext ctx = new EntityTransferContext();
+ Vector3 curPos = root.GroupPosition;
foreach (ScenePresence av in sog.m_sittingAvatars)
{
// We need to cross these agents. First, let's find
@@ -685,10 +695,15 @@ namespace OpenSim.Region.Framework.Scenes
// We set the avatar position as being the object
// position to get the region to send to
+ if(av.IsNPC)
+ continue;
+
+ if(av.IsInTransit)
+ return sog;
+
if(!entityTransfer.checkAgentAccessToRegion(av, destination, newpos, ctx, out reason))
- {
return sog;
- }
+
m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName);
}
@@ -696,8 +711,10 @@ namespace OpenSim.Region.Framework.Scenes
// be made to stand up
List avsToCross = new List();
-
- foreach (ScenePresence av in sog.m_sittingAvatars)
+ List avsToCrossFar = new List();
+ ulong destHandle = destination.RegionHandle;
+ List sittingAvatars = GetSittingAvatars();
+ foreach (ScenePresence av in sittingAvatars)
{
byte cflags = 1;
@@ -711,68 +728,175 @@ namespace OpenSim.Region.Framework.Scenes
else
cflags = 3;
}
+ if(!av.knowsNeighbourRegion(destHandle))
+ cflags |= 8;
// 1 is crossing
// 2 is sitting
// 4 is sitting at sittarget
- av.crossingFlags = cflags;
+ // 8 far crossing
avinfo.av = av;
avinfo.ParentID = av.ParentID;
avsToCross.Add(avinfo);
+ if(!av.knowsNeighbourRegion(destHandle))
+ {
+ cflags |= 8;
+ avsToCrossFar.Add(av);
+ }
+
+ if(av.IsNPC)
+ av.crossingFlags = 0;
+ else
+ av.crossingFlags = cflags;
+
av.PrevSitOffset = av.OffsetPosition;
av.ParentID = 0;
}
+ Vector3 vel = root.Velocity;
+ Vector3 avel = root.AngularVelocity;
+ Vector3 acc = root.Acceleration;
+ Quaternion ori = root.RotationOffset;
+
+ if(isTeleport)
+ {
+ root.Stop();
+ sogScene.ForEachScenePresence(delegate(ScenePresence av)
+ {
+ av.ControllingClient.SendEntityUpdate(root,PrimUpdateFlags.SendInTransit);
+ av.ControllingClient.SendEntityTerseUpdateImmediate(root);
+ });
+
+ root.Velocity = tpdata.vel;
+ root.AngularVelocity = tpdata.avel;
+ root.Acceleration = tpdata.acc;
+ root.RotationOffset = tpdata.ori;
+ }
+
if (entityTransfer.CrossPrimGroupIntoNewRegion(destination, newpos, sog, true, false))
{
+ if(isTeleport)
+ {
+ sogScene.ForEachScenePresence(delegate(ScenePresence oav)
+ {
+ if(sittingAvatars.Contains(oav))
+ return;
+ if(oav.knowsNeighbourRegion(destHandle))
+ return;
+ oav.ControllingClient.SendEntityUpdate(root, PrimUpdateFlags.Kill);
+ foreach (ScenePresence sav in sittingAvatars)
+ {
+ sav.SendKillTo(oav);
+ }
+ });
+ }
+ bool crossedfar = false;
+ foreach (ScenePresence av in avsToCrossFar)
+ {
+ if(entityTransfer.CrossAgentCreateFarChild(av,destination, newpos, ctx))
+ crossedfar = true;
+ else
+ av.crossingFlags = 0;
+ }
+
+ if(crossedfar)
+ Thread.Sleep(1000);
+
foreach (avtocrossInfo avinfo in avsToCross)
{
ScenePresence av = avinfo.av;
- if (!av.IsInTransit) // just in case...
- {
- m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
+ av.IsInTransit = true;
+ m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val);
- av.IsInTransit = true;
+ if(av.crossingFlags > 0)
+ entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, false, ctx);
-// CrossAgentToNewRegionDelegate d = entityTransfer.CrossAgentToNewRegionAsync;
-// d.BeginInvoke(av, val, destination, av.Flying, version, CrossAgentToNewRegionCompleted, d);
- entityTransfer.CrossAgentToNewRegionAsync(av, newpos, destination, av.Flying, ctx);
- if (av.IsChildAgent)
- {
- // avatar crossed do some extra cleanup
- if (av.ParentUUID != UUID.Zero)
- {
- av.ClearControls();
- av.ParentPart = null;
- }
- }
- else
+ if (av.IsChildAgent)
+ {
+ // avatar crossed do some extra cleanup
+ if (av.ParentUUID != UUID.Zero)
{
- // avatar cross failed we need do dedicated standUp
- // part of it was done at CrossAgentToNewRegionAsync
- // so for now just remove the sog controls
- // this may need extra care
- av.UnRegisterSeatControls(sog.UUID);
+ av.ClearControls();
+ av.ParentPart = null;
}
-
av.ParentUUID = UUID.Zero;
+ av.ParentPart = null;
// In any case
av.IsInTransit = false;
av.crossingFlags = 0;
m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", av.Firstname, av.Lastname);
}
else
- m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar already in transit {0} to {1}", av.Name, val);
+ {
+ // avatar cross failed we need do dedicated standUp
+ // part of it was done at CrossAgentToNewRegionAsync
+ // so for now just remove the sog controls
+ // this may need extra care
+ av.UnRegisterSeatControls(sog.UUID);
+ av.ParentUUID = UUID.Zero;
+ av.ParentPart = null;
+ Vector3 oldp = curPos;
+ oldp.X = Util.Clamp(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f);
+ oldp.Y = Util.Clamp(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f);
+ av.AbsolutePosition = oldp;
+ av.crossingFlags = 0;
+ av.sitAnimation = "SIT";
+ av.IsInTransit = false;
+ if(av.Animator!= null)
+ av.Animator.SetMovementAnimations("STAND");
+ av.AddToPhysicalScene(false);
+ sogScene.ForEachScenePresence(delegate(ScenePresence oav)
+ {
+ if(sittingAvatars.Contains(oav))
+ return;
+ if(oav.knowsNeighbourRegion(destHandle))
+ av.SendAvatarDataToAgent(oav);
+ else
+ {
+ av.SendAvatarDataToAgent(oav);
+ av.SendAppearanceToAgent(oav);
+ if (av.Animator != null)
+ av.Animator.SendAnimPackToClient(oav.ControllingClient);
+ av.SendAttachmentsToAgentNF(oav); // not ok
+ }
+ });
+ m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} failed.", av.Firstname, av.Lastname);
+ }
}
+
+ if(crossedfar)
+ {
+ Thread.Sleep(10000);
+ foreach (ScenePresence av in avsToCrossFar)
+ {
+ if(av.IsChildAgent)
+ {
+ av.Scene.CloseAgent(av.UUID, false);
+ }
+ else
+ av.RemoveNeighbourRegion(destHandle);
+ }
+ }
+ avsToCrossFar.Clear();
avsToCross.Clear();
sog.RemoveScriptInstances(true);
sog.Clear();
return sog;
}
- else // cross failed, put avas back ??
+ else
{
+ if(isTeleport)
+ {
+ if((tpdata.flags & OSTPOBJ_STOPONFAIL) == 0)
+ {
+ root.Velocity = vel;
+ root.AngularVelocity = avel;
+ root.Acceleration = acc;
+ }
+ root.RotationOffset = ori;
+ }
foreach (avtocrossInfo avinfo in avsToCross)
{
ScenePresence av = avinfo.av;
@@ -782,7 +906,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
avsToCross.Clear();
-
return sog;
}
@@ -794,11 +917,14 @@ namespace OpenSim.Region.Framework.Scenes
if (!sog.IsDeleted)
{
SceneObjectPart rootp = sog.m_rootPart;
+
Vector3 oldp = rootp.GroupPosition;
oldp.X = Util.Clamp(oldp.X, 0.5f, sog.m_scene.RegionInfo.RegionSizeX - 0.5f);
oldp.Y = Util.Clamp(oldp.Y, 0.5f, sog.m_scene.RegionInfo.RegionSizeY - 0.5f);
rootp.GroupPosition = oldp;
+ rootp.Stop();
+
SceneObjectPart[] parts = sog.m_parts.GetArray();
foreach (SceneObjectPart part in parts)
@@ -812,57 +938,37 @@ namespace OpenSim.Region.Framework.Scenes
av.sitSOGmoved();
}
- sog.Velocity = Vector3.Zero;
-
if (sog.m_rootPart.KeyframeMotion != null)
sog.m_rootPart.KeyframeMotion.CrossingFailure();
if (sog.RootPart.PhysActor != null)
- {
sog.RootPart.PhysActor.CrossingFailure();
- }
sog.inTransit = false;
+ AttachToBackup();
sog.ScheduleGroupForFullUpdate();
}
}
-/* outdated
- private void CrossAgentToNewRegionCompleted(ScenePresence agent)
+ private class TeleportObjectData
{
- //// If the cross was successful, this agent is a child agent
- if (agent.IsChildAgent)
- {
- if (agent.ParentUUID != UUID.Zero)
- {
- agent.HandleForceReleaseControls(agent.ControllingClient,agent.UUID);
- agent.ParentPart = null;
-// agent.ParentPosition = Vector3.Zero;
-// agent.ParentUUID = UUID.Zero;
- }
- }
-
- agent.ParentUUID = UUID.Zero;
-// agent.Reset();
-// else // Not successful
-// agent.RestoreInCurrentScene();
-
- // In any case
- agent.IsInTransit = false;
-
- m_log.DebugFormat("[SCENE OBJECT]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
+ public int flags;
+ public Vector3 vel;
+ public Vector3 avel;
+ public Vector3 acc;
+ public Quaternion ori;
+ public UUID sourceID;
}
-*/
// copy from LSL_constants.cs
- const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination
+ const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination
const int OSTPOBJ_STOPONFAIL = 0x2; // stops at start if tp fails
const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation
- public void TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags)
+ public int TeleportObject(UUID sourceID, Vector3 targetPosition, Quaternion rotation, int flags)
{
if(inTransit || IsDeleted || IsAttachmentCheckFull() || IsSelected || Scene == null)
- return;
+ return -1;
inTransit = true;
@@ -870,7 +976,41 @@ namespace OpenSim.Region.Framework.Scenes
if(pa == null || RootPart.KeyframeMotion != null /*|| m_sittingAvatars.Count == 0*/)
{
inTransit = false;
- return;
+ return -1;
+ }
+
+ bool stop = (flags & OSTPOBJ_STOPATTARGET) != 0;
+ bool setrot = (flags & OSTPOBJ_SETROT) != 0;
+
+ rotation.Normalize();
+
+ Quaternion currentRot = RootPart.RotationOffset;
+ if(setrot)
+ rotation = Quaternion.Conjugate(currentRot) * rotation;
+
+ bool dorot = setrot | (Math.Abs(rotation.W) < 0.99999);
+
+ Vector3 vel = Vector3.Zero;
+ Vector3 avel = Vector3.Zero;
+ Vector3 acc = Vector3.Zero;
+
+ if(!stop)
+ {
+ vel = RootPart.Velocity;
+ avel = RootPart.AngularVelocity;
+ acc = RootPart.Acceleration;
+ }
+ Quaternion ori = RootPart.RotationOffset;
+
+ if(dorot)
+ {
+ if(!stop)
+ {
+ vel *= rotation;
+ avel *= rotation;
+ acc *= rotation;
+ }
+ ori *= rotation;
}
if(Scene.PositionIsInCurrentRegion(targetPosition))
@@ -878,7 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes
if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 1.0))
{
inTransit = false;
- return;
+ return -2;
}
Vector3 curPos = AbsolutePosition;
@@ -891,7 +1031,7 @@ namespace OpenSim.Region.Framework.Scenes
if(!Scene.Permissions.CanObjectEnterWithScripts(this, land))
{
inTransit = false;
- return;
+ return -3;
}
UUID agentID;
@@ -901,49 +1041,15 @@ namespace OpenSim.Region.Framework.Scenes
if(land.IsRestrictedFromLand(agentID) || land.IsBannedFromLand(agentID))
{
inTransit = false;
- return;
+ return -4;
}
}
}
- bool stop = (flags & OSTPOBJ_STOPATTARRGET) != 0;
- bool setrot = (flags & OSTPOBJ_SETROT) != 0;
-
- rotation.Normalize();
- Quaternion currentRot = RootPart.RotationOffset;
-
- if(setrot)
- rotation = Quaternion.Conjugate(currentRot) * rotation;
-
- bool dorot = setrot | (Math.Abs(rotation.W) < 0.999);
-
- if(stop)
- {
- RootPart.Stop();
- }
- else
- {
- if(dorot)
- {
- Vector3 vel = RootPart.Velocity;
- Vector3 avel = RootPart.AngularVelocity;
- Vector3 acc = RootPart.Acceleration;
-
- vel *= rotation;
- avel *= rotation;
- acc *= rotation;
-
- RootPart.Velocity = vel;
- RootPart.AngularVelocity = avel;
- RootPart.Acceleration = acc;
- }
- }
-
- if(dorot)
- {
- currentRot *= rotation;
- RootPart.RotationOffset = currentRot;
- }
+ RootPart.Velocity = vel;
+ RootPart.AngularVelocity = avel;
+ RootPart.Acceleration = acc;
+ RootPart.RotationOffset = ori;
Vector3 s = RootPart.Scale * RootPart.RotationOffset;
float h = Scene.GetGroundHeight(posX, posY) + 0.5f * (float)Math.Abs(s.Z) + 0.01f;
@@ -953,10 +1059,27 @@ namespace OpenSim.Region.Framework.Scenes
inTransit = false;
AbsolutePosition = targetPosition;
RootPart.ScheduleTerseUpdate();
- return;
+ return 1;
}
- inTransit = false;
+ if(Scene.InTeleportTargetsCoolDown(UUID, sourceID, 20.0))
+ {
+ inTransit = false;
+ return -1;
+ }
+
+ TeleportObjectData tdata = new TeleportObjectData();
+ tdata.flags = flags;
+ tdata.vel = vel;
+ tdata.avel = avel;
+ tdata.acc = acc;
+ tdata.ori = ori;
+ tdata.sourceID = sourceID;
+
+
+ SOGCrossDelegate d = CrossAsync;
+ d.BeginInvoke(this, targetPosition, tdata, CrossAsyncCompleted, d);
+ return 0;
}
public override Vector3 Velocity
@@ -5398,9 +5521,9 @@ namespace OpenSim.Region.Framework.Scenes
{
if (avs[i].Name == name)
{
- GetLinkNumber_lastname = name;
- GetLinkNumber_lastnumber = j;
- return j;
+ GetLinkNumber_lastname = name;
+ GetLinkNumber_lastnumber = j;
+ return j;
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8d04c9f..affd4de 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1066,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
m_angularVelocity = value;
PhysicsActor actor = PhysActor;
- if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this && VehicleType == (int)Vehicle.TYPE_NONE)
+ if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this)
{
actor.RotationalVelocity = m_angularVelocity;
}
@@ -1092,6 +1092,12 @@ namespace OpenSim.Region.Framework.Scenes
m_acceleration = Vector3.Zero;
else
m_acceleration = value;
+
+ PhysicsActor actor = PhysActor;
+ if ((actor != null) && actor.IsPhysical && ParentGroup.RootPart == this)
+ {
+ actor.Acceleration = m_acceleration;
+ }
}
}
@@ -2016,7 +2022,7 @@ namespace OpenSim.Region.Framework.Scenes
// SetVelocity for LSL llSetVelocity.. may need revision if having other uses in future
public void SetVelocity(Vector3 pVel, bool localGlobalTF)
{
- if (ParentGroup == null || ParentGroup.IsDeleted)
+ if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
return;
if (ParentGroup.IsAttachment)
@@ -2043,7 +2049,7 @@ namespace OpenSim.Region.Framework.Scenes
// SetAngularVelocity for LSL llSetAngularVelocity.. may need revision if having other uses in future
public void SetAngularVelocity(Vector3 pAngVel, bool localGlobalTF)
{
- if (ParentGroup == null || ParentGroup.IsDeleted)
+ if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
return;
if (ParentGroup.IsAttachment)
@@ -2077,6 +2083,9 @@ namespace OpenSim.Region.Framework.Scenes
/// true for the local frame, false for the global frame
public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
{
+ if (ParentGroup == null || ParentGroup.IsDeleted || ParentGroup.inTransit)
+ return;
+
Vector3 impulse = impulsei;
if (localGlobalTF)
@@ -3376,25 +3385,7 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
///
public void SendFullUpdateToClient(IClientAPI remoteClient)
{
- SendFullUpdateToClient(remoteClient, OffsetPosition);
- }
-
- ///
- /// Sends a full update to the client
- ///
- ///
- ///
- public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos)
- {
- if (ParentGroup == null)
- return;
-
- // Suppress full updates during attachment editing
- // sl Does send them
- // if (ParentGroup.IsSelected && ParentGroup.IsAttachment)
- // return;
-
- if (ParentGroup.IsDeleted)
+ if (ParentGroup == null || ParentGroup.IsDeleted)
return;
if (ParentGroup.IsAttachment
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 0d8eeec..bf0400b 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private Vector3 m_lastposition;
private Vector3 m_rotationalVelocity;
private Vector3 _size;
- private Vector3 _acceleration;
+ private Vector3 m_acceleration;
private IntPtr Amotor;
internal Vector3 m_force;
@@ -746,8 +746,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public override Vector3 Acceleration
{
- get { return _acceleration; }
- set { }
+ get { return m_acceleration; }
+ set
+ {
+ if(m_outbounds)
+ m_acceleration = value;
+ }
}
public override Vector3 RotationalVelocity
@@ -767,7 +771,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
if (value.IsFinite())
{
- AddChange(changes.AngVelocity, value);
+ if(m_outbounds)
+ m_rotationalVelocity = value;
+ else
+ AddChange(changes.AngVelocity, value);
}
else
{
@@ -941,7 +948,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
public void SetAcceleration(Vector3 accel)
{
- _acceleration = accel;
+ m_acceleration = accel;
}
public override void AddForce(Vector3 force, bool pushforce)
@@ -2748,7 +2755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_angularForceacc = Vector3.Zero;
// m_torque = Vector3.Zero;
_velocity = Vector3.Zero;
- _acceleration = Vector3.Zero;
+ m_acceleration = Vector3.Zero;
m_rotationalVelocity = Vector3.Zero;
_target_velocity = Vector3.Zero;
if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
@@ -3784,9 +3791,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_outbounds = true;
lpos.Z = Util.Clip(lpos.Z, -100f, 100000f);
- _acceleration.X = 0;
- _acceleration.Y = 0;
- _acceleration.Z = 0;
+ m_acceleration.X = 0;
+ m_acceleration.Y = 0;
+ m_acceleration.Z = 0;
_velocity.X = 0;
_velocity.Y = 0;
@@ -3915,12 +3922,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
_orientation.W = ori.W;
}
- // update velocities and aceleration
+ // update velocities and acceleration
if (_zeroFlag || lastZeroFlag)
{
// disable interpolators
_velocity = Vector3.Zero;
- _acceleration = Vector3.Zero;
+ m_acceleration = Vector3.Zero;
m_rotationalVelocity = Vector3.Zero;
}
else
@@ -3929,7 +3936,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
d.Vector3 vel = d.BodyGetLinearVel(Body);
- _acceleration = _velocity;
+ m_acceleration = _velocity;
if ((Math.Abs(vel.X) < 0.005f) &&
(Math.Abs(vel.Y) < 0.005f) &&
@@ -3937,21 +3944,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
_velocity = Vector3.Zero;
float t = -m_invTimeStep;
- _acceleration = _acceleration * t;
+ m_acceleration = m_acceleration * t;
}
else
{
_velocity.X = vel.X;
_velocity.Y = vel.Y;
_velocity.Z = vel.Z;
- _acceleration = (_velocity - _acceleration) * m_invTimeStep;
+ m_acceleration = (_velocity - m_acceleration) * m_invTimeStep;
}
- if ((Math.Abs(_acceleration.X) < 0.01f) &&
- (Math.Abs(_acceleration.Y) < 0.01f) &&
- (Math.Abs(_acceleration.Z) < 0.01f))
+ if ((Math.Abs(m_acceleration.X) < 0.01f) &&
+ (Math.Abs(m_acceleration.Y) < 0.01f) &&
+ (Math.Abs(m_acceleration.Z) < 0.01f))
{
- _acceleration = Vector3.Zero;
+ m_acceleration = Vector3.Zero;
}
vel = d.BodyGetAngularVel(Body);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b3bd8c4..e12cedf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -4664,7 +4664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// has a cool down time. retries before expire reset it
/// fail conditions are silent ignored
///
- public void osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
+ public LSL_Integer osTeleportObject(LSL_Key objectUUID, LSL_Vector targetPos, LSL_Rotation rotation, LSL_Integer flags)
{
CheckThreatLevel(ThreatLevel.Severe, "osTeleportObject");
m_host.AddScriptLPS(1);
@@ -4673,16 +4673,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(objectUUID, out objUUID))
{
OSSLShoutError("osTeleportObject() invalid object Key");
- return;
+ return -1;
}
SceneObjectGroup sog = World.GetSceneObjectGroup(objUUID);
if(sog== null || sog.IsDeleted)
- return;
+ return -1;
UUID myid = m_host.ParentGroup.UUID;
- sog.TeleportObject(myid, targetPos, rotation, flags);
+ return sog.TeleportObject(myid, targetPos, rotation, flags);
// a delay here may break vehicles
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 08b144a..bd5d008 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -51,7 +51,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
///
public enum ThreatLevel
{
- // Not documented, presumably means permanently disabled ?
NoAccess = -1,
///
@@ -496,7 +495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osSetInertiaAsSphere(LSL_Float mass, LSL_Float radius, vector centerOfMass);
void osSetInertiaAsCylinder(LSL_Float mass, LSL_Float radius, LSL_Float lenght, vector centerOfMass,rotation lslrot);
- void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags);
+ LSL_Integer osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags);
LSL_Integer osGetLinkNumber(LSL_String name);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index 59493a3..ce0fa48 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -856,7 +856,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
// for osTeleportObject
public const int OSTPOBJ_NONE = 0x0;
- public const int OSTPOBJ_STOPATTARRGET = 0x1; // stops at destination
+ public const int OSTPOBJ_STOPATTARGET = 0x1; // stops at destination
public const int OSTPOBJ_STOPONFAIL = 0x2; // stops at jump point if tp fails
public const int OSTPOBJ_SETROT = 0x4; // the rotation is the final rotation, otherwise is a added rotation
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 7c08628..9eac114 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1140,9 +1140,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osClearInertia();
}
- public void osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags)
+ public LSL_Integer osTeleportObject(LSL_Key objectUUID, vector targetPos, rotation targetrotation, LSL_Integer flags)
{
- m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
+ return m_OSSL_Functions.osTeleportObject(objectUUID, targetPos, targetrotation, flags);
}
public LSL_Integer osGetLinkNumber(LSL_String name)
--
cgit v1.1
From b52f7b920342b7ea3e0294eae054e7520801e339 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 15 Apr 2017 10:56:46 +0100
Subject: missing file and remove warnings
---
OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | 2 ++
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
index 9585082..1b690ba 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs
@@ -102,6 +102,8 @@ namespace OpenSim.Region.Framework.Interfaces
ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx);
+ bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx);
+
bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition);
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0e7ac58..e73795e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes
timeLastChanged = DateTime.UtcNow.Ticks;
if (!m_hasGroupChanged)
timeFirstChanged = DateTime.UtcNow.Ticks;
- if (m_rootPart != null && m_rootPart.UUID != null && m_scene != null)
+ if (m_rootPart != null && m_scene != null)
{
/*
if (m_rand == null)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d50de27..6d4cb52 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -6488,7 +6488,7 @@ namespace OpenSim.Region.Framework.Scenes
if (check)
{
// check is relative to current parcel only
- if (currentParcelUUID == null || oldhide == currentParcelHide)
+ if (oldhide == currentParcelHide)
return;
allpresences = m_scene.GetScenePresences();
--
cgit v1.1
From 9354e60df0c4046d9010ee0e520d1b90a2836757 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 16 Apr 2017 03:39:35 +0100
Subject: fix active objects count down, a path at least
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 6b29ec1..a005068 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -549,6 +549,8 @@ namespace OpenSim.Region.Framework.Scenes
// that are part of the Scene Object being removed
m_numTotalPrim -= grp.PrimCount;
+ bool isPh = (grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics;
+ int nphysparts = 0;
// Go through all parts (primitives and meshes) of this Scene Object
foreach (SceneObjectPart part in grp.Parts)
{
@@ -559,10 +561,13 @@ namespace OpenSim.Region.Framework.Scenes
m_numMesh--;
else
m_numPrim--;
+
+ if(isPh && part.PhysicsShapeType != (byte)PhysShapeType.none)
+ nphysparts++;
}
- if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
- RemovePhysicalPrim(grp.PrimCount);
+ if (nphysparts > 0 )
+ RemovePhysicalPrim(nphysparts);
}
bool ret = Entities.Remove(uuid);
--
cgit v1.1
From 49884b94a78bcf45c25b72e1f9fae593de16864f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 18 Apr 2017 00:50:55 +0100
Subject: update ODE binaries for windows. Other platforms need to compile
from opensim-libs repo, folder ODE-OpenSim-0.13.2, read file
OPENSIM-README.txt. Remove code to reduce bounce on non physical placement,
new unmanaged should handle that
---
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 199 ++++++++++---------------
1 file changed, 77 insertions(+), 122 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index bf0400b..7b77d2f 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -111,7 +111,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private int m_body_autodisable_frames;
public int m_bodydisablecontrol = 0;
- public int m_bodyMoveCoolDown = 0;
private float m_gravmod = 1.0f;
// Default we're a Geometry
@@ -1030,18 +1029,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde
d.AllocateODEDataForThread(0);
if(Body != IntPtr.Zero)
{
- if(m_bodyMoveCoolDown >= 0)
- {
- d.Vector3 dtmp = d.BodyGetAngularVel(Body);
- m_rotationalVelocity.X = dtmp.X;
- m_rotationalVelocity.Y = dtmp.Y;
- m_rotationalVelocity.Z = dtmp.Z;
+ d.Vector3 dtmp = d.BodyGetAngularVel(Body);
+ m_rotationalVelocity.X = dtmp.X;
+ m_rotationalVelocity.Y = dtmp.Y;
+ m_rotationalVelocity.Z = dtmp.Z;
+
+ dtmp = d.BodyGetLinearVel(Body);
+ _velocity.X = dtmp.X;
+ _velocity.Y = dtmp.Y;
+ _velocity.Z = dtmp.Z;
- dtmp = d.BodyGetLinearVel(Body);
- _velocity.X = dtmp.X;
- _velocity.Y = dtmp.Y;
- _velocity.Z = dtmp.Z;
- }
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
d.BodySetAngularVel(Body, 0, 0, 0);
}
@@ -1345,7 +1342,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
bounce = parent_scene.m_materialContactsData[(int)Material.Wood].bounce;
m_building = true; // control must set this to false when done
- m_bodyMoveCoolDown = 0;
AddChange(changes.Add, null);
@@ -2144,14 +2140,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
- /*
d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
- */
+
_zeroFlag = false;
m_bodydisablecontrol = 0;
}
- m_bodyMoveCoolDown = -5;
_parent_scene.addActiveGroups(this);
}
@@ -2244,7 +2238,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
m_mass = primMass;
m_collisionscore = 0;
- m_bodyMoveCoolDown = 0;
}
private void FixInertia(Vector3 NewPos,Quaternion newrot)
@@ -2907,7 +2900,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
_zeroFlag = true;
d.BodyEnable(Body);
- m_bodyMoveCoolDown = -5;
}
}
// else if (_parent != null)
@@ -2950,8 +2942,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
_position = newPos;
- if (Body != IntPtr.Zero && !m_disabled)
- m_bodyMoveCoolDown = -5;
}
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
{
@@ -3016,7 +3006,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
if(m_angularlocks != 0)
createAMotor(m_angularlocks);
- m_bodyMoveCoolDown = -5;
}
}
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
@@ -3391,8 +3380,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
enableBodySoft();
else if (!d.BodyIsEnabled(Body))
d.BodyEnable(Body);
- if(m_bodyMoveCoolDown >= 0)
- d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
}
//resetCollisionAccounting();
}
@@ -3416,9 +3403,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
enableBodySoft();
else if (!d.BodyIsEnabled(Body))
d.BodyEnable(Body);
-
- if(m_bodyMoveCoolDown >= 0);
- d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
}
//resetCollisionAccounting();
}
@@ -3569,26 +3553,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (!childPrim && m_isphysical && Body != IntPtr.Zero &&
!m_disabled && !m_isSelected && !m_building && !m_outbounds)
{
- if(m_bodyMoveCoolDown < 0)
- {
- m_bodyMoveCoolDown++;
-// if(!IsColliding)
-// m_bodyCoolDown +=2;
- if(m_bodyMoveCoolDown >= 0)
- {
- d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z);
- d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
- }
- else
- {
- d.BodySetAngularVel(Body, 0, 0, 0);
- d.BodySetLinearVel(Body, 0, 0, 0);
- m_forceacc = Vector3.Zero;
- m_angularForceacc = Vector3.Zero;
- _zeroFlag = false;
- return;
- }
- }
if (!d.BodyIsEnabled(Body))
{
// let vehicles sleep
@@ -3844,18 +3808,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_lastposition = _position;
m_lastorientation = _orientation;
- if(m_bodyMoveCoolDown >= 0)
- {
- d.Vector3 dtmp = d.BodyGetAngularVel(Body);
- m_rotationalVelocity.X = dtmp.X;
- m_rotationalVelocity.Y = dtmp.Y;
- m_rotationalVelocity.Z = dtmp.Z;
-
- dtmp = d.BodyGetLinearVel(Body);
- _velocity.X = dtmp.X;
- _velocity.Y = dtmp.Y;
- _velocity.Z = dtmp.Z;
- }
+ d.Vector3 dtmp = d.BodyGetAngularVel(Body);
+ m_rotationalVelocity.X = dtmp.X;
+ m_rotationalVelocity.Y = dtmp.Y;
+ m_rotationalVelocity.Z = dtmp.Z;
+
+ dtmp = d.BodyGetLinearVel(Body);
+ _velocity.X = dtmp.X;
+ _velocity.Y = dtmp.Y;
+ _velocity.Z = dtmp.Z;
d.BodySetLinearVel(Body, 0, 0, 0); // stop it
d.BodySetAngularVel(Body, 0, 0, 0);
@@ -3880,33 +3841,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
- if(m_bodyMoveCoolDown >= 0)
+ float poserror;
+ float angerror;
+ if(_zeroFlag)
{
- float poserror;
- float angerror;
- if(_zeroFlag)
- {
- poserror = 0.01f;
- angerror = 0.001f;
- }
- else
- {
- poserror = 0.005f;
- angerror = 0.0005f;
- }
-
- if (
- (Math.Abs(_position.X - lpos.X) < poserror)
- && (Math.Abs(_position.Y - lpos.Y) < poserror)
- && (Math.Abs(_position.Z - lpos.Z) < poserror)
- && (Math.Abs(_orientation.X - ori.X) < angerror)
- && (Math.Abs(_orientation.Y - ori.Y) < angerror)
- && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W
- )
- _zeroFlag = true;
- else
- _zeroFlag = false;
+ poserror = 0.01f;
+ angerror = 0.001f;
}
+ else
+ {
+ poserror = 0.005f;
+ angerror = 0.0005f;
+ }
+
+ if (
+ (Math.Abs(_position.X - lpos.X) < poserror)
+ && (Math.Abs(_position.Y - lpos.Y) < poserror)
+ && (Math.Abs(_position.Z - lpos.Z) < poserror)
+ && (Math.Abs(_orientation.X - ori.X) < angerror)
+ && (Math.Abs(_orientation.Y - ori.Y) < angerror)
+ && (Math.Abs(_orientation.Z - ori.Z) < angerror) // ignore W
+ )
+ _zeroFlag = true;
+ else
+ _zeroFlag = false;
}
// update position
@@ -3932,49 +3890,46 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
else
{
- if(m_bodyMoveCoolDown >= 0)
- {
- d.Vector3 vel = d.BodyGetLinearVel(Body);
+ d.Vector3 vel = d.BodyGetLinearVel(Body);
- m_acceleration = _velocity;
+ m_acceleration = _velocity;
- if ((Math.Abs(vel.X) < 0.005f) &&
- (Math.Abs(vel.Y) < 0.005f) &&
- (Math.Abs(vel.Z) < 0.005f))
- {
- _velocity = Vector3.Zero;
- float t = -m_invTimeStep;
- m_acceleration = m_acceleration * t;
- }
- else
- {
- _velocity.X = vel.X;
- _velocity.Y = vel.Y;
- _velocity.Z = vel.Z;
- m_acceleration = (_velocity - m_acceleration) * m_invTimeStep;
- }
+ if ((Math.Abs(vel.X) < 0.005f) &&
+ (Math.Abs(vel.Y) < 0.005f) &&
+ (Math.Abs(vel.Z) < 0.005f))
+ {
+ _velocity = Vector3.Zero;
+ float t = -m_invTimeStep;
+ m_acceleration = m_acceleration * t;
+ }
+ else
+ {
+ _velocity.X = vel.X;
+ _velocity.Y = vel.Y;
+ _velocity.Z = vel.Z;
+ m_acceleration = (_velocity - m_acceleration) * m_invTimeStep;
+ }
- if ((Math.Abs(m_acceleration.X) < 0.01f) &&
- (Math.Abs(m_acceleration.Y) < 0.01f) &&
- (Math.Abs(m_acceleration.Z) < 0.01f))
- {
- m_acceleration = Vector3.Zero;
- }
+ if ((Math.Abs(m_acceleration.X) < 0.01f) &&
+ (Math.Abs(m_acceleration.Y) < 0.01f) &&
+ (Math.Abs(m_acceleration.Z) < 0.01f))
+ {
+ m_acceleration = Vector3.Zero;
+ }
- vel = d.BodyGetAngularVel(Body);
- if ((Math.Abs(vel.X) < 0.0001) &&
- (Math.Abs(vel.Y) < 0.0001) &&
- (Math.Abs(vel.Z) < 0.0001)
- )
- {
- m_rotationalVelocity = Vector3.Zero;
- }
- else
- {
- m_rotationalVelocity.X = vel.X;
- m_rotationalVelocity.Y = vel.Y;
- m_rotationalVelocity.Z = vel.Z;
- }
+ vel = d.BodyGetAngularVel(Body);
+ if ((Math.Abs(vel.X) < 0.0001) &&
+ (Math.Abs(vel.Y) < 0.0001) &&
+ (Math.Abs(vel.Z) < 0.0001)
+ )
+ {
+ m_rotationalVelocity = Vector3.Zero;
+ }
+ else
+ {
+ m_rotationalVelocity.X = vel.X;
+ m_rotationalVelocity.Y = vel.Y;
+ m_rotationalVelocity.Z = vel.Z;
}
}
--
cgit v1.1
From 006c08886a2af6d2287e6ef8bc67428b61ff9998 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 18 Apr 2017 05:31:15 +0100
Subject: deleted a bit 2 much on last commit
---
OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 2 ++
OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
index 7b77d2f..9bf71f7 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs
@@ -3380,6 +3380,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
enableBodySoft();
else if (!d.BodyIsEnabled(Body))
d.BodyEnable(Body);
+ d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z);
}
//resetCollisionAccounting();
}
@@ -3403,6 +3404,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
enableBodySoft();
else if (!d.BodyIsEnabled(Body))
d.BodyEnable(Body);
+ d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z);
}
//resetCollisionAccounting();
}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index a4c3f92..be652c0 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -727,8 +727,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (g1 == g2)
return; // Can't collide with yourself
- if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
- return;
+// if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
+// return;
/*
// debug
PhysicsActor dp2;
@@ -1176,6 +1176,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
aprim.clearSleeperCollisions();
}
}
+
lock (_activegroups)
{
try
--
cgit v1.1
From 84c9125016f964df9c77df7553aee6693fccb2e6 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Thu, 20 Apr 2017 02:25:22 +0100
Subject: update ode binaries for windows; add a minimal velocity for bounce
---
OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
index be652c0..86d41ea 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs
@@ -529,6 +529,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SharedTmpcontact.surface.mode = comumContactFlags;
SharedTmpcontact.surface.mu = 0;
SharedTmpcontact.surface.bounce = 0;
+ SharedTmpcontact.surface.bounce_vel = 1.5f;
SharedTmpcontact.surface.soft_cfm = comumContactCFM;
SharedTmpcontact.surface.soft_erp = comumContactERP;
SharedTmpcontact.surface.slip1 = comumContactSLIP;
--
cgit v1.1
From 54819fa4ae0f09712475cd98b45eeca352c8743c Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 21 Apr 2017 11:03:31 +0100
Subject: mantis 8154 dont let self lResetOtherScript mean harakiri
---
.../Shared/Api/Implementation/LSL_Api.cs | 166 ++++++++++-----------
1 file changed, 77 insertions(+), 89 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 62654ee..443ea72 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -494,12 +494,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
UUID item;
- m_host.AddScriptLPS(1);
-
- if ((item = GetScriptByName(name)) != UUID.Zero)
- m_ScriptEngine.ResetScript(item);
- else
+ if ((item = GetScriptByName(name)) == UUID.Zero)
+ {
+ m_host.AddScriptLPS(1);
Error("llResetOtherScript", "Can't find script '" + name + "'");
+ return;
+ }
+ if(item == m_item.ItemID)
+ llResetScript();
+ else
+ {
+ m_host.AddScriptLPS(1);
+ m_ScriptEngine.ResetScript(item);
+ }
}
public LSL_Integer llGetScriptState(string name)
@@ -2725,9 +2732,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// if TRUE, will cap the distance to 10m.
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust)
{
- if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
+ if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted || part.ParentGroup.inTransit)
return;
+
LSL_Vector currentPos = GetPartLocalPos(part);
LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust);
@@ -5751,29 +5759,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return 0;
- }
+
+ object item = src.Data[index];
// Vectors & Rotations always return zero in SL, but
// keys don't always return zero, it seems to be a bit complex.
- else if (src.Data[index] is LSL_Vector ||
- src.Data[index] is LSL_Rotation)
- {
+ if (item is LSL_Vector || item is LSL_Rotation)
return 0;
- }
+
try
{
-
- if (src.Data[index] is LSL_Integer)
- return (LSL_Integer)src.Data[index];
- else if (src.Data[index] is LSL_Float)
- return Convert.ToInt32(((LSL_Float)src.Data[index]).value);
- return new LSL_Integer(src.Data[index].ToString());
+ if (item is LSL_Integer)
+ return (LSL_Integer)item;
+ else if (item is LSL_Float)
+ return Convert.ToInt32(((LSL_Float)item).value);;
+ return new LSL_Integer(item.ToString());
}
catch (FormatException)
{
@@ -5785,38 +5789,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
- return 0.0;
- }
+ return 0;
+
+ object item = src.Data[index];
// Vectors & Rotations always return zero in SL
- else if (src.Data[index] is LSL_Vector ||
- src.Data[index] is LSL_Rotation)
- {
+ if(item is LSL_Vector || item is LSL_Rotation)
return 0;
- }
+
// valid keys seem to get parsed as integers then converted to floats
- else
+ if (item is LSL_Key)
{
UUID uuidt;
- if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt))
- {
- return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value);
- }
+ string s = item.ToString();
+ if(UUID.TryParse(s, out uuidt))
+ return Convert.ToDouble(new LSL_Integer(s).value);
+ else
+ return 0;
}
+
try
{
- if (src.Data[index] is LSL_Integer)
- return Convert.ToDouble(((LSL_Integer)src.Data[index]).value);
- else if (src.Data[index] is LSL_Float)
- return Convert.ToDouble(((LSL_Float)src.Data[index]).value);
- else if (src.Data[index] is LSL_String)
+ if (item is LSL_Integer)
+ return Convert.ToDouble(((LSL_Integer)item).value);
+ else if (item is LSL_Float)
+ return Convert.ToDouble(((LSL_Float)item).value);
+ else if (item is LSL_String)
{
- string str = ((LSL_String) src.Data[index]).m_string;
+ string str = ((LSL_String)item).m_string;
Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)");
if (m != Match.Empty)
{
@@ -5824,12 +5827,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
double d = 0.0;
if (!Double.TryParse(str, out d))
return 0.0;
-
return d;
}
return 0.0;
}
- return Convert.ToDouble(src.Data[index]);
+ return Convert.ToDouble(item);
}
catch (FormatException)
{
@@ -5841,13 +5843,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return String.Empty;
- }
+
return src.Data[index].ToString();
}
@@ -5855,14 +5855,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
if (index >= src.Length || index < 0)
- {
- return "";
- }
+ return String.Empty;
+
+ object item = src.Data[index];
// SL spits out an empty string for types other than key & string
// At the time of patching, LSL_Key is currently LSL_String,
@@ -5871,31 +5869,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// as it's own struct
// NOTE: 3rd case is needed because a NULL_KEY comes through as
// type 'obj' and wrongly returns ""
- else if (!(src.Data[index] is LSL_String ||
- src.Data[index] is LSL_Key ||
- src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000"))
+ if (!(item is LSL_String ||
+ item is LSL_Key ||
+ item.ToString() == "00000000-0000-0000-0000-000000000000"))
{
- return "";
+ return String.Empty;
}
- return src.Data[index].ToString();
+ return item.ToString();
}
public LSL_Vector llList2Vector(LSL_List src, int index)
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return new LSL_Vector(0, 0, 0);
- }
- if (src.Data[index].GetType() == typeof(LSL_Vector))
- {
- return (LSL_Vector)src.Data[index];
- }
+
+ object item = src.Data[index];
+
+ if (item.GetType() == typeof(LSL_Vector))
+ return (LSL_Vector)item;
// SL spits always out ZERO_VECTOR for anything other than
// strings or vectors. Although keys always return ZERO_VECTOR,
@@ -5903,28 +5899,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// a string, a key as string and a string that by coincidence
// is a string, so we're going to leave that up to the
// LSL_Vector constructor.
- else if (!(src.Data[index] is LSL_String ||
- src.Data[index] is LSL_Vector))
- {
- return new LSL_Vector(0, 0, 0);
- }
- else
- {
- return new LSL_Vector(src.Data[index].ToString());
- }
+ if(item is LSL_Vector)
+ return (LSL_Vector) item;
+
+ if (item is LSL_String)
+ return new LSL_Vector(item.ToString());
+
+ return new LSL_Vector(0, 0, 0);
}
public LSL_Rotation llList2Rot(LSL_List src, int index)
{
m_host.AddScriptLPS(1);
if (index < 0)
- {
index = src.Length + index;
- }
+
if (index >= src.Length || index < 0)
- {
return new LSL_Rotation(0, 0, 0, 1);
- }
+
+ object item = src.Data[index];
// SL spits always out ZERO_ROTATION for anything other than
// strings or vectors. Although keys always return ZERO_ROTATION,
@@ -5932,19 +5925,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// a string, a key as string and a string that by coincidence
// is a string, so we're going to leave that up to the
// LSL_Rotation constructor.
- else if (!(src.Data[index] is LSL_String ||
- src.Data[index] is LSL_Rotation))
- {
- return new LSL_Rotation(0, 0, 0, 1);
- }
- else if (src.Data[index].GetType() == typeof(LSL_Rotation))
- {
- return (LSL_Rotation)src.Data[index];
- }
- else
- {
+
+ if (item.GetType() == typeof(LSL_Rotation))
+ return (LSL_Rotation)item;
+
+ if (item is LSL_String)
return new LSL_Rotation(src.Data[index].ToString());
- }
+
+ return new LSL_Rotation(0, 0, 0, 1);
}
public LSL_List llList2List(LSL_List src, int start, int end)
--
cgit v1.1
From 65a154720955536fa2327ace99e3ae0d72a585ad Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 24 Apr 2017 02:05:39 +0100
Subject: fix (or actually break) llList2float() since LSL_Key is same as
LSL_String, the case of invalid LSL_Key cannot be handle, since most likely
it is a string
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 443ea72..31be2fb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5807,8 +5807,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string s = item.ToString();
if(UUID.TryParse(s, out uuidt))
return Convert.ToDouble(new LSL_Integer(s).value);
- else
- return 0;
+// we can't do this because a string is also a LSL_Key for now :(
+// else
+// return 0;
}
try
--
cgit v1.1
From c91e1012242dcc7808688099f2145a61c5ac7820 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 24 Apr 2017 07:06:48 +0100
Subject: add suport for materials parameters PRIM_NORMAL, PRIM_SPECULAR and
PRIM_ALPHA_MODE of llGetPrimitiveParams(). Im sleeping at this time, this can
be very wrong
---
OpenSim/Region/Framework/Scenes/SOPMaterial.cs | 82 ++++++++++++++++++++
.../Shared/Api/Implementation/LSL_Api.cs | 88 ++++++++++++++++++++++
2 files changed, 170 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
index 651c52e..0e9f228 100644
--- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using OpenMetaverse;
+using OpenMetaverse.StructuredData;
using OpenSim.Framework;
namespace OpenSim.Region.Framework.Scenes
@@ -90,6 +91,87 @@ namespace OpenSim.Region.Framework.Scenes
else
return 0;
}
+ }
+
+ public class FaceMaterial
+ {
+ public UUID ID;
+ public UUID NormalMapID = UUID.Zero;
+ public float NormalOffsetX = 1.0f;
+ public float NormalOffsetY = 1.0f;
+ public float NormalRepeatX = 0.0f;
+ public float NormalRepeatY = 0.0f;
+ public float NormalRotation = 0.0f;
+
+ public UUID SpecularMapID = UUID.Zero;
+ public float SpecularOffsetX = 1.0f;
+ public float SpecularOffsetY = 1.0f;
+ public float SpecularRepeatX = 0.0f;
+ public float SpecularRepeatY = 0.0f;
+ public float SpecularRotation = 0.0f;
+
+ public Color4 SpecularLightColor = new Color4(255,255,255,255);
+ public Byte SpecularLightExponent = 51;
+ public Byte EnvironmentIntensity = 0;
+ public Byte DiffuseAlphaMode = 1;
+ public Byte AlphaMaskCutoff = 0;
+
+ public FaceMaterial()
+ { }
+
+ public FaceMaterial(UUID pID, OSDMap mat)
+ {
+ ID = pID;
+ if(mat == null)
+ return;
+ float scale = 0.0001f;
+ NormalMapID = mat["NormMap"].AsUUID();
+ NormalOffsetX = scale * (float)mat["NormOffsetX"].AsReal();
+ NormalOffsetY = scale * (float)mat["NormOffsetY"].AsReal();
+ NormalRepeatX = scale * (float)mat["NormRepeatX"].AsReal();
+ NormalRepeatY = scale * (float)mat["NormRepeatY"].AsReal();
+ NormalRotation = scale * (float)mat["NormRotation"].AsReal();
+
+ SpecularMapID = mat["SpecMap"].AsUUID();
+ SpecularOffsetX = scale * (float)mat["SpecOffsetX"].AsReal();
+ SpecularOffsetY = scale * (float)mat["SpecOffsetY"].AsReal();
+ SpecularRepeatX = scale * (float)mat["SpecRepeatX"].AsReal();
+ SpecularRepeatY = scale * (float)mat["SpecRepeatY"].AsReal();
+ SpecularRotation = scale * (float)mat["SpecRotation"].AsReal();
+ SpecularLightColor = mat["SpecColor"].AsColor4();
+ SpecularLightExponent = (Byte)mat["SpecExp"].AsUInteger();
+ EnvironmentIntensity = (Byte)mat["EnvIntensity"].AsUInteger();
+ DiffuseAlphaMode = (Byte)mat["DiffuseAlphaMode"].AsUInteger();
+ AlphaMaskCutoff = (Byte)mat["AlphaMaskCutoff"].AsUInteger();
+ }
+
+ public OSDMap toOSD()
+ {
+ OSDMap mat = new OSDMap();
+ float scale = 10000f;
+
+ mat["NormMap"] = NormalMapID;
+ mat["NormOffsetX"] = (int) (scale * NormalOffsetX);
+ mat["NormOffsetY"] = (int) (scale * NormalOffsetY);
+ mat["NormRepeatX"] = (int) (scale * NormalRepeatX);
+ mat["NormRepeatY"] = (int) (scale * NormalRepeatY);
+ mat["NormRotation"] = (int) (scale * NormalRotation);
+
+ mat["SpecMap"] = SpecularMapID;
+ mat["SpecOffsetX"] = (int) (scale * SpecularOffsetX);
+ mat["SpecOffsetY"] = (int) (scale * SpecularOffsetY);
+ mat["SpecRepeatX"] = (int) (scale * SpecularRepeatX);
+ mat["SpecRepeatY"] = (int) (scale * SpecularRepeatY);
+ mat["SpecRotation"] = (int) (scale * SpecularRotation);
+
+ mat["SpecColor"] = SpecularLightColor;
+ mat["SpecExp"] = SpecularLightExponent;
+ mat["EnvIntensity"] = EnvironmentIntensity;
+ mat["DiffuseAlphaMode"] = DiffuseAlphaMode;
+ mat["AlphaMaskCutoff"] = AlphaMaskCutoff;
+
+ return mat;
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 31be2fb..6cbdf0a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -11298,6 +11298,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
break;
+ case (int)ScriptBaseClass.PRIM_NORMAL:
+ case (int)ScriptBaseClass.PRIM_SPECULAR:
+ case (int)ScriptBaseClass.PRIM_ALPHA_MODE:
+ if (remain < 1)
+ return new LSL_List();
+
+ face = (int)rules.GetLSLIntegerItem(idx++);
+ tex = part.Shape.Textures;
+ if (face == ScriptBaseClass.ALL_SIDES)
+ {
+ for (face = 0; face < GetNumberOfSides(part); face++)
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ getLSLFaceMaterial(ref res, code, texface);
+ }
+ }
+ else
+ {
+ if (face >= 0 && face < GetNumberOfSides(part))
+ {
+ Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
+ getLSLFaceMaterial(ref res, code, texface);
+ }
+ }
+ break;
+
case (int)ScriptBaseClass.PRIM_LINK_TARGET:
// TODO: Should be issuing a runtime script warning in this case.
@@ -11311,6 +11337,68 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
}
+ private void getLSLFaceMaterial(ref LSL_List res, int code, Primitive.TextureEntryFace texface)
+ {
+ UUID matID = texface.MaterialID;
+ if(matID != UUID.Zero)
+ {
+ AssetBase MatAsset = World.AssetService.Get(matID.ToString());
+ if(MatAsset != null)
+ {
+ Byte[] data = MatAsset.Data;
+ OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data);
+ if(osdmat != null && osdmat.ContainsKey("NormMap"))
+ {
+ FaceMaterial mat = new FaceMaterial(matID, osdmat);
+ if(code == ScriptBaseClass.PRIM_NORMAL)
+ {
+ res.Add(new LSL_String(mat.NormalMapID.ToString()));
+ res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0));
+ res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0));
+ res.Add(new LSL_Float(mat.NormalRotation));
+ }
+ else if(code == ScriptBaseClass.PRIM_SPECULAR )
+ {
+ res.Add(new LSL_String(mat.SpecularMapID.ToString()));
+ res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0));
+ res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0));
+ res.Add(new LSL_Vector(mat.SpecularLightColor.R, mat.SpecularLightColor.G, mat.SpecularLightColor.B));
+ res.Add(new LSL_Integer(mat.SpecularLightExponent));
+ res.Add(new LSL_Integer(mat.EnvironmentIntensity));
+ }
+ else if(code == ScriptBaseClass.PRIM_ALPHA_MODE)
+ {
+ res.Add(new LSL_Integer(mat.DiffuseAlphaMode));
+ res.Add(new LSL_Integer(mat.AlphaMaskCutoff));
+ }
+ return;
+ }
+ }
+ matID = UUID.Zero;
+ }
+ if(matID == UUID.Zero)
+ {
+ if(code == (int)ScriptBaseClass.PRIM_NORMAL || code == (int)ScriptBaseClass.PRIM_SPECULAR )
+ {
+ res.Add(new LSL_String(UUID.Zero.ToString()));
+ res.Add(new LSL_Vector(1.0, 1.0, 0));
+ res.Add(new LSL_Vector(0, 0, 0));
+ res.Add(new LSL_Float(0));
+
+ if(code == (int)ScriptBaseClass.PRIM_SPECULAR)
+ {
+ res.Add(new LSL_Vector(1.0, 1.0, 1.0));
+ res.Add(new LSL_Integer(51));
+ res.Add(new LSL_Integer(0));
+ }
+ }
+ else if(code == (int)ScriptBaseClass.PRIM_ALPHA_MODE)
+ {
+ res.Add(new LSL_Integer(1));
+ res.Add(new LSL_Integer(0));
+ }
+ }
+ }
public LSL_List llGetPrimMediaParams(int face, LSL_List rules)
{
--
cgit v1.1
From 7a54c3e9c300edf35303e243e0e6a61054d952d5 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 24 Apr 2017 11:46:13 +0100
Subject: some fixes on the materials paramenters of llGetPrimitiveParams()
---
OpenSim/Region/Framework/Scenes/SOPMaterial.cs | 16 +++----
.../Shared/Api/Implementation/LSL_Api.cs | 56 ++++++++++++++++++----
2 files changed, 56 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
index 0e9f228..d38ef61 100644
--- a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
+++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
@@ -97,17 +97,17 @@ namespace OpenSim.Region.Framework.Scenes
{
public UUID ID;
public UUID NormalMapID = UUID.Zero;
- public float NormalOffsetX = 1.0f;
- public float NormalOffsetY = 1.0f;
- public float NormalRepeatX = 0.0f;
- public float NormalRepeatY = 0.0f;
+ public float NormalOffsetX = 0.0f;
+ public float NormalOffsetY = 0.0f;
+ public float NormalRepeatX = 1.0f;
+ public float NormalRepeatY = 1.0f;
public float NormalRotation = 0.0f;
public UUID SpecularMapID = UUID.Zero;
- public float SpecularOffsetX = 1.0f;
- public float SpecularOffsetY = 1.0f;
- public float SpecularRepeatX = 0.0f;
- public float SpecularRepeatY = 0.0f;
+ public float SpecularOffsetX = 0.0f;
+ public float SpecularOffsetY = 0.0f;
+ public float SpecularRepeatX = 1.0f;
+ public float SpecularRepeatY = 1.0f;
public float SpecularRotation = 0.0f;
public Color4 SpecularLightColor = new Color4(255,255,255,255);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6cbdf0a..47c3cb8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -11311,7 +11311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
for (face = 0; face < GetNumberOfSides(part); face++)
{
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- getLSLFaceMaterial(ref res, code, texface);
+ getLSLFaceMaterial(ref res, code, part, texface);
}
}
else
@@ -11319,7 +11319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face >= 0 && face < GetNumberOfSides(part))
{
Primitive.TextureEntryFace texface = tex.GetFace((uint)face);
- getLSLFaceMaterial(ref res, code, texface);
+ getLSLFaceMaterial(ref res, code, part, texface);
}
}
break;
@@ -11337,7 +11337,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_List();
}
- private void getLSLFaceMaterial(ref LSL_List res, int code, Primitive.TextureEntryFace texface)
+/*
+ private string filterTextureUUIDbyRights(UUID origID, SceneObjectPart part, bool checkTaskInventory, bool returnInvName)
+ {
+ if(checkTaskInventory)
+ {
+ lock (part.TaskInventory)
+ {
+ foreach (KeyValuePair inv in part.TaskInventory)
+ {
+ if (inv.Value.AssetID == origID)
+ {
+ if(inv.Value.InvType == (int)InventoryType.Texture)
+ {
+ if(returnInvName)
+ return inv.Value.Name;
+ else
+ return origID.ToString();
+ }
+ else
+ return UUID.Zero.ToString();
+ }
+ }
+ }
+ }
+
+ if(World.Permissions.CanEditObject(m_host.ParentGroup.UUID, m_host.ParentGroup.RootPart.OwnerID))
+ return origID.ToString();
+
+ return UUID.Zero.ToString();
+ }
+*/
+ private void getLSLFaceMaterial(ref LSL_List res, int code, SceneObjectPart part, Primitive.TextureEntryFace texface)
{
UUID matID = texface.MaterialID;
if(matID != UUID.Zero)
@@ -11349,20 +11380,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data);
if(osdmat != null && osdmat.ContainsKey("NormMap"))
{
+ string mapIDstr;
FaceMaterial mat = new FaceMaterial(matID, osdmat);
if(code == ScriptBaseClass.PRIM_NORMAL)
{
- res.Add(new LSL_String(mat.NormalMapID.ToString()));
- res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0));
+// mapIDstr = filterTextureUUIDbyRights(mat.NormalMapID, part, true, false);
+ mapIDstr = mat.NormalMapID.ToString();
+ res.Add(new LSL_String(mapIDstr));
res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0));
+ res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0));
res.Add(new LSL_Float(mat.NormalRotation));
}
else if(code == ScriptBaseClass.PRIM_SPECULAR )
{
- res.Add(new LSL_String(mat.SpecularMapID.ToString()));
- res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0));
+// mapIDstr = filterTextureUUIDbyRights(mat.SpecularMapID, part, true, false);
+ const float colorScale = 1.0f/255f;
+ mapIDstr = mat.SpecularMapID.ToString();
+ res.Add(new LSL_String(mapIDstr));
res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0));
- res.Add(new LSL_Vector(mat.SpecularLightColor.R, mat.SpecularLightColor.G, mat.SpecularLightColor.B));
+ res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0));
+ res.Add(new LSL_Float(mat.SpecularRotation));
+ res.Add(new LSL_Vector(mat.SpecularLightColor.R * colorScale,
+ mat.SpecularLightColor.G * colorScale,
+ mat.SpecularLightColor.B * colorScale));
res.Add(new LSL_Integer(mat.SpecularLightExponent));
res.Add(new LSL_Integer(mat.EnvironmentIntensity));
}
--
cgit v1.1
From 2f6c78b88895c0934179fb8eb70ae1dc08883d5f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 25 Apr 2017 04:58:24 +0100
Subject: finish encoding number of mesh faces in pbs shape on new meshs
upload, and *HACK* flag it setting hollow shape to triangle. (some limited
encoding as added some months ago, but only for viewers LOD). Use this hack
flag to fix sop number of faces. old meshs will still report 8 faces,
information to fix this seems lost unless the mesh asset is decoded
---
.../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 25 ++++++++++++++++------
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 25 +++++++---------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 24 ++++++++++++---------
3 files changed, 41 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 58b7b00..46932b1 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -1006,28 +1006,41 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
- // faces number to pbs shape
- switch(face_list.Count)
+ // faces number to pbs shape for viewers LOD
+ // now extended to full faces equivalent
+ int nfaces = face_list.Count;
+ switch(nfaces)
{
case 1:
case 2:
- pbs.ProfileCurve = (byte)ProfileCurve.Circle;
+ pbs.ProfileCurve = (byte)ProfileCurve.Circle | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Circle;
+ if(nfaces == 2)
+ pbs.ProfileHollow = 1;
break;
case 3:
case 4:
- pbs.ProfileCurve = (byte)ProfileCurve.Circle;
+ pbs.ProfileCurve = (byte)ProfileCurve.Circle | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Line;
+ if(nfaces == 4)
+ pbs.ProfileHollow = 1;
break;
+
case 5:
- pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle;
+ pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Line;
break;
default:
- pbs.ProfileCurve = (byte)ProfileCurve.Square;
+ // hack to flag that pbs does represent number of faces
+ //meshs where never uploaded with this
+ pbs.ProfileCurve = (byte)ProfileCurve.Square | (byte)HollowShape.Triangle;
pbs.PathCurve = (byte)PathCurve.Line;
+ if(nfaces == 7)
+ pbs.ProfileHollow = 1;
+ else if(nfaces == 8)
+ pbs.ProfileBegin = 1;
break;
}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index dc8d267..cf96a8b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -4212,12 +4212,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SceneObjectGroup grp = part.ParentGroup;
if (grp.inTransit && !update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
continue;
+/* debug
if (update.Flags.HasFlag(PrimUpdateFlags.SendInTransit))
{
}
-
+*/
if (grp.IsDeleted)
{
// Don't send updates for objects that have been marked deleted.
@@ -4274,14 +4275,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
part.Shape.LightEntry = false;
}
-
- if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
- {
- // Ensure that mesh has at least 8 valid faces
- part.Shape.ProfileBegin = 12500;
- part.Shape.ProfileEnd = 0;
- part.Shape.ProfileHollow = 27500;
- }
}
if(doCulling && !grp.IsAttachment)
@@ -4309,14 +4302,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
continue;
}
}
-
- if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh))
- {
- // Ensure that mesh has at least 8 valid faces
- part.Shape.ProfileBegin = 12500;
- part.Shape.ProfileEnd = 0;
- part.Shape.ProfileHollow = 27500;
- }
}
else if (update.Entity is ScenePresence)
{
@@ -5877,6 +5862,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
update.PCode = part.Shape.PCode;
update.ProfileBegin = part.Shape.ProfileBegin;
update.ProfileCurve = part.Shape.ProfileCurve;
+
+ if(part.Shape.SculptType == (byte)SculptType.Mesh) // filter out hack
+ update.ProfileCurve = (byte)(part.Shape.ProfileCurve & 0x0f);
+ else
+ update.ProfileCurve = part.Shape.ProfileCurve;
+
update.ProfileEnd = part.Shape.ProfileEnd;
update.ProfileHollow = part.Shape.ProfileHollow;
update.PSBlock = part.ParticleSystem ?? Utils.EmptyBytes;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index affd4de..19bf53f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3728,7 +3728,18 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
bool hasDimple;
bool hasProfileCut;
- PrimType primType = GetPrimType();
+ if(Shape.SculptEntry)
+ {
+ if (Shape.SculptType != (byte)SculptType.Mesh)
+ return 1; // sculp
+
+ //hack to detect new upload with faces data enconded on pbs
+ if ((Shape.ProfileCurve & 0xf0) != (byte)HollowShape.Triangle)
+ // old broken upload TODO
+ return 8;
+ }
+
+ PrimType primType = GetPrimType(true);
HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
switch (primType)
@@ -3772,13 +3783,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
if (hasProfileCut) ret += 2;
if (hasHollow) ret += 1;
break;
- case PrimType.SCULPT:
- // Special mesh handling
- if (Shape.SculptType == (byte)SculptType.Mesh)
- ret = 8; // if it's a mesh then max 8 faces
- else
- ret = 1; // if it's a sculpt then max 1 face
- break;
}
return ret;
@@ -3789,9 +3793,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
///
///
///
- public PrimType GetPrimType()
+ public PrimType GetPrimType(bool ignoreSculpt = false)
{
- if (Shape.SculptEntry)
+ if (Shape.SculptEntry && !ignoreSculpt)
return PrimType.SCULPT;
if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
--
cgit v1.1
From 29ab39f14f69822bd0df0b263b03bec69c376e39 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 25 Apr 2017 13:05:20 +0100
Subject: cosmetics on mesh upload encoding of number of faces on pbs shape.
Use opensim shape enums in place of libovm for coerence, add a few coments.
---
.../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 59 +++++++++++++---------
1 file changed, 36 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 46932b1..4a5a8e7 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -1011,36 +1011,49 @@ namespace OpenSim.Region.ClientStack.Linden
int nfaces = face_list.Count;
switch(nfaces)
{
- case 1:
- case 2:
- pbs.ProfileCurve = (byte)ProfileCurve.Circle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)PathCurve.Circle;
- if(nfaces == 2)
- pbs.ProfileHollow = 1;
+ case 0: // low oops case
+ case 1: // torus
+ pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Curve1;
break;
- case 3:
- case 4:
- pbs.ProfileCurve = (byte)ProfileCurve.Circle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)PathCurve.Line;
- if(nfaces == 4)
- pbs.ProfileHollow = 1;
+ case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere)
+ pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Curve1;
+ pbs.ProfileHollow = 1;
break;
- case 5:
- pbs.ProfileCurve = (byte)ProfileCurve.EqualTriangle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)PathCurve.Line;
+ case 3: // cylinder
+ pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Straight;
break;
- default:
- // hack to flag that pbs does represent number of faces
- //meshs where never uploaded with this
+ case 4: // cylinder with hollow
+ pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Straight;
+ pbs.ProfileHollow = 1;
+ break;
+
+ case 5: // prism
+ pbs.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Straight;
+ break;
+
+ case 6: // box
+ pbs.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Straight;
+ break;
+
+ case 7: // box with hollow
+ pbs.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
+ pbs.PathCurve = (byte)Extrusion.Straight;
+ pbs.ProfileHollow = 1;
+ break;
+
+ default: // 8 faces box with cut
pbs.ProfileCurve = (byte)ProfileCurve.Square | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)PathCurve.Line;
- if(nfaces == 7)
- pbs.ProfileHollow = 1;
- else if(nfaces == 8)
- pbs.ProfileBegin = 1;
+ pbs.PathCurve = (byte)Extrusion.Straight;
+ pbs.ProfileBegin = 1;
break;
}
--
cgit v1.1
From 7c5376f224743358a7640477fedfd9de5b27b48d Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 25 Apr 2017 14:21:01 +0100
Subject: move mesh pbs creation code out of mesh upload code into to
PrimitiveBaseShape.cs
---
.../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 85 ++++------------------
1 file changed, 14 insertions(+), 71 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 4a5a8e7..e1b9e08 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -946,17 +946,26 @@ namespace OpenSim.Region.ClientStack.Linden
continue;
}
- PrimitiveBaseShape pbs = PrimitiveBaseShape.CreateBox();
+ OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
+
+ PrimitiveBaseShape pbs = null;
+ if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
+ {
+ int meshindx = inner_instance_list["mesh"].AsInteger();
+ if (meshAssets.Count > meshindx)
+ pbs = PrimitiveBaseShape.CreateMesh(face_list.Count, meshAssets[meshindx]);
+ }
+ if(pbs == null) // fallback
+ pbs = PrimitiveBaseShape.CreateBox();
Primitive.TextureEntry textureEntry
= new Primitive.TextureEntry(Primitive.TextureEntry.WHITE_TEXTURE);
-
- OSDArray face_list = (OSDArray)inner_instance_list["face_list"];
for (uint face = 0; face < face_list.Count; face++)
{
OSDMap faceMap = (OSDMap)face_list[(int)face];
- Primitive.TextureEntryFace f = pbs.Textures.CreateFace(face);
+
+ Primitive.TextureEntryFace f = textureEntry.CreateFace(face); //clone the default
if (faceMap.ContainsKey("fullbright"))
f.Fullbright = faceMap["fullbright"].AsBoolean();
if (faceMap.ContainsKey("diffuse_color"))
@@ -986,77 +995,11 @@ namespace OpenSim.Region.ClientStack.Linden
if (textures.Count > textureNum)
f.TextureID = textures[textureNum];
- else
- f.TextureID = Primitive.TextureEntry.WHITE_TEXTURE;
-
+
textureEntry.FaceTextures[face] = f;
}
-
pbs.TextureEntry = textureEntry.GetBytes();
- if (inner_instance_list.ContainsKey("mesh")) // seems to happen always but ...
- {
- int meshindx = inner_instance_list["mesh"].AsInteger();
- if (meshAssets.Count > meshindx)
- {
- pbs.SculptEntry = true;
- pbs.SculptType = (byte)SculptType.Mesh;
- pbs.SculptTexture = meshAssets[meshindx]; // actual asset UUID after meshs suport introduction
- // data will be requested from asset on rez (i hope)
- }
- }
-
- // faces number to pbs shape for viewers LOD
- // now extended to full faces equivalent
- int nfaces = face_list.Count;
- switch(nfaces)
- {
- case 0: // low oops case
- case 1: // torus
- pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Curve1;
- break;
-
- case 2: // torus with hollow (a sl viewer whould see 4 faces on a hollow sphere)
- pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Curve1;
- pbs.ProfileHollow = 1;
- break;
-
- case 3: // cylinder
- pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Straight;
- break;
-
- case 4: // cylinder with hollow
- pbs.ProfileCurve = (byte)ProfileShape.Circle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Straight;
- pbs.ProfileHollow = 1;
- break;
-
- case 5: // prism
- pbs.ProfileCurve = (byte)ProfileShape.EquilateralTriangle | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Straight;
- break;
-
- case 6: // box
- pbs.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Straight;
- break;
-
- case 7: // box with hollow
- pbs.ProfileCurve = (byte)ProfileShape.Square | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Straight;
- pbs.ProfileHollow = 1;
- break;
-
- default: // 8 faces box with cut
- pbs.ProfileCurve = (byte)ProfileCurve.Square | (byte)HollowShape.Triangle;
- pbs.PathCurve = (byte)Extrusion.Straight;
- pbs.ProfileBegin = 1;
- break;
- }
-
Vector3 position = inner_instance_list["position"].AsVector3();
Quaternion rotation = inner_instance_list["rotation"].AsQuaternion();
--
cgit v1.1