fix CanObjectEntry and CanTerraformLand group permissions

httptests
UbitUmarov 2017-01-21 05:14:13 +00:00
parent b20bd1a9df
commit 9d61df0887
1 changed files with 30 additions and 33 deletions

View File

@ -98,8 +98,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool m_forceAdminModeAlwaysOn; private bool m_forceAdminModeAlwaysOn;
private bool m_allowAdminActionsWithoutGodMode; private bool m_allowAdminActionsWithoutGodMode;
private bool m_SimpleBuildPermissions = false;
/// <value> /// <value>
/// The set of users that are allowed to create scripts. This is only active if permissions are not being /// The set of users that are allowed to create scripts. This is only active if permissions are not being
/// bypassed. This overrides normal permissions. /// bypassed. This overrides normal permissions.
@ -185,8 +183,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(m_allowAdminActionsWithoutGodMode) if(m_allowAdminActionsWithoutGodMode)
m_forceAdminModeAlwaysOn = false; m_forceAdminModeAlwaysOn = false;
m_SimpleBuildPermissions = Util.GetConfigVarFromSections<bool>(config, "simple_build_permissions",sections, false);
m_allowedScriptCreators m_allowedScriptCreators
= ParseUserSetConfigSetting(config, "allowed_script_creators", m_allowedScriptCreators); = ParseUserSetConfigSetting(config, "allowed_script_creators", m_allowedScriptCreators);
m_allowedScriptEditors m_allowedScriptEditors
@ -1068,27 +1064,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false; return false;
} }
protected bool GenericParcelPermission(UUID user, ILandObject parcel, ulong groupPowers)
{
if (parcel.LandData.OwnerID == user)
return true;
if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
return true;
if (IsEstateManager(user))
return true;
if (IsAdministrator(user))
return true;
if (m_SimpleBuildPermissions &&
(parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
return true;
return false;
}
protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager) protected bool GenericParcelOwnerPermission(UUID user, ILandObject parcel, ulong groupPowers, bool allowEstateManager)
{ {
if (parcel.LandData.OwnerID == user) if (parcel.LandData.OwnerID == user)
@ -1470,9 +1445,25 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true; return true;
} }
if (GenericParcelPermission(sog.OwnerID, parcel, 0)) UUID userID = sog.OwnerID;
LandData landdata = parcel.LandData;
if (landdata.OwnerID == userID)
return true; return true;
if (IsAdministrator(userID))
return true;
UUID landGroupID = landdata.GroupID;
if (landGroupID != UUID.Zero)
{
if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowGroupObjectEntry)) != 0)
return IsGroupMember(landGroupID, userID, 0);
if (landdata.IsGroupOwned && IsGroupMember(landGroupID, userID, (ulong)GroupPowers.AllowRez))
return true;
}
//Otherwise, false! //Otherwise, false!
return false; return false;
} }
@ -1688,13 +1679,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return true; return true;
} }
private bool CanTerraformLand(UUID user, Vector3 position, Scene requestFromScene) private bool CanTerraformLand(UUID userID, Vector3 position, Scene requestFromScene)
{ {
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
// Estate override // Estate override
if (GenericEstatePermission(user)) if (GenericEstatePermission(userID))
return true; return true;
float X = position.X; float X = position.X;
@ -1713,12 +1704,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (parcel == null) if (parcel == null)
return false; return false;
// Others allowed to terraform? LandData landdata = parcel.LandData;
if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowTerraform)) != 0) if (landdata == null)
return false;
if ((landdata.Flags & ((int)ParcelFlags.AllowTerraform)) != 0)
return true; return true;
// Land owner can terraform too if(landdata.OwnerID == userID)
if (parcel != null && GenericParcelPermission(user, parcel, (ulong)GroupPowers.AllowEditLand)) return true;
if (landdata.IsGroupOwned && parcel.LandData.GroupID != UUID.Zero &&
IsGroupMember(landdata.GroupID, userID, (ulong)GroupPowers.AllowEditLand))
return true; return true;
return false; return false;