add CanEdit check for SOGs, iclients and SPs that need to be in scene and use it
parent
7651d60d72
commit
984345a202
|
@ -283,6 +283,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_scene.Permissions.OnIsEstateManager += IsEstateManager;
|
||||
m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
|
||||
m_scene.Permissions.OnDeleteObject += CanDeleteObject;
|
||||
m_scene.Permissions.OnEditObjectByIDs += CanEditObjectByIDs;
|
||||
m_scene.Permissions.OnEditObject += CanEditObject;
|
||||
m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
|
||||
m_scene.Permissions.OnInstantMessage += CanInstantMessage;
|
||||
|
@ -1235,7 +1236,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool CanEditObject(UUID objectID, UUID userID, Scene scene)
|
||||
private bool CanEditObjectByIDs(UUID objectID, UUID userID, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
@ -1250,6 +1251,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool CanEditObject(SceneObjectGroup sog, ScenePresence sp)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
|
||||
return false;
|
||||
|
||||
uint perms = GetObjectPermissions(sp, sog, true);
|
||||
if((perms & (uint)PermissionMask.Modify) == 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CanEditObjectInventory(UUID objectID, UUID userID, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
|
|
|
@ -48,7 +48,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
|
||||
public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
|
||||
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||
public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
|
||||
|
@ -118,6 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event SellGroupObjectHandler OnSellGroupObject;
|
||||
public event TakeCopyObjectHandler OnTakeCopyObject;
|
||||
public event DuplicateObjectHandler OnDuplicateObject;
|
||||
public event EditObjectByIDsHandler OnEditObjectByIDs;
|
||||
public event EditObjectHandler OnEditObject;
|
||||
public event EditObjectInventoryHandler OnEditObjectInventory;
|
||||
public event MoveObjectHandler OnMoveObject;
|
||||
|
@ -307,6 +309,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
TakeObjectHandler handler = OnTakeObject;
|
||||
if (handler != null)
|
||||
{
|
||||
if(sog == null || sp == null)
|
||||
return false;
|
||||
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (TakeObjectHandler h in list)
|
||||
{
|
||||
|
@ -364,6 +369,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
TakeCopyObjectHandler handler = OnTakeCopyObject;
|
||||
if (handler != null)
|
||||
{
|
||||
if(sog == null || sp == null)
|
||||
return false;
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (TakeCopyObjectHandler h in list)
|
||||
{
|
||||
|
@ -419,11 +426,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
#region EDIT OBJECT
|
||||
public bool CanEditObject(UUID objectID, UUID editorID)
|
||||
{
|
||||
EditObjectHandler handler = OnEditObject;
|
||||
EditObjectByIDsHandler handler = OnEditObjectByIDs;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (EditObjectHandler h in list)
|
||||
foreach (EditObjectByIDsHandler h in list)
|
||||
{
|
||||
if (h(objectID, editorID, m_scene) == false)
|
||||
return false;
|
||||
|
@ -432,6 +439,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
|
||||
{
|
||||
EditObjectHandler handler = OnEditObject;
|
||||
if (handler != null)
|
||||
{
|
||||
if(sog == null || client == null || client.SceneAgent == null)
|
||||
return false;
|
||||
|
||||
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (EditObjectHandler h in list)
|
||||
{
|
||||
if (h(sog, sp) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanEditObjectInventory(UUID objectID, UUID editorID)
|
||||
{
|
||||
EditObjectInventoryHandler handler = OnEditObjectInventory;
|
||||
|
@ -452,17 +479,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
#region MOVE OBJECT
|
||||
public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
|
||||
{
|
||||
if(sog == null || client == null)
|
||||
return false;
|
||||
|
||||
if(client.SceneAgent == null)
|
||||
return false;
|
||||
|
||||
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||
|
||||
MoveObjectHandler handler = OnMoveObject;
|
||||
if (handler != null)
|
||||
{
|
||||
if(sog == null || client == null || client.SceneAgent == null)
|
||||
return false;
|
||||
|
||||
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (MoveObjectHandler h in list)
|
||||
{
|
||||
|
|
|
@ -1358,7 +1358,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup grp = part.ParentGroup;
|
||||
if (grp != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(grp, remoteClient))
|
||||
{
|
||||
// These two are exceptions SL makes in the interpretation
|
||||
// of the change flags. Must check them here because otherwise
|
||||
|
@ -1406,7 +1406,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (part != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient))
|
||||
{
|
||||
bool physbuild = false;
|
||||
if (part.ParentGroup.RootPart.PhysActor != null)
|
||||
|
@ -1428,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
bool physbuild = false;
|
||||
if (group.RootPart.PhysActor != null)
|
||||
|
@ -1603,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
group.UpdateTextureEntry(localID, texture);
|
||||
}
|
||||
|
@ -1627,7 +1627,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
// VolumeDetect can't be set via UI and will always be off when a change is made there
|
||||
// now only change volume dtc if phantom off
|
||||
|
@ -1674,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
group.SetPartName(Util.CleanString(name), primLocalID);
|
||||
group.HasGroupChanged = true;
|
||||
|
@ -1692,7 +1692,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
group.SetPartDescription(Util.CleanString(description), primLocalID);
|
||||
group.HasGroupChanged = true;
|
||||
|
@ -1714,7 +1714,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
||||
if (part != null)
|
||||
|
@ -1731,7 +1731,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||
if (group != null)
|
||||
{
|
||||
if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
|
||||
if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
|
||||
{
|
||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
||||
if (part != null)
|
||||
|
@ -2033,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// libomv will complain about PrimFlags.JointWheel being
|
||||
// deprecated, so we
|
||||
#pragma warning disable 0612
|
||||
if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog.UUID, remoteClient.AgentId))
|
||||
if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient))
|
||||
{
|
||||
sog.RootPart.AddFlag(PrimFlags.JointWheel);
|
||||
sog.HasGroupChanged = true;
|
||||
|
|
Loading…
Reference in New Issue