Create CanEditObjectInventory to preserve the ability

to have different permissions on inventory and object
edits. This may be needed by the viewer on public grids
0.6.0-stable
Melanie Thielker 2008-09-22 12:52:56 +00:00
parent 7def786ef4
commit d7a98925ce
3 changed files with 49 additions and 26 deletions

View File

@ -163,6 +163,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditObject(CanEditObjectInventory);//MAYBE FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED
@ -602,6 +603,25 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return GenericObjectPermission(editorID, objectID, false);
}
private bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
// Commented because this behavior causes issues for IBM
// With this commented, strange viewer issues can be observed
// when trying to edit scripts and/or notecards in
// "Hacked god mode"
// TODO: add group support!
//
// if(part.OwnerID != editorID)
// return false;
return GenericObjectPermission(editorID, objectID, false);
}
private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);

View File

@ -1186,18 +1186,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part != null)
{
// replacing the following two checks with the
// ExternalChecks.ExternalChecksCanEditObject(...)
// call
// if (part.OwnerID != remoteClient.AgentId)
// return;
// if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
// return;
if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
{
return;
}
@ -1293,20 +1282,7 @@ System.Console.WriteLine("Item asset {0}, request asset {1}", prevItem.AssetID.T
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
/*
if (part.OwnerID != remoteClient.AgentId)
{
return;
}
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{
return;
}
*/
if (!ExternalChecks.ExternalChecksCanEditObject(part.UUID, remoteClient.AgentId))
if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
{
return;
}

View File

@ -343,6 +343,33 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
public delegate bool CanEditObjectInventory(UUID objectID, UUID editorID, Scene scene);
private List<CanEditObjectInventory> CanEditObjectInventoryCheckFunctions = new List<CanEditObjectInventory>();
public void addCheckEditObjectInventory(CanEditObjectInventory delegateFunc)
{
if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
CanEditObjectInventoryCheckFunctions.Add(delegateFunc);
}
public void removeCheckEditObjectInventory(CanEditObjectInventory delegateFunc)
{
if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
CanEditObjectInventoryCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanEditObjectInventory(UUID objectID, UUID editorID)
{
foreach (CanEditObjectInventory check in CanEditObjectInventoryCheckFunctions)
{
if (check(objectID, editorID, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region MOVE OBJECT