GenerateClientFlags: consider locked state, change object group; CanRezObject: remove odd elses and group roles are only for group owned land
parent
dafb362b60
commit
3e0a61915f
|
@ -592,10 +592,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
|
|
||||||
protected bool IsFriendWithPerms(UUID user, UUID objectOwner)
|
protected bool IsFriendWithPerms(UUID user, UUID objectOwner)
|
||||||
{
|
{
|
||||||
if (user == UUID.Zero)
|
if (FriendsModule == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (FriendsModule == null)
|
if (user == UUID.Zero)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner);
|
int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner);
|
||||||
|
@ -684,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
// gods have owner rights with Modify and Move always on
|
// gods have owner rights with Modify and Move always on
|
||||||
if(sp.IsGod)
|
if(sp.IsGod)
|
||||||
{
|
{
|
||||||
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
|
||||||
returnMask |= EXTRAGODMASK;
|
returnMask |= EXTRAGODMASK;
|
||||||
return returnMask;
|
return returnMask;
|
||||||
}
|
}
|
||||||
|
@ -692,20 +692,22 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
//bypass option == owner rights
|
//bypass option == owner rights
|
||||||
if (m_bypassPermissions)
|
if (m_bypassPermissions)
|
||||||
{
|
{
|
||||||
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true);
|
||||||
returnMask |= EXTRAOWNERMASK;
|
returnMask |= EXTRAOWNERMASK;
|
||||||
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
|
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
|
||||||
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
|
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
|
||||||
return returnMask;
|
return returnMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
|
||||||
|
|
||||||
UUID taskOwnerID = task.OwnerID;
|
UUID taskOwnerID = task.OwnerID;
|
||||||
UUID spID = sp.UUID;
|
UUID spID = sp.UUID;
|
||||||
|
|
||||||
// owner
|
// owner
|
||||||
if (spID == taskOwnerID)
|
if (spID == taskOwnerID)
|
||||||
{
|
{
|
||||||
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
|
||||||
returnMask |= EXTRAOWNERMASK;
|
returnMask |= EXTRAOWNERMASK;
|
||||||
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
|
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
|
||||||
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
|
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
|
||||||
|
@ -715,16 +717,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
// if not god or owner, do attachments as everyone
|
// if not god or owner, do attachments as everyone
|
||||||
if(task.ParentGroup.IsAttachment)
|
if(task.ParentGroup.IsAttachment)
|
||||||
{
|
{
|
||||||
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
|
||||||
if (taskOwnerID != UUID.Zero)
|
if (taskOwnerID != UUID.Zero)
|
||||||
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
||||||
return returnMask;
|
return returnMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UUID taskGroupID = task.GroupID;
|
||||||
|
bool groupdOwned = taskOwnerID == taskGroupID;
|
||||||
|
|
||||||
// if friends with rights then owner
|
// if friends with rights then owner
|
||||||
if (IsFriendWithPerms(spID, taskOwnerID))
|
if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
|
||||||
{
|
{
|
||||||
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
|
||||||
returnMask |= EXTRAOWNERMASK;
|
returnMask |= EXTRAOWNERMASK;
|
||||||
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
|
if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
|
||||||
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
|
returnMask |= (uint)PrimFlags.ObjectOwnerModify;
|
||||||
|
@ -732,18 +737,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
// group owned or shared ?
|
// group owned or shared ?
|
||||||
UUID taskGroupID = task.GroupID;
|
|
||||||
IClientAPI client = sp.ControllingClient;
|
IClientAPI client = sp.ControllingClient;
|
||||||
if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID))
|
if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID))
|
||||||
{
|
{
|
||||||
if(taskGroupID == taskOwnerID)
|
if(groupdOwned)
|
||||||
{
|
{
|
||||||
// object is owned by group, owner rights and group role powers do apply
|
// object is owned by group, check role powers
|
||||||
if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0)
|
if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0)
|
||||||
// instead forcing active group can be safeguard againts casual mistakes ??
|
|
||||||
//if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate))
|
|
||||||
{
|
{
|
||||||
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked);
|
||||||
returnMask |=
|
returnMask |=
|
||||||
(uint)PrimFlags.ObjectGroupOwned |
|
(uint)PrimFlags.ObjectGroupOwned |
|
||||||
(uint)PrimFlags.ObjectAnyOwner;
|
(uint)PrimFlags.ObjectAnyOwner;
|
||||||
|
@ -753,16 +755,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no special rights
|
// group sharing or everyone
|
||||||
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
|
||||||
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
returnMask |=
|
||||||
|
(uint)PrimFlags.ObjectGroupOwned |
|
||||||
|
(uint)PrimFlags.ObjectAnyOwner;
|
||||||
return returnMask;
|
return returnMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// group sharing
|
// group sharing or everyone
|
||||||
returnMask = ApplyObjectModifyMasks(task.GroupMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
|
||||||
if (taskOwnerID != UUID.Zero)
|
if (taskOwnerID != UUID.Zero)
|
||||||
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
||||||
return returnMask;
|
return returnMask;
|
||||||
|
@ -770,13 +774,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback is everyone rights
|
// fallback is everyone rights
|
||||||
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags);
|
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
|
||||||
if (taskOwnerID != UUID.Zero)
|
if (taskOwnerID != UUID.Zero)
|
||||||
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
returnMask |= (uint)PrimFlags.ObjectAnyOwner;
|
||||||
return returnMask;
|
return returnMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
|
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool unlocked)
|
||||||
{
|
{
|
||||||
// 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.
|
||||||
|
@ -786,14 +790,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
objectFlagsMask |= (uint)PrimFlags.ObjectCopy;
|
objectFlagsMask |= (uint)PrimFlags.ObjectCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
|
if (unlocked)
|
||||||
{
|
{
|
||||||
objectFlagsMask |= (uint)PrimFlags.ObjectMove;
|
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
|
||||||
}
|
{
|
||||||
|
objectFlagsMask |= (uint)PrimFlags.ObjectMove;
|
||||||
|
}
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
|
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
|
||||||
{
|
{
|
||||||
objectFlagsMask |= (uint)PrimFlags.ObjectModify;
|
objectFlagsMask |= (uint)PrimFlags.ObjectModify;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
|
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
|
||||||
|
@ -1559,35 +1566,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
|
private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene)
|
||||||
{
|
{
|
||||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
if (m_bypassPermissions)
|
||||||
|
return m_bypassPermissionsValue;
|
||||||
|
|
||||||
// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
|
// m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name);
|
||||||
|
|
||||||
ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
|
ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
|
||||||
if (parcel == null)
|
if (parcel == null || parcel.LandData == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((parcel.LandData.Flags & (uint)ParcelFlags.CreateObjects) != 0)
|
LandData landdata = parcel.LandData;
|
||||||
{
|
if ((owner == landdata.OwnerID))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else if ((owner == parcel.LandData.OwnerID) || IsAdministrator(owner))
|
if ((landdata.Flags & (uint)ParcelFlags.CreateObjects) != 0)
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else if (((parcel.LandData.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
|
if(IsAdministrator(owner))
|
||||||
&& (parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, owner, 0))
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else if (parcel.LandData.GroupID != UUID.Zero && IsGroupMember(parcel.LandData.GroupID, owner, (ulong)GroupPowers.AllowRez))
|
if(landdata.GroupID != UUID.Zero)
|
||||||
{
|
{
|
||||||
return true;
|
if ((landdata.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0)
|
||||||
}
|
return IsGroupMember(landdata.GroupID, owner, 0);
|
||||||
else
|
|
||||||
{
|
if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, owner, (ulong)GroupPowers.AllowRez))
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanRunConsoleCommand(UUID user, Scene requestFromScene)
|
private bool CanRunConsoleCommand(UUID user, Scene requestFromScene)
|
||||||
|
|
Loading…
Reference in New Issue