aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs44
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs20
3 files changed, 60 insertions, 21 deletions
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
283 m_scene.Permissions.OnIsEstateManager += IsEstateManager; 283 m_scene.Permissions.OnIsEstateManager += IsEstateManager;
284 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 284 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
285 m_scene.Permissions.OnDeleteObject += CanDeleteObject; 285 m_scene.Permissions.OnDeleteObject += CanDeleteObject;
286 m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
286 m_scene.Permissions.OnEditObject += CanEditObject; 287 m_scene.Permissions.OnEditObject += CanEditObject;
287 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; 288 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
288 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 289 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
@@ -1235,7 +1236,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1235 return true; 1236 return true;
1236 } 1237 }
1237 1238
1238 private bool CanEditObject(UUID objectID, UUID userID, Scene scene) 1239 private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
1239 { 1240 {
1240 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1241 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1241 if (m_bypassPermissions) return m_bypassPermissionsValue; 1242 if (m_bypassPermissions) return m_bypassPermissionsValue;
@@ -1250,6 +1251,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1250 return true; 1251 return true;
1251 } 1252 }
1252 1253
1254 private bool CanEditObject(SceneObjectGroup sog, ScenePresence sp)
1255 {
1256 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1257 if (m_bypassPermissions) return m_bypassPermissionsValue;
1258
1259 if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
1260 return false;
1261
1262 uint perms = GetObjectPermissions(sp, sog, true);
1263 if((perms & (uint)PermissionMask.Modify) == 0)
1264 return false;
1265 return true;
1266 }
1267
1253 private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene) 1268 private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene)
1254 { 1269 {
1255 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1270 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
48 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene); 48 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
49 public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp); 49 public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
50 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); 50 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
51 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); 51 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene);
52 public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
52 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); 53 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
53 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); 54 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
54 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); 55 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
@@ -118,6 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
118 public event SellGroupObjectHandler OnSellGroupObject; 119 public event SellGroupObjectHandler OnSellGroupObject;
119 public event TakeCopyObjectHandler OnTakeCopyObject; 120 public event TakeCopyObjectHandler OnTakeCopyObject;
120 public event DuplicateObjectHandler OnDuplicateObject; 121 public event DuplicateObjectHandler OnDuplicateObject;
122 public event EditObjectByIDsHandler OnEditObjectByIDs;
121 public event EditObjectHandler OnEditObject; 123 public event EditObjectHandler OnEditObject;
122 public event EditObjectInventoryHandler OnEditObjectInventory; 124 public event EditObjectInventoryHandler OnEditObjectInventory;
123 public event MoveObjectHandler OnMoveObject; 125 public event MoveObjectHandler OnMoveObject;
@@ -307,6 +309,9 @@ namespace OpenSim.Region.Framework.Scenes
307 TakeObjectHandler handler = OnTakeObject; 309 TakeObjectHandler handler = OnTakeObject;
308 if (handler != null) 310 if (handler != null)
309 { 311 {
312 if(sog == null || sp == null)
313 return false;
314
310 Delegate[] list = handler.GetInvocationList(); 315 Delegate[] list = handler.GetInvocationList();
311 foreach (TakeObjectHandler h in list) 316 foreach (TakeObjectHandler h in list)
312 { 317 {
@@ -364,6 +369,8 @@ namespace OpenSim.Region.Framework.Scenes
364 TakeCopyObjectHandler handler = OnTakeCopyObject; 369 TakeCopyObjectHandler handler = OnTakeCopyObject;
365 if (handler != null) 370 if (handler != null)
366 { 371 {
372 if(sog == null || sp == null)
373 return false;
367 Delegate[] list = handler.GetInvocationList(); 374 Delegate[] list = handler.GetInvocationList();
368 foreach (TakeCopyObjectHandler h in list) 375 foreach (TakeCopyObjectHandler h in list)
369 { 376 {
@@ -419,13 +426,33 @@ namespace OpenSim.Region.Framework.Scenes
419 #region EDIT OBJECT 426 #region EDIT OBJECT
420 public bool CanEditObject(UUID objectID, UUID editorID) 427 public bool CanEditObject(UUID objectID, UUID editorID)
421 { 428 {
429 EditObjectByIDsHandler handler = OnEditObjectByIDs;
430 if (handler != null)
431 {
432 Delegate[] list = handler.GetInvocationList();
433 foreach (EditObjectByIDsHandler h in list)
434 {
435 if (h(objectID, editorID, m_scene) == false)
436 return false;
437 }
438 }
439 return true;
440 }
441
442 public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
443 {
422 EditObjectHandler handler = OnEditObject; 444 EditObjectHandler handler = OnEditObject;
423 if (handler != null) 445 if (handler != null)
424 { 446 {
447 if(sog == null || client == null || client.SceneAgent == null)
448 return false;
449
450 ScenePresence sp = client.SceneAgent as ScenePresence;
451
425 Delegate[] list = handler.GetInvocationList(); 452 Delegate[] list = handler.GetInvocationList();
426 foreach (EditObjectHandler h in list) 453 foreach (EditObjectHandler h in list)
427 { 454 {
428 if (h(objectID, editorID, m_scene) == false) 455 if (h(sog, sp) == false)
429 return false; 456 return false;
430 } 457 }
431 } 458 }
@@ -452,17 +479,14 @@ namespace OpenSim.Region.Framework.Scenes
452 #region MOVE OBJECT 479 #region MOVE OBJECT
453 public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client) 480 public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
454 { 481 {
455 if(sog == null || client == null)
456 return false;
457
458 if(client.SceneAgent == null)
459 return false;
460
461 ScenePresence sp = client.SceneAgent as ScenePresence;
462
463 MoveObjectHandler handler = OnMoveObject; 482 MoveObjectHandler handler = OnMoveObject;
464 if (handler != null) 483 if (handler != null)
465 { 484 {
485 if(sog == null || client == null || client.SceneAgent == null)
486 return false;
487
488 ScenePresence sp = client.SceneAgent as ScenePresence;
489
466 Delegate[] list = handler.GetInvocationList(); 490 Delegate[] list = handler.GetInvocationList();
467 foreach (MoveObjectHandler h in list) 491 foreach (MoveObjectHandler h in list)
468 { 492 {
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
1358 SceneObjectGroup grp = part.ParentGroup; 1358 SceneObjectGroup grp = part.ParentGroup;
1359 if (grp != null) 1359 if (grp != null)
1360 { 1360 {
1361 if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId)) 1361 if (m_parentScene.Permissions.CanEditObject(grp, remoteClient))
1362 { 1362 {
1363 // These two are exceptions SL makes in the interpretation 1363 // These two are exceptions SL makes in the interpretation
1364 // of the change flags. Must check them here because otherwise 1364 // of the change flags. Must check them here because otherwise
@@ -1406,7 +1406,7 @@ namespace OpenSim.Region.Framework.Scenes
1406 1406
1407 if (part != null) 1407 if (part != null)
1408 { 1408 {
1409 if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) 1409 if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient))
1410 { 1410 {
1411 bool physbuild = false; 1411 bool physbuild = false;
1412 if (part.ParentGroup.RootPart.PhysActor != null) 1412 if (part.ParentGroup.RootPart.PhysActor != null)
@@ -1428,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1428 SceneObjectGroup group = GetGroupByPrim(localID); 1428 SceneObjectGroup group = GetGroupByPrim(localID);
1429 if (group != null) 1429 if (group != null)
1430 { 1430 {
1431 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1431 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1432 { 1432 {
1433 bool physbuild = false; 1433 bool physbuild = false;
1434 if (group.RootPart.PhysActor != null) 1434 if (group.RootPart.PhysActor != null)
@@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes
1603 1603
1604 if (group != null) 1604 if (group != null)
1605 { 1605 {
1606 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) 1606 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1607 { 1607 {
1608 group.UpdateTextureEntry(localID, texture); 1608 group.UpdateTextureEntry(localID, texture);
1609 } 1609 }
@@ -1627,7 +1627,7 @@ namespace OpenSim.Region.Framework.Scenes
1627 SceneObjectGroup group = GetGroupByPrim(localID); 1627 SceneObjectGroup group = GetGroupByPrim(localID);
1628 if (group != null) 1628 if (group != null)
1629 { 1629 {
1630 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1630 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1631 { 1631 {
1632 // VolumeDetect can't be set via UI and will always be off when a change is made there 1632 // VolumeDetect can't be set via UI and will always be off when a change is made there
1633 // now only change volume dtc if phantom off 1633 // now only change volume dtc if phantom off
@@ -1674,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes
1674 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1674 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1675 if (group != null) 1675 if (group != null)
1676 { 1676 {
1677 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1677 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1678 { 1678 {
1679 group.SetPartName(Util.CleanString(name), primLocalID); 1679 group.SetPartName(Util.CleanString(name), primLocalID);
1680 group.HasGroupChanged = true; 1680 group.HasGroupChanged = true;
@@ -1692,7 +1692,7 @@ namespace OpenSim.Region.Framework.Scenes
1692 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1692 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1693 if (group != null) 1693 if (group != null)
1694 { 1694 {
1695 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1695 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1696 { 1696 {
1697 group.SetPartDescription(Util.CleanString(description), primLocalID); 1697 group.SetPartDescription(Util.CleanString(description), primLocalID);
1698 group.HasGroupChanged = true; 1698 group.HasGroupChanged = true;
@@ -1714,7 +1714,7 @@ namespace OpenSim.Region.Framework.Scenes
1714 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1714 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1715 if (group != null) 1715 if (group != null)
1716 { 1716 {
1717 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1717 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1718 { 1718 {
1719 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); 1719 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
1720 if (part != null) 1720 if (part != null)
@@ -1731,7 +1731,7 @@ namespace OpenSim.Region.Framework.Scenes
1731 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1731 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1732 if (group != null) 1732 if (group != null)
1733 { 1733 {
1734 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1734 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1735 { 1735 {
1736 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); 1736 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
1737 if (part != null) 1737 if (part != null)
@@ -2033,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
2033 // libomv will complain about PrimFlags.JointWheel being 2033 // libomv will complain about PrimFlags.JointWheel being
2034 // deprecated, so we 2034 // deprecated, so we
2035 #pragma warning disable 0612 2035 #pragma warning disable 0612
2036 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog.UUID, remoteClient.AgentId)) 2036 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient))
2037 { 2037 {
2038 sog.RootPart.AddFlag(PrimFlags.JointWheel); 2038 sog.RootPart.AddFlag(PrimFlags.JointWheel);
2039 sog.HasGroupChanged = true; 2039 sog.HasGroupChanged = true;