* some refactoring on permissions
* temporary re-introduced the weird 'flip-back' behaviour, but debugging it; will remove it if I don't find anything.ThreadPoolClientBranch
parent
c7c567182a
commit
c927928245
|
@ -37,12 +37,12 @@ namespace OpenSim.Region.Environment
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
|
|
||||||
// These are here for testing. They will be taken out
|
// These are here for testing. They will be taken out
|
||||||
private uint PERM_ALL = (uint) 2147483647;
|
private uint PERM_ALL = (uint)2147483647;
|
||||||
private uint PERM_COPY = (uint) 32768;
|
private uint PERM_COPY = (uint)32768;
|
||||||
private uint PERM_MODIFY = (uint) 16384;
|
private uint PERM_MODIFY = (uint)16384;
|
||||||
private uint PERM_MOVE = (uint) 524288;
|
private uint PERM_MOVE = (uint)524288;
|
||||||
private uint PERM_TRANS = (uint) 8192;
|
private uint PERM_TRANS = (uint)8192;
|
||||||
private uint PERM_LOCKED = (uint) 540672;
|
private uint PERM_LOCKED = (uint)540672;
|
||||||
// Bypasses the permissions engine (always returns OK)
|
// Bypasses the permissions engine (always returns OK)
|
||||||
// disable in any production environment
|
// disable in any production environment
|
||||||
// TODO: Change this to false when permissions are a desired default
|
// TODO: Change this to false when permissions are a desired default
|
||||||
|
@ -108,7 +108,7 @@ namespace OpenSim.Region.Environment
|
||||||
// The below is commented out because logically it happens anyway. It's left in for readability
|
// The below is commented out because logically it happens anyway. It's left in for readability
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
//return false;
|
//return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -133,8 +133,8 @@ namespace OpenSim.Region.Environment
|
||||||
Land land = m_scene.LandManager.getLandObject(position.X, position.Y);
|
Land land = m_scene.LandManager.getLandObject(position.X, position.Y);
|
||||||
if (land == null) return false;
|
if (land == null) return false;
|
||||||
|
|
||||||
if ((land.landData.landFlags & ((int) Parcel.ParcelFlags.CreateObjects)) ==
|
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
|
||||||
(int) Parcel.ParcelFlags.CreateObjects)
|
(int)Parcel.ParcelFlags.CreateObjects)
|
||||||
permission = true;
|
permission = true;
|
||||||
|
|
||||||
//TODO: check for group rights
|
//TODO: check for group rights
|
||||||
|
@ -190,25 +190,23 @@ namespace OpenSim.Region.Environment
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objID];
|
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objID];
|
||||||
LLUUID taskOwner = null;
|
|
||||||
// Added this because at this point in time it wouldn't be wise for
|
|
||||||
// the administrator object permissions to take effect.
|
|
||||||
LLUUID objectOwner = task.OwnerID;
|
LLUUID objectOwner = task.OwnerID;
|
||||||
|
|
||||||
uint objflags = task.RootPart.ObjectFlags;
|
uint objflags = task.RootPart.ObjectFlags;
|
||||||
|
|
||||||
|
|
||||||
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
|
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
|
||||||
// in the next bit of code
|
// in the next bit of code
|
||||||
|
|
||||||
objflags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object
|
objflags &= (uint)
|
||||||
objflags &= ~(uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object
|
~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
|
||||||
objflags &= ~(uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod)
|
LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
|
||||||
objflags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it
|
LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
|
||||||
objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object
|
LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
|
||||||
objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
|
LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
|
||||||
|
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.
|
// Creating the three ObjectFlags options for this method to choose from.
|
||||||
// Customize the OwnerMask
|
// Customize the OwnerMask
|
||||||
|
@ -217,10 +215,10 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
// Customize the GroupMask
|
// Customize the GroupMask
|
||||||
uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags);
|
uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags);
|
||||||
|
|
||||||
// Customize the EveryoneMask
|
// Customize the EveryoneMask
|
||||||
uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags);
|
uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags);
|
||||||
|
|
||||||
|
|
||||||
// Hack to allow collaboration until Groups and Group Permissions are implemented
|
// Hack to allow collaboration until Groups and Group Permissions are implemented
|
||||||
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
|
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
|
||||||
|
@ -239,16 +237,16 @@ namespace OpenSim.Region.Environment
|
||||||
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
|
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
|
||||||
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
|
// Admin objects should not be editable by the above
|
||||||
if (IsAdministrator(objectOwner))
|
if (IsAdministrator(objectOwner))
|
||||||
return objectEveryoneMask;
|
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 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))
|
||||||
|
@ -257,37 +255,37 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
return objectEveryoneMask;
|
return objectEveryoneMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
|
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
|
||||||
{
|
{
|
||||||
// We are adding the temporary objectflags to the object's objectflags based on the
|
// 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.
|
// permission flag given. These change the F flags on the client.
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
|
|
||||||
{
|
|
||||||
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
|
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
|
||||||
{
|
{
|
||||||
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
|
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
|
||||||
{
|
{
|
||||||
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
|
||||||
|
{
|
||||||
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
|
||||||
|
{
|
||||||
|
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
|
||||||
|
}
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
|
|
||||||
{
|
|
||||||
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return objectFlagsMask;
|
return objectFlagsMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
|
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
|
||||||
{
|
{
|
||||||
// Default: deny
|
// Default: deny
|
||||||
|
@ -307,10 +305,10 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
|
|
||||||
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
|
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
|
||||||
|
|
||||||
LLUUID objectOwner = group.OwnerID;
|
LLUUID objectOwner = group.OwnerID;
|
||||||
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
|
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
|
||||||
|
|
||||||
// People shouldn't be able to do anything with locked objects, except the Administrator
|
// People shouldn't be able to do anything with locked objects, except the Administrator
|
||||||
// The 'set permissions' runs through a different permission check, so when an object owner
|
// The 'set permissions' runs through a different permission check, so when an object owner
|
||||||
// sets an object locked, the only thing that they can do is unlock it.
|
// sets an object locked, the only thing that they can do is unlock it.
|
||||||
|
@ -331,7 +329,7 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
// Users should be able to edit what is over their land.
|
// Users should be able to edit what is over their land.
|
||||||
Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
|
Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
|
||||||
if ((parcel != null) && ( parcel.landData.ownerID == currentUser))
|
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
|
||||||
{
|
{
|
||||||
permission = true;
|
permission = true;
|
||||||
}
|
}
|
||||||
|
@ -386,7 +384,7 @@ namespace OpenSim.Region.Environment
|
||||||
// The client
|
// The client
|
||||||
// may request to edit linked parts, and therefore, it needs
|
// may request to edit linked parts, and therefore, it needs
|
||||||
// to also check for SceneObjectPart
|
// 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)))
|
||||||
{
|
{
|
||||||
|
@ -395,13 +393,13 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
|
|
||||||
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.
|
||||||
LLUUID objectOwner = task.OwnerID;
|
LLUUID objectOwner = task.OwnerID;
|
||||||
|
|
||||||
// Anyone can move
|
// Anyone can move
|
||||||
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
|
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
|
||||||
permission = true;
|
permission = true;
|
||||||
|
@ -430,7 +428,7 @@ namespace OpenSim.Region.Environment
|
||||||
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.
|
||||||
|
|
|
@ -199,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// Update item with new asset
|
// Update item with new asset
|
||||||
item.AssetID = asset.FullID;
|
item.AssetID = asset.FullID;
|
||||||
group.UpdateInventoryItem(item);
|
group.UpdateInventoryItem(item);
|
||||||
group.GetProperites(remoteClient);
|
group.GetProperties(remoteClient);
|
||||||
|
|
||||||
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
|
// Trigger rerunning of script (use TriggerRezScript event, see RezScript)
|
||||||
if (isScriptRunning)
|
if (isScriptRunning)
|
||||||
|
@ -520,7 +520,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
int type = group.RemoveInventoryItem(localID, itemID);
|
int type = group.RemoveInventoryItem(localID, itemID);
|
||||||
group.GetProperites(remoteClient);
|
group.GetProperties(remoteClient);
|
||||||
if (type == 10)
|
if (type == 10)
|
||||||
{
|
{
|
||||||
EventManager.TriggerRemoveScript(localID, itemID);
|
EventManager.TriggerRemoveScript(localID, itemID);
|
||||||
|
@ -599,7 +599,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
group.AddInventoryItem(remoteClient, localID, item, copyID);
|
group.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||||
group.StartScript(localID, copyID);
|
group.StartScript(localID, copyID);
|
||||||
group.GetProperites(remoteClient);
|
group.GetProperties(remoteClient);
|
||||||
|
|
||||||
// m_log.Info(
|
// m_log.Info(
|
||||||
// String.Format("[PRIMINVENTORY]: " +
|
// String.Format("[PRIMINVENTORY]: " +
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (((SceneObjectGroup) ent).LocalId == primLocalID)
|
if (((SceneObjectGroup) ent).LocalId == primLocalID)
|
||||||
{
|
{
|
||||||
((SceneObjectGroup) ent).GetProperites(remoteClient);
|
((SceneObjectGroup) ent).GetProperties(remoteClient);
|
||||||
((SceneObjectGroup) ent).IsSelected = true;
|
((SceneObjectGroup) ent).IsSelected = true;
|
||||||
LandManager.setPrimsTainted();
|
LandManager.setPrimsTainted();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1078,7 +1078,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
public void GetProperites(IClientAPI client)
|
public void GetProperties(IClientAPI client)
|
||||||
{
|
{
|
||||||
ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
|
||||||
// TODO: don't create new blocks if recycling an old packet
|
// TODO: don't create new blocks if recycling an old packet
|
||||||
|
|
|
@ -1577,65 +1577,43 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
|
public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
|
||||||
{
|
{
|
||||||
|
bool set = addRemTF == 1;
|
||||||
|
|
||||||
// Are we the owner?
|
// Are we the owner?
|
||||||
if (AgentID == OwnerID)
|
if (AgentID == OwnerID)
|
||||||
{
|
{
|
||||||
m_log.Info("[PERMISSIONS]: field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " +
|
switch (field)
|
||||||
addRemTF.ToString());
|
|
||||||
|
|
||||||
//Field 8 = EveryoneMask
|
|
||||||
if (field == (byte) 8)
|
|
||||||
{
|
{
|
||||||
m_log.Info("[PERMISSIONS]: Left over: " + (OwnerMask - EveryoneMask));
|
case 2:
|
||||||
if (addRemTF == (byte) 0)
|
OwnerMask = ApplyMask(OwnerMask, set, mask);
|
||||||
{
|
break;
|
||||||
//EveryoneMask = (uint)0;
|
case 4:
|
||||||
EveryoneMask &= ~mask;
|
GroupMask = ApplyMask(GroupMask, set, mask);
|
||||||
//EveryoneMask &= ~(uint)57344;
|
break;
|
||||||
}
|
case 8:
|
||||||
else
|
EveryoneMask = ApplyMask(EveryoneMask, set, mask);
|
||||||
{
|
break;
|
||||||
//EveryoneMask = (uint)0;
|
case 16:
|
||||||
EveryoneMask |= mask;
|
NextOwnerMask = ApplyMask(NextOwnerMask, set, mask);
|
||||||
//EveryoneMask |= (uint)57344;
|
break;
|
||||||
}
|
|
||||||
//ScheduleFullUpdate();
|
|
||||||
SendFullUpdateToAllClientsExcept(AgentID);
|
|
||||||
}
|
|
||||||
//Field 16 = NextownerMask
|
|
||||||
if (field == (byte) 16)
|
|
||||||
{
|
|
||||||
if (addRemTF == (byte) 0)
|
|
||||||
{
|
|
||||||
NextOwnerMask &= ~mask;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NextOwnerMask |= mask;
|
|
||||||
}
|
|
||||||
SendFullUpdateToAllClientsExcept(AgentID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (field == (byte)2)
|
|
||||||
{
|
|
||||||
if (addRemTF == (byte)0)
|
|
||||||
{
|
|
||||||
//m_parentGroup.SetLocked(true);
|
|
||||||
//PermissionMask.
|
|
||||||
OwnerMask &= ~mask;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//m_parentGroup.SetLocked(false);
|
|
||||||
OwnerMask |= mask;
|
|
||||||
}
|
|
||||||
SendFullUpdateToAllClients();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private uint ApplyMask(uint val, bool set, uint mask)
|
||||||
|
{
|
||||||
|
if (set)
|
||||||
|
{
|
||||||
|
return val |= mask;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return val &= ~mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region Client Update Methods
|
#region Client Update Methods
|
||||||
|
|
||||||
public void AddFullUpdateToAllAvatars()
|
public void AddFullUpdateToAllAvatars()
|
||||||
|
|
Loading…
Reference in New Issue