mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
object Take and TakeCopy are for in scene SOPs and SPs and permitions module is NOT a shared module
This commit is contained in:
@@ -1322,7 +1322,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
|
||||
SceneObjectGroup group = part.ParentGroup;
|
||||
|
||||
if (!m_scene.Permissions.CanTakeObject(group, sp))
|
||||
{
|
||||
remoteClient.SendAgentAlertMessage(
|
||||
"You don't have sufficient permissions to attach this object", false);
|
||||
@@ -1334,7 +1336,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Calls attach with a Zero position
|
||||
SceneObjectGroup group = part.ParentGroup;
|
||||
if (AttachObject(sp, group , AttachmentPt, false, true, append))
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
|
||||
@@ -541,16 +541,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
#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_OutboundPermission && !UserManagementModule.IsLocalGridUser(stealer))
|
||||
{
|
||||
SceneObjectGroup sog = null;
|
||||
if (m_Scene.TryGetSceneObjectGroup(objectID, out sog) && sog.OwnerID == stealer)
|
||||
return true;
|
||||
if(sp == null || sog == null)
|
||||
return false;
|
||||
|
||||
if (!m_OutboundPermission && !UserManagementModule.IsLocalGridUser(sp.UUID))
|
||||
{
|
||||
if (sog.OwnerID == sp.UUID)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1671,39 +1671,45 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||
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);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
|
||||
if (sog == null)
|
||||
if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
|
||||
return false;
|
||||
|
||||
// take is not a attachment op
|
||||
if(sog.IsAttachment)
|
||||
return false;
|
||||
|
||||
// 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)
|
||||
return false;
|
||||
|
||||
if (sog.OwnerID != userID && ((perms & (uint)PermissionMask.Transfer) == 0))
|
||||
if (sog.OwnerID != sp.UUID && ((perms & (uint)PermissionMask.Transfer) == 0))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CanTakeCopyObject(UUID objectID, UUID userID, Scene inScene)
|
||||
private bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
SceneObjectGroup sog = m_scene.GetGroupByPrim(objectID);
|
||||
if (sog == null)
|
||||
if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted)
|
||||
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)
|
||||
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 true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user