* A lot of ugly permissions updates.
** Created SendFullUpdateToAllClientsExcept(LLUUID) so that permission updates /appear/ to apply immediately ** Separated out the ObjectFlags and the Permission Flags. They're related but not the same ** Added a hack routine to add *back* the objectflags to the client flags because the client hates the way we're doing object permissions ** Updated the clientflags routine to properly tell the client when they can't edit admin objects (objects owned by the sim administrator) even when they're an estate manager(why? >.< argh!) ** Fixed a null sim administrator/estate manager/user from causing permissions to return false even when it should return true. ** Re-added ObjectModify hack to allow collaboration with the allow anyone to move checkbox until we get group permissions done.ThreadPoolClientBranch
parent
e207284fef
commit
85a9834ed8
|
@ -80,22 +80,35 @@ namespace OpenSim.Region.Environment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there is no master avatar, return false
|
||||||
|
if (m_scene.RegionInfo.MasterAvatarAssignedUUID != null)
|
||||||
|
{
|
||||||
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
|
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool IsEstateManager(LLUUID user)
|
public virtual bool IsEstateManager(LLUUID user)
|
||||||
{
|
{
|
||||||
if (m_bypassPermissions)
|
if (m_bypassPermissions)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
|
LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
|
||||||
for (int i = 0; i < estatemanagers.Length; i++)
|
for (int i = 0; i < estatemanagers.Length; i++)
|
||||||
{
|
{
|
||||||
if (estatemanagers[i] == user)
|
if (estatemanagers[i] == user)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// The below is commented out because logically it happens anyway. It's left in for readability
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
//return false;
|
||||||
|
//}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -153,6 +166,18 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
|
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Here's the way this works,
|
||||||
|
// ObjectFlags and Permission flags are two different enumerations
|
||||||
|
// ObjectFlags, however, tells the client to change what it will allow the user to do.
|
||||||
|
// So, that means that all of the permissions type ObjectFlags are /temporary/ and only
|
||||||
|
// supposed to be set when customizing the objectflags for the client.
|
||||||
|
|
||||||
|
// These temporary objectflags get computed and added in this function based on the
|
||||||
|
// Permission mask that's appropriate!
|
||||||
|
// Outside of this method, they should never be added to objectflags!
|
||||||
|
// -teravus
|
||||||
|
|
||||||
if (!m_scene.Entities.ContainsKey(objID))
|
if (!m_scene.Entities.ContainsKey(objID))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -170,10 +195,38 @@ namespace OpenSim.Region.Environment
|
||||||
// the administrator object permissions to take effect.
|
// the administrator object permissions to take effect.
|
||||||
LLUUID objectOwner = task.OwnerID;
|
LLUUID objectOwner = task.OwnerID;
|
||||||
|
|
||||||
uint objectOwnerMask = task.RootPart.ObjectFlags;
|
uint objflags = task.RootPart.ObjectFlags;
|
||||||
objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objectOwnerMask);
|
|
||||||
|
|
||||||
uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask;
|
|
||||||
|
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
|
||||||
|
// in the next bit of code
|
||||||
|
|
||||||
|
objflags &= (uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object
|
||||||
|
objflags &= (uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object
|
||||||
|
objflags &= (uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod)
|
||||||
|
objflags &= (uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it
|
||||||
|
objflags &= (uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object
|
||||||
|
objflags &= (uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
|
||||||
|
|
||||||
|
|
||||||
|
// Creating the three ObjectFlags options for this method to choose from.
|
||||||
|
bool tasklocked = task.GetLocked(); // more debug needed to apply this, so we're going to set this to false for now
|
||||||
|
tasklocked = false;
|
||||||
|
|
||||||
|
uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags, tasklocked);
|
||||||
|
objectOwnerMask = AddBackBrokenObjectProperties(task.RootPart, objectOwnerMask);
|
||||||
|
|
||||||
|
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
|
||||||
|
|
||||||
|
uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags, tasklocked);
|
||||||
|
objectGroupMask = AddBackBrokenObjectProperties(task.RootPart,objectGroupMask);
|
||||||
|
|
||||||
|
uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags, tasklocked);
|
||||||
|
objectEveryoneMask = AddBackBrokenObjectProperties(task.RootPart,objectEveryoneMask);
|
||||||
|
|
||||||
|
// Hack to allow collaboration until Groups and Group Permissions are implemented
|
||||||
|
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
|
||||||
|
objectEveryoneMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
||||||
|
|
||||||
if (m_bypassPermissions)
|
if (m_bypassPermissions)
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
|
@ -181,7 +234,6 @@ namespace OpenSim.Region.Environment
|
||||||
// Object owners should be able to edit their own content
|
// Object owners should be able to edit their own content
|
||||||
if (user == objectOwner)
|
if (user == objectOwner)
|
||||||
{
|
{
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
|
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,57 +242,69 @@ namespace OpenSim.Region.Environment
|
||||||
if (parcel != null && parcel.landData.ownerID == user)
|
if (parcel != null && parcel.landData.ownerID == user)
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
|
|
||||||
|
// Admin objects should not be editable by the above
|
||||||
|
if (IsAdministrator(objectOwner))
|
||||||
|
return objectEveryoneMask;
|
||||||
|
|
||||||
// Estate users should be able to edit anything in the sim
|
// Estate users should be able to edit anything in the sim
|
||||||
if (IsEstateManager(user))
|
if (IsEstateManager(user))
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
|
|
||||||
// Admin objects should not be editable by the above
|
|
||||||
if (IsAdministrator(taskOwner))
|
|
||||||
return objectEveryoneMask;
|
|
||||||
|
|
||||||
// Admin should be able to edit anything in the sim (including admin objects)
|
// Admin should be able to edit anything in the sim (including admin objects)
|
||||||
if (IsAdministrator(user))
|
if (IsAdministrator(user))
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
|
|
||||||
if (((objectEveryoneMask & PERM_MOVE) != 0) || ((objectEveryoneMask & PERM_COPY) != 0))
|
|
||||||
{
|
|
||||||
if ((objectEveryoneMask & PERM_MOVE) != 0)
|
|
||||||
objectOwnerMask &= ~PERM_MOVE;
|
|
||||||
|
|
||||||
if ((objectEveryoneMask & PERM_COPY) != 0)
|
|
||||||
objectOwnerMask &= ~PERM_COPY;
|
|
||||||
|
|
||||||
objectOwnerMask &= ~PERM_MODIFY;
|
|
||||||
objectOwnerMask &= ~PERM_TRANS;
|
|
||||||
|
|
||||||
return objectOwnerMask;
|
|
||||||
}
|
|
||||||
return objectEveryoneMask;
|
return objectEveryoneMask;
|
||||||
}
|
}
|
||||||
|
private uint AddBackBrokenObjectProperties(SceneObjectPart task, uint objectmask)
|
||||||
|
|
||||||
private uint ApplyObjectModifyMasks(uint parentMask, uint objectOwnerMask)
|
|
||||||
{
|
{
|
||||||
if ((parentMask & (uint)PermissionMask.Copy) != 0)
|
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0)
|
||||||
{
|
objectmask |= (uint)LLObject.ObjectFlags.Physics;
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
|
|
||||||
|
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Scripted) != 0)
|
||||||
|
objectmask |= (uint)LLObject.ObjectFlags.Scripted;
|
||||||
|
|
||||||
|
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.TemporaryOnRez) != 0)
|
||||||
|
objectmask |= (uint)LLObject.ObjectFlags.TemporaryOnRez;
|
||||||
|
|
||||||
|
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0)
|
||||||
|
objectmask |= (uint)LLObject.ObjectFlags.Phantom;
|
||||||
|
|
||||||
|
return objectmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((parentMask & (uint)PermissionMask.Move) != 0)
|
|
||||||
|
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool locked)
|
||||||
{
|
{
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove;
|
// We are adding the temporary objectflags to the object's objectflags based on the
|
||||||
|
// permission flag given. These change the F flags on the client.
|
||||||
|
if (!locked)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
|
||||||
|
{
|
||||||
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((parentMask & (uint)PermissionMask.Modify) != 0)
|
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
|
||||||
{
|
{
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((parentMask & (uint)PermissionMask.Transfer) != 0)
|
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
|
||||||
{
|
{
|
||||||
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
||||||
}
|
}
|
||||||
return objectOwnerMask;
|
|
||||||
|
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
|
||||||
|
{
|
||||||
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objectFlagsMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
|
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
|
||||||
|
@ -254,12 +318,13 @@ namespace OpenSim.Region.Environment
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's not an object, we cant edit it.
|
// If it's not an object, we cant edit it.
|
||||||
if (!(m_scene.Entities[objId] is SceneObjectGroup))
|
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectGroup group = (SceneObjectGroup) m_scene.Entities[objId];
|
|
||||||
|
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
|
||||||
|
|
||||||
LLUUID objectOwner = group.OwnerID;
|
LLUUID objectOwner = group.OwnerID;
|
||||||
|
|
||||||
|
@ -323,13 +388,20 @@ namespace OpenSim.Region.Environment
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The client
|
||||||
|
// may request to edit linked parts, and therefore, it needs
|
||||||
|
// to also check for SceneObjectPart
|
||||||
|
|
||||||
// If it's not an object, we cant edit it.
|
// If it's not an object, we cant edit it.
|
||||||
if (!(m_scene.Entities[obj] is SceneObjectGroup))
|
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
|
|
||||||
|
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
|
||||||
|
|
||||||
|
|
||||||
LLUUID taskOwner = null;
|
LLUUID taskOwner = null;
|
||||||
// Added this because at this point in time it wouldn't be wise for
|
// Added this because at this point in time it wouldn't be wise for
|
||||||
// the administrator object permissions to take effect.
|
// the administrator object permissions to take effect.
|
||||||
|
|
|
@ -60,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// since the group's last persistent backup
|
/// since the group's last persistent backup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasGroupChanged = false;
|
public bool HasGroupChanged = false;
|
||||||
|
private bool m_locked = false;
|
||||||
|
|
||||||
private LLVector3 lastPhysGroupPos;
|
private LLVector3 lastPhysGroupPos;
|
||||||
private LLQuaternion lastPhysGroupRot;
|
private LLQuaternion lastPhysGroupRot;
|
||||||
|
@ -1217,7 +1218,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
part.UpdateExtraParam(type, inUse, data);
|
part.UpdateExtraParam(type, inUse, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool GetLocked()
|
||||||
|
{
|
||||||
|
return m_locked;
|
||||||
|
}
|
||||||
|
public void SetLocked(bool val)
|
||||||
|
{
|
||||||
|
m_locked = val;
|
||||||
|
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -44,7 +44,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
// I don't really know where to put this except here.
|
// I don't really know where to put this except here.
|
||||||
// Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
|
// Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
|
||||||
|
[Flags]
|
||||||
|
public enum ExtraParamType
|
||||||
|
{
|
||||||
|
Something1 = 1,
|
||||||
|
Something2 = 2,
|
||||||
|
Something3 = 4,
|
||||||
|
Something4 = 8,
|
||||||
|
Flexible = 16,
|
||||||
|
Light = 32,
|
||||||
|
Sculpt = 48,
|
||||||
|
Something5 = 64,
|
||||||
|
Something6 = 128
|
||||||
|
}
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Changed : uint
|
public enum Changed : uint
|
||||||
{
|
{
|
||||||
|
@ -1166,6 +1178,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
|
public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1));
|
||||||
|
//m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2));
|
||||||
|
//m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3));
|
||||||
|
//m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4));
|
||||||
|
//m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5));
|
||||||
|
//m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6));
|
||||||
|
|
||||||
bool usePhysics = false;
|
bool usePhysics = false;
|
||||||
bool IsTemporary = false;
|
bool IsTemporary = false;
|
||||||
bool IsPhantom = false;
|
bool IsPhantom = false;
|
||||||
|
@ -1579,7 +1600,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
//EveryoneMask |= (uint)57344;
|
//EveryoneMask |= (uint)57344;
|
||||||
}
|
}
|
||||||
//ScheduleFullUpdate();
|
//ScheduleFullUpdate();
|
||||||
SendFullUpdateToAllClients();
|
SendFullUpdateToAllClientsExcept(AgentID);
|
||||||
}
|
}
|
||||||
//Field 16 = NextownerMask
|
//Field 16 = NextownerMask
|
||||||
if (field == (byte) 16)
|
if (field == (byte) 16)
|
||||||
|
@ -1592,8 +1613,25 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
NextOwnerMask |= mask;
|
NextOwnerMask |= mask;
|
||||||
}
|
}
|
||||||
SendFullUpdateToAllClients();
|
SendFullUpdateToAllClientsExcept(AgentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (field == (byte)2)
|
||||||
|
{
|
||||||
|
if (addRemTF == (byte)0)
|
||||||
|
{
|
||||||
|
m_parentGroup.SetLocked(true);
|
||||||
|
//OwnerMask &= ~mask;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_parentGroup.SetLocked(false);
|
||||||
|
//OwnerMask |= mask;
|
||||||
|
}
|
||||||
|
SendFullUpdateToAllClients();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1607,7 +1645,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
avatars[i].QueuePartForUpdate(this);
|
avatars[i].QueuePartForUpdate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void SendFullUpdateToAllClientsExcept(LLUUID agentID)
|
||||||
|
{
|
||||||
|
List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
|
||||||
|
for (int i = 0; i < avatars.Count; i++)
|
||||||
|
{
|
||||||
|
// Ugly reference :(
|
||||||
|
if (avatars[i].UUID != agentID)
|
||||||
|
{
|
||||||
|
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
|
||||||
|
avatars[i].GenerateClientFlags(UUID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public void AddFullUpdateToAvatar(ScenePresence presence)
|
public void AddFullUpdateToAvatar(ScenePresence presence)
|
||||||
{
|
{
|
||||||
presence.QueuePartForUpdate(this);
|
presence.QueuePartForUpdate(this);
|
||||||
|
|
Loading…
Reference in New Issue