aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs2
3 files changed, 53 insertions, 5 deletions
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
1612 return IsAdministrator(user); 1612 return IsAdministrator(user);
1613 } 1613 }
1614 1614
1615 private bool CanRunScript(UUID script, UUID objectID, UUID user, Scene scene) 1615 private bool CanRunScript(TaskInventoryItem scriptitem, SceneObjectPart part)
1616 { 1616 {
1617 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1617 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1618 if (m_bypassPermissions) return m_bypassPermissionsValue; 1618 if (m_bypassPermissions) return m_bypassPermissionsValue;
1619 1619
1620 return true; 1620 if(scriptitem == null || part == null)
1621 return false;
1622
1623 SceneObjectGroup sog = part.ParentGroup;
1624 if(sog == null)
1625 return false;
1626
1627 Vector3 pos = sog.AbsolutePosition;
1628 ILandObject parcel = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
1629 if (parcel == null)
1630 return false;
1631
1632 LandData ldata = parcel.LandData;
1633 if(ldata == null)
1634 return false;
1635
1636 uint lflags = ldata.Flags;
1637
1638 if ((lflags & (uint)ParcelFlags.AllowOtherScripts) != 0)
1639 return true;
1640
1641 if ((part.OwnerID == ldata.OwnerID))
1642 return true;
1643
1644 if (((lflags & (uint)ParcelFlags.AllowGroupScripts) != 0)
1645 && (ldata.GroupID != UUID.Zero) && (ldata.GroupID == part.GroupID))
1646 return true;
1647
1648 return GenericEstatePermission(part.OwnerID);
1621 } 1649 }
1622 1650
1623 private bool CanSellParcel(UUID user, ILandObject parcel, Scene scene) 1651 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
60 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); 60 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
61 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 61 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
62 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); 62 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
63 public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 63 public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user, Scene scene);
64 public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
64 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene); 65 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
65 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); 66 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
66 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); 67 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
@@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes
131 public event ViewNotecardHandler OnViewNotecard; 132 public event ViewNotecardHandler OnViewNotecard;
132 public event EditScriptHandler OnEditScript; 133 public event EditScriptHandler OnEditScript;
133 public event EditNotecardHandler OnEditNotecard; 134 public event EditNotecardHandler OnEditNotecard;
135 public event RunScriptHandlerByIDs OnRunScriptByIDs;
134 public event RunScriptHandler OnRunScript; 136 public event RunScriptHandler OnRunScript;
135 public event CompileScriptHandler OnCompileScript; 137 public event CompileScriptHandler OnCompileScript;
136 public event StartScriptHandler OnStartScript; 138 public event StartScriptHandler OnStartScript;
@@ -654,19 +656,37 @@ namespace OpenSim.Region.Framework.Scenes
654 #region RUN SCRIPT (When Script Placed in Object) 656 #region RUN SCRIPT (When Script Placed in Object)
655 public bool CanRunScript(UUID script, UUID objectID, UUID user) 657 public bool CanRunScript(UUID script, UUID objectID, UUID user)
656 { 658 {
659 RunScriptHandlerByIDs handler = OnRunScriptByIDs;
660 if (handler != null)
661 {
662 Delegate[] list = handler.GetInvocationList();
663 foreach (RunScriptHandlerByIDs h in list)
664 {
665 if (h(script, objectID, user, m_scene) == false)
666 return false;
667 }
668 }
669 return true;
670 }
671
672 public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part)
673 {
657 RunScriptHandler handler = OnRunScript; 674 RunScriptHandler handler = OnRunScript;
658 if (handler != null) 675 if (handler != null)
659 { 676 {
677 if(item == null || part == null)
678 return false;
660 Delegate[] list = handler.GetInvocationList(); 679 Delegate[] list = handler.GetInvocationList();
661 foreach (RunScriptHandler h in list) 680 foreach (RunScriptHandler h in list)
662 { 681 {
663 if (h(script, objectID, user, m_scene) == false) 682 if (h(item, part) == false)
664 return false; 683 return false;
665 } 684 }
666 } 685 }
667 return true; 686 return true;
668 } 687 }
669 688
689
670 #endregion 690 #endregion
671 691
672 #region COMPILE SCRIPT (When Script needs to get (re)compiled) 692 #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
360// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", 360// m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}",
361// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); 361// item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName);
362 362
363 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 363 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item, m_part))
364 { 364 {
365 StoreScriptError(item.ItemID, "no permission"); 365 StoreScriptError(item.ItemID, "no permission");
366 return false; 366 return false;