aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorTalun2012-05-22 23:06:40 +0100
committerJustin Clark-Casey (justincc)2012-05-26 02:09:22 +0100
commit0b72f773c7df849b335895d7c7a6cfe949f59f00 (patch)
treecc465381ef273ac0b71defa509c8450941fc0ce0 /OpenSim/Region/ScriptEngine/Shared
parentIf restating a region, clean up the physics scene after the main scene has be... (diff)
downloadopensim-SC_OLD-0b72f773c7df849b335895d7c7a6cfe949f59f00.zip
opensim-SC_OLD-0b72f773c7df849b335895d7c7a6cfe949f59f00.tar.gz
opensim-SC_OLD-0b72f773c7df849b335895d7c7a6cfe949f59f00.tar.bz2
opensim-SC_OLD-0b72f773c7df849b335895d7c7a6cfe949f59f00.tar.xz
Mantis 6025 llRequestPermissions auto grant for NPCs.
If the script requesting permissions is owned by either the NPC or the NPCs owner (if the NPC is created as owned) then grant any permissions automatically.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 84493b1..f3787a0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3406,9 +3406,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3406 } 3406 }
3407 3407
3408 ScenePresence presence = World.GetScenePresence(agentID); 3408 ScenePresence presence = World.GetScenePresence(agentID);
3409
3410 if (presence != null) 3409 if (presence != null)
3411 { 3410 {
3411 // If permissions are being requested from an NPC and were not implicitly granted above then
3412 // auto grant all reuqested permissions if the script is owned by the NPC or the NPCs owner
3413 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
3414 if (npcModule != null && npcModule.IsNPC(agentID, World))
3415 {
3416 if (agentID == m_host.ParentGroup.OwnerID || npcModule.GetOwner(agentID) == m_host.ParentGroup.OwnerID)
3417 {
3418 lock (m_host.TaskInventory)
3419 {
3420 m_host.TaskInventory[m_item.ItemID].PermsGranter = agentID;
3421 m_host.TaskInventory[m_item.ItemID].PermsMask = perm;
3422 }
3423
3424 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
3425 "run_time_permissions", new Object[] {
3426 new LSL_Integer(perm) },
3427 new DetectParams[0]));
3428 }
3429 // it is an NPC, exit even if the permissions werent granted above, they are not going to answer
3430 // the question!
3431 return;
3432 }
3433
3412 string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID); 3434 string ownerName = resolveName(m_host.ParentGroup.RootPart.OwnerID);
3413 if (ownerName == String.Empty) 3435 if (ownerName == String.Empty)
3414 ownerName = "(hippos)"; 3436 ownerName = "(hippos)";