Finalize the logic for SetHome. See comments in Land/LandManagementModule.cs about who has permission to set home where.

user_profiles
Diva Canto 2013-05-11 07:58:14 -07:00
parent ab4d530462
commit a4431381fa
3 changed files with 18 additions and 53 deletions

View File

@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Land
protected IUserManagement m_userManager; protected IUserManagement m_userManager;
protected IPrimCountModule m_primCountModule; protected IPrimCountModule m_primCountModule;
protected IDialogModule m_Dialog; protected IDialogModule m_Dialog;
protected IGroupsModule m_Groups;
// Minimum for parcels to work is 64m even if we don't actually use them. // Minimum for parcels to work is 64m even if we don't actually use them.
#pragma warning disable 0429 #pragma warning disable 0429
@ -156,7 +155,6 @@ namespace OpenSim.Region.CoreModules.World.Land
m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
m_Dialog = m_scene.RequestModuleInterface<IDialogModule>(); m_Dialog = m_scene.RequestModuleInterface<IDialogModule>();
m_Groups = m_scene.RequestModuleInterface<IGroupsModule>();
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
@ -1838,44 +1836,37 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <param name="flags"></param> /// <param name="flags"></param>
public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
{ {
m_log.DebugFormat("[XXX]: SetHome");
// Let's find the parcel in question // Let's find the parcel in question
ILandObject land = landChannel.GetLandObject(position); ILandObject land = landChannel.GetLandObject(position);
if (land == null || m_scene.GridUserService == null) if (land == null || m_scene.GridUserService == null)
{ {
m_Dialog.SendAlertToUser(remoteClient, "Set Home request Failed."); m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
return; return;
} }
// Can the user set home here? // Gather some data
bool canSetHome = false;
// (a) land owners can set home
if (remoteClient.AgentId == land.LandData.OwnerID)
canSetHome = true;
// (b) members of land-owned group in roles that can set home
if (land.LandData.IsGroupOwned && m_Groups != null)
{
ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID); ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID);
m_log.DebugFormat("[XXX]: GroupPowers 0x{0:x16}", gpowers); SceneObjectGroup telehub = null;
if ((gpowers & (ulong)GroupPowers.AllowSetHome) == 1)
canSetHome = true;
}
// (c) parcels with telehubs can be the home of anyone
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero) if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
{ // Does the telehub exist in the scene?
// If the telehub in this parcel? telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
SceneObjectGroup telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
if (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))
canSetHome = true;
}
if (canSetHome) // Can the user set home here?
if (// (a) gods and land managers can set home
m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
m_scene.Permissions.IsGod(remoteClient.AgentId) ||
// (b) land owners can set home
remoteClient.AgentId == land.LandData.OwnerID ||
// (c) members of the land-associated group in roles that can set home
((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
// (d) parcels with telehubs can be the home of anyone
(telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
{ {
if (m_scene.GridUserService != null && m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt)) if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt))
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
m_Dialog.SendAlertToUser(remoteClient, "Home position set."); m_Dialog.SendAlertToUser(remoteClient, "Home position set.");
else else
m_Dialog.SendAlertToUser(remoteClient, "Set Home request Failed."); m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
} }
else else
m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel.");

View File

@ -228,13 +228,6 @@ namespace OpenSim.Region.CoreModules.World.Land
if (estateModule != null) if (estateModule != null)
regionFlags = estateModule.GetRegionFlags(); regionFlags = estateModule.GetRegionFlags();
// In a perfect world, this would have worked.
//
// if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0)
// regionFlags |= (uint)RegionFlags.AllowLandmark;
// if (landData.OwnerID == remote_client.AgentId)
// regionFlags |= (uint)RegionFlags.AllowSetHome;
int seq_id; int seq_id;
if (snap_selection && (sequence_id == 0)) if (snap_selection && (sequence_id == 0))
{ {

View File

@ -3090,7 +3090,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
//client.OnNameFromUUIDRequest += HandleUUIDNameRequest; //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
client.OnSetStartLocationRequest += SetHomeRezPoint;
client.OnRegionHandleRequest += RegionHandleRequest; client.OnRegionHandleRequest += RegionHandleRequest;
} }
@ -3215,7 +3214,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
//client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
client.OnSetStartLocationRequest -= SetHomeRezPoint;
client.OnRegionHandleRequest -= RegionHandleRequest; client.OnRegionHandleRequest -= RegionHandleRequest;
} }
@ -3341,23 +3339,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
{
if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
else
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
}
/// <summary> /// <summary>
/// Get the avatar apperance for the given client. /// Get the avatar apperance for the given client.
/// </summary> /// </summary>