diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index 27ba5c93ea..cb89cd1133 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -43,15 +43,13 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.OptionalModules.Avatar.Attachments
{
- ///
- /// A module that just holds commands for inspecting avatar appearance.
- ///
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")]
public class TempAttachmentsModule : INonSharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
+ private IRegionConsole m_console;
public void Initialise(IConfigSource configSource)
{
@@ -74,6 +72,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
{
comms.RegisterScriptInvocation( this, "llAttachToAvatarTemp");
m_log.DebugFormat("[TEMP ATTACHS]: Registered script functions");
+ m_console = scene.RequestModuleInterface();
+
+ if (m_console != null)
+ {
+ m_console.AddCommand("TempATtachModule", false, "set auto_grant_attach_perms", "set auto_grant_attach_perms true|false", "Allow objects owned by the region owner os estate managers to obtain attach permissions without asking the user", SetAutoGrantAttachPerms);
+ }
}
else
{
@@ -95,6 +99,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
get { return "TempAttachmentsModule"; }
}
+ private void SendConsoleOutput(UUID agentID, string text)
+ {
+ if (m_console == null)
+ return;
+
+ m_console.SendConsoleOutput(agentID, text);
+ }
+
+ private void SetAutoGrantAttachPerms(string module, string[] parms)
+ {
+ UUID agentID = new UUID(parms[parms.Length - 1]);
+ Array.Resize(ref parms, parms.Length - 1);
+
+ if (parms.Length != 3)
+ {
+ SendConsoleOutput(agentID, "Command parameter error");
+ return;
+ }
+
+ string val = parms[2];
+ if (val != "true" && val != "false")
+ {
+ SendConsoleOutput(agentID, "Command parameter error");
+ return;
+ }
+
+ m_scene.StoreExtraSetting("auto_grant_attach_perms", val);
+
+ SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val));
+ }
+
private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
{
SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1287709f4d..8b53edcb96 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3424,53 +3424,61 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
+ int implicitPerms = 0;
+
if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar)
{
// When attached, certain permissions are implicit if requested from owner
- int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
+ implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
ScriptBaseClass.PERMISSION_ATTACH;
-
- if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
+ }
+ else
+ {
+ bool sitting = false;
+ if (m_host.SitTargetAvatar == agentID)
{
- lock (m_host.TaskInventory)
+ sitting = true;
+ }
+ else
+ {
+ foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
{
- m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
- m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
+ if (p.SitTargetAvatar == agentID)
+ sitting = true;
}
+ }
- m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
- "run_time_permissions", new Object[] {
- new LSL_Integer(perm) },
- new DetectParams[0]));
-
- return;
+ if (sitting)
+ {
+ // When agent is sitting, certain permissions are implicit if requested from sitting agent
+ implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
+ ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
+ ScriptBaseClass.PERMISSION_TRACK_CAMERA |
+ ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
+ }
+ else
+ {
+ if (World.GetExtraSetting("auto_grant_attach_perms") == "true")
+ implicitPerms = ScriptBaseClass.PERMISSION_ATTACH;
}
}
- else if (m_host.SitTargetAvatar == agentID) // Sitting avatar
+
+ if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{
- // When agent is sitting, certain permissions are implicit if requested from sitting agent
- int implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
- ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
- ScriptBaseClass.PERMISSION_TRACK_CAMERA |
- ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
-
- if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
+ lock (m_host.TaskInventory)
{
- lock (m_host.TaskInventory)
- {
- m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
- m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
- }
-
- m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
- "run_time_permissions", new Object[] {
- new LSL_Integer(perm) },
- new DetectParams[0]));
-
- return;
+ m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
+ m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
}
+
+ m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
+ "run_time_permissions", new Object[] {
+ new LSL_Integer(perm) },
+ new DetectParams[0]));
+
+ return;
}
ScenePresence presence = World.GetScenePresence(agentID);