fix right to change permissions of group owned objects

httptests
UbitUmarov 2017-05-03 21:12:16 +01:00
parent 3ef583f205
commit d62aed7f46
3 changed files with 57 additions and 3 deletions

View File

@ -293,6 +293,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnDeleteObject += CanDeleteObject; scenePermissions.OnDeleteObject += CanDeleteObject;
scenePermissions.OnEditObjectByIDs += CanEditObjectByIDs; scenePermissions.OnEditObjectByIDs += CanEditObjectByIDs;
scenePermissions.OnEditObject += CanEditObject; scenePermissions.OnEditObject += CanEditObject;
scenePermissions.OnEditObjectPerms += CanEditObjectPerms;
scenePermissions.OnInventoryTransfer += CanInventoryTransfer; scenePermissions.OnInventoryTransfer += CanInventoryTransfer;
scenePermissions.OnMoveObject += CanMoveObject; scenePermissions.OnMoveObject += CanMoveObject;
scenePermissions.OnTakeObject += CanTakeObject; scenePermissions.OnTakeObject += CanTakeObject;
@ -391,6 +392,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
scenePermissions.OnDeleteObject -= CanDeleteObject; scenePermissions.OnDeleteObject -= CanDeleteObject;
scenePermissions.OnEditObjectByIDs -= CanEditObjectByIDs; scenePermissions.OnEditObjectByIDs -= CanEditObjectByIDs;
scenePermissions.OnEditObject -= CanEditObject; scenePermissions.OnEditObject -= CanEditObject;
scenePermissions.OnEditObjectPerms -= CanEditObjectPerms;
scenePermissions.OnInventoryTransfer -= CanInventoryTransfer; scenePermissions.OnInventoryTransfer -= CanInventoryTransfer;
scenePermissions.OnMoveObject -= CanMoveObject; scenePermissions.OnMoveObject -= CanMoveObject;
scenePermissions.OnTakeObject -= CanTakeObject; scenePermissions.OnTakeObject -= CanTakeObject;
@ -1387,6 +1389,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true; return true;
} }
private bool CanEditObjectPerms(SceneObjectGroup sog, UUID userID)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
if (sog == null)
return false;
if(sog.OwnerID == userID || IsAdministrator(userID))
return true;
UUID sogGroupID = sog.GroupID;
if(sogGroupID == UUID.Zero || sogGroupID != sog.OwnerID)
return false;
uint perms = sog.EffectiveOwnerPerms;
if((perms & (uint)PermissionMask.Modify) == 0)
return false;
ulong powers = 0;
if(GroupMemberPowers(sogGroupID, userID, ref powers))
{
if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
return true;
}
return false;
}
private bool CanEditObjectInventory(UUID objectID, UUID userID) private bool CanEditObjectInventory(UUID objectID, UUID userID)
{ {
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@ -2306,7 +2337,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
ulong powers = 0; ulong powers = 0;
if(GroupMemberPowers(sogGroupID, userID, ref powers)) if(GroupMemberPowers(sogGroupID, userID, ref powers))
{ {
if(powers == (ulong)GroupPowers.ObjectManipulate) if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
return true; return true;
if((ti.EveryonePermissions & (uint)PermissionMask.Copy) != 0) if((ti.EveryonePermissions & (uint)PermissionMask.Copy) != 0)

View File

@ -53,6 +53,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp); public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID); public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool EditObjectPermsHandler(SceneObjectGroup sog, UUID editorID);
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID); public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint); public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
@ -133,6 +134,7 @@ namespace OpenSim.Region.Framework.Scenes
public event DuplicateObjectHandler OnDuplicateObject; public event DuplicateObjectHandler OnDuplicateObject;
public event EditObjectByIDsHandler OnEditObjectByIDs; public event EditObjectByIDsHandler OnEditObjectByIDs;
public event EditObjectHandler OnEditObject; public event EditObjectHandler OnEditObject;
public event EditObjectPermsHandler OnEditObjectPerms;
public event EditObjectInventoryHandler OnEditObjectInventory; public event EditObjectInventoryHandler OnEditObjectInventory;
public event MoveObjectHandler OnMoveObject; public event MoveObjectHandler OnMoveObject;
public event ObjectEntryHandler OnObjectEntry; public event ObjectEntryHandler OnObjectEntry;
@ -511,6 +513,24 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
public bool CanEditObjectPermissions(SceneObjectGroup sog, UUID editorID)
{
EditObjectPermsHandler handler = OnEditObjectPerms;
if (handler != null)
{
if(sog == null)
return false;
Delegate[] list = handler.GetInvocationList();
foreach (EditObjectPermsHandler h in list)
{
if (h(sog, editorID) == false)
return false;
}
}
return true;
}
public bool CanEditObjectInventory(UUID objectID, UUID editorID) public bool CanEditObjectInventory(UUID objectID, UUID editorID)
{ {
EditObjectInventoryHandler handler = OnEditObjectInventory; EditObjectInventoryHandler handler = OnEditObjectInventory;

View File

@ -4460,8 +4460,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
if (god) if (god)
baseMask = 0x7ffffff0; baseMask = 0x7ffffff0;
// Are we the owner? bool canChange = (AgentID == OwnerID) || god;
if ((AgentID == OwnerID) || god) if(!canChange)
canChange = ParentGroup.Scene.Permissions.CanEditObjectPermissions(ParentGroup, AgentID);
if (canChange)
{ {
switch (field) switch (field)
{ {