Change some lookups in he Land Management module to make group permissions

work better. Add a generic group permissions hoot to the scene permissions
system.
avinationmerge
Melanie 2010-12-13 11:13:34 +01:00
parent 9f9af315ec
commit d36b880022
2 changed files with 22 additions and 5 deletions

View File

@ -1624,7 +1624,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ScenePresence SP; ScenePresence SP;
((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP);
List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); List<SceneObjectGroup> returns = new List<SceneObjectGroup>();
if (SP.GodLevel != 0) if (SP.UserLevel != 0)
{ {
if (flags == 0) //All parcels, scripted or not if (flags == 0) //All parcels, scripted or not
{ {
@ -1692,7 +1692,7 @@ namespace OpenSim.Region.CoreModules.World.Land
((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager);
System.Threading.Timer Timer; System.Threading.Timer Timer;
if (targetAvatar.GodLevel == 0) if (targetAvatar.UserLevel == 0)
{ {
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
@ -1737,7 +1737,7 @@ namespace OpenSim.Region.CoreModules.World.Land
//Just eject //Just eject
if (flags == 0) if (flags == 0)
{ {
if (targetAvatar.GodLevel == 0) if (targetAvatar.UserLevel == 0)
{ {
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))
@ -1816,7 +1816,7 @@ namespace OpenSim.Region.CoreModules.World.Land
//Eject and ban //Eject and ban
if (flags == 1) if (flags == 1)
{ {
if (targetAvatar.GodLevel == 0) if (targetAvatar.UserLevel == 0)
{ {
ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y);
if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land)) if (!((Scene)client.Scene).Permissions.CanEditParcel(client.AgentId, land))

View File

@ -68,6 +68,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool IsGodHandler(UUID user, Scene requestFromScene); public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
public delegate bool IsAdministratorHandler(UUID user); public delegate bool IsAdministratorHandler(UUID user);
public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene);
public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes
public event IsGodHandler OnIsGod; public event IsGodHandler OnIsGod;
public event IsAdministratorHandler OnIsAdministrator; public event IsAdministratorHandler OnIsAdministrator;
public event EditParcelHandler OnEditParcel; public event EditParcelHandler OnEditParcel;
public event EditParcelPropertiesHandler OnEditParcelProperties;
public event SellParcelHandler OnSellParcel; public event SellParcelHandler OnSellParcel;
public event AbandonParcelHandler OnAbandonParcel; public event AbandonParcelHandler OnAbandonParcel;
public event ReclaimParcelHandler OnReclaimParcel; public event ReclaimParcelHandler OnReclaimParcel;
@ -734,6 +736,21 @@ namespace OpenSim.Region.Framework.Scenes
} }
return true; return true;
} }
public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p)
{
EditParcelPropertiesHandler handler = OnEditParcelProperties;
if (handler != null)
{
Delegate[] list = handler.GetInvocationList();
foreach (EditParcelPropertiesHandler h in list)
{
if (h(user, parcel, p, m_scene) == false)
return false;
}
}
return true;
}
#endregion #endregion
#region SELL PARCEL #region SELL PARCEL
@ -1043,4 +1060,4 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
} }
} }