aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-08-15 18:22:52 +0200
committerMelanie2012-08-15 19:37:16 +0100
commitebbf349c6a883ea641ee02b0517313f6391f60ef (patch)
tree659aace4c438b69272f32b93d595d76583690ca9 /OpenSim
parentAdd support for the extra params to scene and the event manager (diff)
downloadopensim-SC_OLD-ebbf349c6a883ea641ee02b0517313f6391f60ef.zip
opensim-SC_OLD-ebbf349c6a883ea641ee02b0517313f6391f60ef.tar.gz
opensim-SC_OLD-ebbf349c6a883ea641ee02b0517313f6391f60ef.tar.bz2
opensim-SC_OLD-ebbf349c6a883ea641ee02b0517313f6391f60ef.tar.xz
Let the temp attachment module add a command to allow attaching without permissions and add support for this (incomplete!) to LSL
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs41
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs70
2 files changed, 77 insertions, 34 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index 27ba5c9..cb89cd1 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;
43 43
44namespace OpenSim.Region.OptionalModules.Avatar.Attachments 44namespace OpenSim.Region.OptionalModules.Avatar.Attachments
45{ 45{
46 /// <summary>
47 /// A module that just holds commands for inspecting avatar appearance.
48 /// </summary>
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")] 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")]
50 public class TempAttachmentsModule : INonSharedRegionModule 47 public class TempAttachmentsModule : INonSharedRegionModule
51 { 48 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 50
54 private Scene m_scene; 51 private Scene m_scene;
52 private IRegionConsole m_console;
55 53
56 public void Initialise(IConfigSource configSource) 54 public void Initialise(IConfigSource configSource)
57 { 55 {
@@ -74,6 +72,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
74 { 72 {
75 comms.RegisterScriptInvocation( this, "llAttachToAvatarTemp"); 73 comms.RegisterScriptInvocation( this, "llAttachToAvatarTemp");
76 m_log.DebugFormat("[TEMP ATTACHS]: Registered script functions"); 74 m_log.DebugFormat("[TEMP ATTACHS]: Registered script functions");
75 m_console = scene.RequestModuleInterface<IRegionConsole>();
76
77 if (m_console != null)
78 {
79 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);
80 }
77 } 81 }
78 else 82 else
79 { 83 {
@@ -95,6 +99,37 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
95 get { return "TempAttachmentsModule"; } 99 get { return "TempAttachmentsModule"; }
96 } 100 }
97 101
102 private void SendConsoleOutput(UUID agentID, string text)
103 {
104 if (m_console == null)
105 return;
106
107 m_console.SendConsoleOutput(agentID, text);
108 }
109
110 private void SetAutoGrantAttachPerms(string module, string[] parms)
111 {
112 UUID agentID = new UUID(parms[parms.Length - 1]);
113 Array.Resize(ref parms, parms.Length - 1);
114
115 if (parms.Length != 3)
116 {
117 SendConsoleOutput(agentID, "Command parameter error");
118 return;
119 }
120
121 string val = parms[2];
122 if (val != "true" && val != "false")
123 {
124 SendConsoleOutput(agentID, "Command parameter error");
125 return;
126 }
127
128 m_scene.StoreExtraSetting("auto_grant_attach_perms", val);
129
130 SendConsoleOutput(agentID, String.Format("auto_grant_attach_perms set to {0}", val));
131 }
132
98 private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint) 133 private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
99 { 134 {
100 SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host); 135 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 1287709..8b53edc 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
3424 3424
3425 m_host.AddScriptLPS(1); 3425 m_host.AddScriptLPS(1);
3426 3426
3427 int implicitPerms = 0;
3428
3427 if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar) 3429 if (m_host.ParentGroup.IsAttachment && (UUID)agent == m_host.ParentGroup.AttachedAvatar)
3428 { 3430 {
3429 // When attached, certain permissions are implicit if requested from owner 3431 // When attached, certain permissions are implicit if requested from owner
3430 int implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS | 3432 implicitPerms = ScriptBaseClass.PERMISSION_TAKE_CONTROLS |
3431 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | 3433 ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
3432 ScriptBaseClass.PERMISSION_CONTROL_CAMERA | 3434 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
3433 ScriptBaseClass.PERMISSION_ATTACH; 3435 ScriptBaseClass.PERMISSION_ATTACH;
3434 3436 }
3435 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 3437 else
3438 {
3439 bool sitting = false;
3440 if (m_host.SitTargetAvatar == agentID)
3436 { 3441 {
3437 lock (m_host.TaskInventory) 3442 sitting = true;
3443 }
3444 else
3445 {
3446 foreach (SceneObjectPart p in m_host.ParentGroup.Parts)
3438 { 3447 {
3439 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; 3448 if (p.SitTargetAvatar == agentID)
3440 m_host.TaskInventory[m_item.ItemID].PermsMask = perm; 3449 sitting = true;
3441 } 3450 }
3451 }
3442 3452
3443 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( 3453 if (sitting)
3444 "run_time_permissions", new Object[] { 3454 {
3445 new LSL_Integer(perm) }, 3455 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3446 new DetectParams[0])); 3456 implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
3447 3457 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
3448 return; 3458 ScriptBaseClass.PERMISSION_TRACK_CAMERA |
3459 ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
3460 }
3461 else
3462 {
3463 if (World.GetExtraSetting("auto_grant_attach_perms") == "true")
3464 implicitPerms = ScriptBaseClass.PERMISSION_ATTACH;
3449 } 3465 }
3450 } 3466 }
3451 else if (m_host.SitTargetAvatar == agentID) // Sitting avatar
3452 {
3453 // When agent is sitting, certain permissions are implicit if requested from sitting agent
3454 int implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
3455 ScriptBaseClass.PERMISSION_CONTROL_CAMERA |
3456 ScriptBaseClass.PERMISSION_TRACK_CAMERA |
3457 ScriptBaseClass.PERMISSION_TAKE_CONTROLS;
3458 3467
3459 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms 3468 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
3469 {
3470 lock (m_host.TaskInventory)
3460 { 3471 {
3461 lock (m_host.TaskInventory) 3472 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
3462 { 3473 m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
3463 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID; 3474 }
3464 m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
3465 }
3466 3475
3467 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams( 3476 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
3468 "run_time_permissions", new Object[] { 3477 "run_time_permissions", new Object[] {
3469 new LSL_Integer(perm) }, 3478 new LSL_Integer(perm) },
3470 new DetectParams[0])); 3479 new DetectParams[0]));
3471 3480
3472 return; 3481 return;
3473 }
3474 } 3482 }
3475 3483
3476 ScenePresence presence = World.GetScenePresence(agentID); 3484 ScenePresence presence = World.GetScenePresence(agentID);