object Take and TakeCopy are for in scene SOPs and SPs and permitions module is NOT a shared module
parent
b9ecc962ac
commit
fe9a785ecc
|
@ -1322,7 +1322,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
|
|
||||||
|
if (!m_scene.Permissions.CanTakeObject(group, sp))
|
||||||
{
|
{
|
||||||
remoteClient.SendAgentAlertMessage(
|
remoteClient.SendAgentAlertMessage(
|
||||||
"You don't have sufficient permissions to attach this object", false);
|
"You don't have sufficient permissions to attach this object", false);
|
||||||
|
@ -1334,7 +1336,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
AttachmentPt &= 0x7f;
|
AttachmentPt &= 0x7f;
|
||||||
|
|
||||||
// Calls attach with a Zero position
|
// Calls attach with a Zero position
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
|
||||||
if (AttachObject(sp, group , AttachmentPt, false, true, append))
|
if (AttachObject(sp, group , AttachmentPt, false, true, append))
|
||||||
{
|
{
|
||||||
if (DebugLevel > 0)
|
if (DebugLevel > 0)
|
||||||
|
|
|
@ -541,16 +541,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
#region Permissions
|
#region Permissions
|
||||||
|
|
||||||
private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
|
private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
if (m_bypassPermissions) return true;
|
if (m_bypassPermissions) return true;
|
||||||
|
|
||||||
if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer))
|
if(sp == null || sog == null)
|
||||||
{
|
return false;
|
||||||
SceneObjectGroup sog = null;
|
|
||||||
if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(sp.UUID))
|
||||||
|
{
|
||||||
|
if (sog.OwnerID == sp.UUID)
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1671,39 +1671,45 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
|
return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanTakeObject(UUID objectID, UUID userID, Scene scene)
|
private bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||||
|
|
||||||
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
|
if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
|
||||||
if (sog == null)
|
return false;
|
||||||
|
|
||||||
|
// take is not a attachment op
|
||||||
|
if(sog.IsAttachment)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// ignore locked, viewers shell ask for confirmation
|
// ignore locked, viewers shell ask for confirmation
|
||||||
uint perms = GetObjectPermissions(userID, sog, false);
|
uint perms = GetObjectPermissions(sp, sog, false);
|
||||||
if((perms & (uint)PermissionMask.Modify) == 0)
|
if((perms & (uint)PermissionMask.Modify) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (sog.OwnerID != userID && ((perms & (uint)PermissionMask.Transfer) == 0))
|
if (sog.OwnerID != sp.UUID && ((perms & (uint)PermissionMask.Transfer) == 0))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanTakeCopyObject(UUID objectID, UUID userID, Scene inScene)
|
private bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||||
|
|
||||||
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
|
if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
|
||||||
if (sog == null)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint perms = GetObjectPermissions(userID, sog, true);
|
// refuse on attachments
|
||||||
|
if(sog.IsAttachment && !sp.IsGod)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint perms = GetObjectPermissions(sp, sog, true);
|
||||||
if((perms & (uint)PermissionMask.Copy) == 0)
|
if((perms & (uint)PermissionMask.Copy) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(sog.OwnerID != userID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
|
if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2126,6 +2126,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> deleteGroups = new List<SceneObjectGroup>();
|
||||||
List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
|
||||||
|
|
||||||
|
ScenePresence sp = remoteClient.SceneAgent as ScenePresence;
|
||||||
|
|
||||||
// Start with true for both, then remove the flags if objects
|
// Start with true for both, then remove the flags if objects
|
||||||
// that we can't derez are part of the selection
|
// that we can't derez are part of the selection
|
||||||
bool permissionToTake = true;
|
bool permissionToTake = true;
|
||||||
|
@ -2180,14 +2182,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (action == DeRezAction.TakeCopy)
|
if (action == DeRezAction.TakeCopy)
|
||||||
{
|
{
|
||||||
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
|
if (!Permissions.CanTakeCopyObject(grp, sp))
|
||||||
permissionToTakeCopy = false;
|
permissionToTakeCopy = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
permissionToTakeCopy = false;
|
permissionToTakeCopy = false;
|
||||||
}
|
}
|
||||||
if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
|
if (!Permissions.CanTakeObject(grp, sp))
|
||||||
permissionToTake = false;
|
permissionToTake = false;
|
||||||
|
|
||||||
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
|
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
|
||||||
|
|
|
@ -44,9 +44,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
|
public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
|
||||||
public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
|
public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
|
||||||
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
|
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
|
||||||
public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
|
public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
|
||||||
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
|
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
|
||||||
public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
|
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 DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
|
||||||
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
|
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
|
||||||
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
|
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
|
||||||
|
@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region TAKE OBJECT
|
#region TAKE OBJECT
|
||||||
public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
|
public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (TakeObjectHandler h in list)
|
foreach (TakeObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, AvatarTakingUUID, m_scene) == false)
|
if (h(sog, sp) == false)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
|
@ -357,7 +357,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
|
|
||||||
#region TAKE COPY OBJECT
|
#region TAKE COPY OBJECT
|
||||||
public bool CanTakeCopyObject(UUID objectID, UUID userID)
|
public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handler.GetInvocationList();
|
Delegate[] list = handler.GetInvocationList();
|
||||||
foreach (TakeCopyObjectHandler h in list)
|
foreach (TakeCopyObjectHandler h in list)
|
||||||
{
|
{
|
||||||
if (h(objectID, userID, m_scene) == false)
|
if (h(sog, sp) == false)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue