change GenerateClientFlags(...) to work with a scenepresence; make use of the new IsGod to check its God rights; remove the non standard estate manager right to move other ppl prims i added on last commits; coment out a test method i added sometime ago
parent
e3f7c27c93
commit
e0ab0b3b6b
|
@ -1112,7 +1112,7 @@ namespace OpenSim.Framework
|
||||||
/// <param name="localID"></param>
|
/// <param name="localID"></param>
|
||||||
void SendKillObject(List<uint> localID);
|
void SendKillObject(List<uint> localID);
|
||||||
|
|
||||||
void SendPartFullUpdate(ISceneEntity ent, uint? parentID);
|
// void SendPartFullUpdate(ISceneEntity ent, uint? parentID);
|
||||||
|
|
||||||
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
||||||
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
||||||
|
|
|
@ -4126,14 +4126,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// Vector3 mycamera = Vector3.Zero;
|
// Vector3 mycamera = Vector3.Zero;
|
||||||
Vector3 mypos = Vector3.Zero;
|
Vector3 mypos = Vector3.Zero;
|
||||||
ScenePresence mysp = (ScenePresence)SceneAgent;
|
ScenePresence mysp = (ScenePresence)SceneAgent;
|
||||||
if(mysp != null && !mysp.IsDeleted)
|
|
||||||
|
// we should have a presence
|
||||||
|
if(mysp == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(doCulling)
|
||||||
{
|
{
|
||||||
cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
|
cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f;
|
||||||
// mycamera = mysp.CameraPosition;
|
// mycamera = mysp.CameraPosition;
|
||||||
mypos = mysp.AbsolutePosition;
|
mypos = mysp.AbsolutePosition;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
doCulling = false;
|
|
||||||
|
|
||||||
while (maxUpdatesBytes > 0)
|
while (maxUpdatesBytes > 0)
|
||||||
{
|
{
|
||||||
|
@ -4330,7 +4333,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (update.Entity is ScenePresence)
|
if (update.Entity is ScenePresence)
|
||||||
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity);
|
||||||
else
|
else
|
||||||
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId);
|
ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp);
|
||||||
objectUpdateBlocks.Add(ablock);
|
objectUpdateBlocks.Add(ablock);
|
||||||
objectUpdates.Value.Add(update);
|
objectUpdates.Value.Add(update);
|
||||||
maxUpdatesBytes -= ablock.Length;
|
maxUpdatesBytes -= ablock.Length;
|
||||||
|
@ -4462,6 +4465,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack.. dont use
|
// hack.. dont use
|
||||||
|
/*
|
||||||
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
|
public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectPart)
|
if (ent is SceneObjectPart)
|
||||||
|
@ -4472,7 +4476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f);
|
||||||
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId);
|
ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp);
|
||||||
if (parentID.HasValue)
|
if (parentID.HasValue)
|
||||||
{
|
{
|
||||||
blk.ParentID = parentID.Value;
|
blk.ParentID = parentID.Value;
|
||||||
|
@ -4488,7 +4492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
|
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public void ReprioritizeUpdates()
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
|
@ -5726,7 +5730,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
|
// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID)
|
||||||
|
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, ScenePresence sp)
|
||||||
{
|
{
|
||||||
byte[] objectData = new byte[60];
|
byte[] objectData = new byte[60];
|
||||||
data.RelativePosition.ToBytes(objectData, 0);
|
data.RelativePosition.ToBytes(objectData, 0);
|
||||||
|
@ -5826,12 +5831,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#region PrimFlags
|
#region PrimFlags
|
||||||
|
|
||||||
PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(recipientID, data.UUID);
|
PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(sp, data.UUID);
|
||||||
|
|
||||||
// Don't send the CreateSelected flag to everyone
|
// Don't send the CreateSelected flag to everyone
|
||||||
flags &= ~PrimFlags.CreateSelected;
|
flags &= ~PrimFlags.CreateSelected;
|
||||||
|
|
||||||
if (recipientID == data.OwnerID)
|
if (sp.UUID == data.OwnerID)
|
||||||
{
|
{
|
||||||
if (data.CreateSelected)
|
if (data.CreateSelected)
|
||||||
{
|
{
|
||||||
|
|
|
@ -623,7 +623,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
PrimFlags.ObjectOwnerModify
|
PrimFlags.ObjectOwnerModify
|
||||||
);
|
);
|
||||||
|
|
||||||
public uint GenerateClientFlags(UUID user, UUID objID)
|
public uint GenerateClientFlags(ScenePresence sp, UUID objID)
|
||||||
{
|
{
|
||||||
// ObjectFlags and Permission flags are two different enumerations
|
// ObjectFlags and Permission flags are two different enumerations
|
||||||
// ObjectFlags, tells the client what it will allow the user to do.
|
// ObjectFlags, tells the client what it will allow the user to do.
|
||||||
|
@ -641,8 +641,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
|
|
||||||
objflags &= NOT_DEFAULT_FLAGS;
|
objflags &= NOT_DEFAULT_FLAGS;
|
||||||
|
|
||||||
// get a relevant class for current user on task
|
// get a relevant class for current presence on task
|
||||||
PermissionClass permissionClass = GetPermissionClass(user, task);
|
PermissionClass permissionClass = GetPermissionClass(sp, task);
|
||||||
|
|
||||||
// handle acording
|
// handle acording
|
||||||
uint returnMask = 0;
|
uint returnMask = 0;
|
||||||
|
@ -668,10 +668,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
|
||||||
if (task.OwnerID != UUID.Zero)
|
if (task.OwnerID != UUID.Zero)
|
||||||
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
||||||
|
|
||||||
// allow estatemanagers to move prims to help solve disputes
|
|
||||||
if(!task.ParentGroup.IsAttachment && IsEstateManager(user))
|
|
||||||
returnMask |= (uint)PrimFlags.ObjectMove;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return returnMask;
|
return returnMask;
|
||||||
|
@ -705,6 +701,39 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
return objectFlagsMask;
|
return objectFlagsMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PermissionClass GetPermissionClass(ScenePresence sp, SceneObjectPart obj)
|
||||||
|
{
|
||||||
|
if (obj == null || sp == null)
|
||||||
|
return PermissionClass.Everyone;
|
||||||
|
|
||||||
|
if (m_bypassPermissions)
|
||||||
|
return PermissionClass.Owner;
|
||||||
|
|
||||||
|
|
||||||
|
if (sp.IsGod)
|
||||||
|
return PermissionClass.Owner;
|
||||||
|
|
||||||
|
UUID user = sp.UUID;
|
||||||
|
|
||||||
|
// Object owners should be able to edit their own content
|
||||||
|
UUID objectOwner = obj.OwnerID;
|
||||||
|
if (user == objectOwner)
|
||||||
|
return PermissionClass.Owner;
|
||||||
|
|
||||||
|
if(!obj.ParentGroup.IsAttachment)
|
||||||
|
{
|
||||||
|
if (IsFriendWithPerms(user, objectOwner) )
|
||||||
|
return PermissionClass.Owner;
|
||||||
|
|
||||||
|
// Group permissions
|
||||||
|
if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0))
|
||||||
|
return PermissionClass.Group;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PermissionClass.Everyone;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OARs need this method that handles offline users
|
||||||
public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj)
|
public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
|
|
|
@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
#region Delegates
|
#region Delegates
|
||||||
public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID);
|
public delegate uint GenerateClientFlagsHandler(ScenePresence sp, UUID objectID);
|
||||||
public delegate void SetBypassPermissionsHandler(bool value);
|
public delegate void SetBypassPermissionsHandler(bool value);
|
||||||
public delegate bool BypassPermissionsHandler();
|
public delegate bool BypassPermissionsHandler();
|
||||||
public delegate bool PropagatePermissionsHandler();
|
public delegate bool PropagatePermissionsHandler();
|
||||||
|
@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Object Permission Checks
|
#region Object Permission Checks
|
||||||
|
|
||||||
public uint GenerateClientFlags(UUID userID, UUID objectID)
|
public uint GenerateClientFlags(ScenePresence sp, UUID objectID)
|
||||||
{
|
{
|
||||||
// libomv will moan about PrimFlags.ObjectYouOfficer being
|
// libomv will moan about PrimFlags.ObjectYouOfficer being
|
||||||
// obsolete...
|
// obsolete...
|
||||||
|
@ -195,7 +195,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
|
Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
|
||||||
foreach (GenerateClientFlagsHandler check in list)
|
foreach (GenerateClientFlagsHandler check in list)
|
||||||
{
|
{
|
||||||
perms &= check(userID, objectID);
|
perms &= check(sp, objectID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return perms;
|
return perms;
|
||||||
|
|
Loading…
Reference in New Issue