Merge branch 'master' into httptests

httptests
UbitUmarov 2017-01-05 16:33:01 +00:00
commit 9d28fd41c6
10 changed files with 116 additions and 72 deletions

View File

@ -496,7 +496,7 @@ namespace OpenSim.Groups
if (!unlimited && limited) if (!unlimited && limited)
{ {
// check whether person's has this role // check whether person's has this role
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
if (rolemembership == null) if (rolemembership == null)
{ {
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID); m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
@ -516,13 +516,26 @@ namespace OpenSim.Groups
return false; return false;
// check permissions // check permissions
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID); bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
if (!unlimited) if (!limited && !unlimited)
{ {
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID); m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
return false; return false;
} }
// AssignMemberLimited means that the person can assign another person to the same roles that she has in the group
if (!unlimited && limited)
{
// check whether person's has this role
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
if (rolemembership == null)
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at removing {1} from role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
return false;
}
}
RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); RoleMembershipData rolemember = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
if (rolemember == null) if (rolemember == null)
@ -812,7 +825,7 @@ namespace OpenSim.Groups
if (RoleID != UUID.Zero) if (RoleID != UUID.Zero)
_AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); _AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
// Make thit this active group // Make this the active group
PrincipalData pdata = new PrincipalData(); PrincipalData pdata = new PrincipalData();
pdata.PrincipalID = AgentID; pdata.PrincipalID = AgentID;
pdata.ActiveGroupID = GroupID; pdata.ActiveGroupID = GroupID;

View File

@ -11,6 +11,6 @@ CREATE TABLE IF NOT EXISTS `im_offline` (
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
KEY `PrincipalID` (`PrincipalID`), KEY `PrincipalID` (`PrincipalID`),
KEY `FromID` (`FromID`) KEY `FromID` (`FromID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT; COMMIT;

View File

@ -97,7 +97,7 @@ CREATE TABLE IF NOT EXISTS `prims` (
PRIMARY KEY (`UUID`), PRIMARY KEY (`UUID`),
KEY `prims_regionuuid` (`RegionUUID`), KEY `prims_regionuuid` (`RegionUUID`),
KEY `prims_scenegroupid` (`SceneGroupID`) KEY `prims_scenegroupid` (`SceneGroupID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `primshapes` ( CREATE TABLE IF NOT EXISTS `primshapes` (
`Shape` int(11) DEFAULT NULL, `Shape` int(11) DEFAULT NULL,
@ -130,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `primshapes` (
`Media` text, `Media` text,
`LastAttachPoint` int(4) NOT NULL DEFAULT '0', `LastAttachPoint` int(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`UUID`) PRIMARY KEY (`UUID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `primitems` ( CREATE TABLE IF NOT EXISTS `primitems` (
`invType` int(11) DEFAULT NULL, `invType` int(11) DEFAULT NULL,
@ -154,13 +154,13 @@ CREATE TABLE IF NOT EXISTS `primitems` (
`lastOwnerID` char(36) DEFAULT NULL, `lastOwnerID` char(36) DEFAULT NULL,
PRIMARY KEY (`itemID`), PRIMARY KEY (`itemID`),
KEY `primitems_primid` (`primID`) KEY `primitems_primid` (`primID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `terrain` ( CREATE TABLE IF NOT EXISTS `terrain` (
`RegionUUID` varchar(255) DEFAULT NULL, `RegionUUID` varchar(255) DEFAULT NULL,
`Revision` int(11) DEFAULT NULL, `Revision` int(11) DEFAULT NULL,
`Heightfield` longblob `Heightfield` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `land` ( CREATE TABLE IF NOT EXISTS `land` (
`UUID` varchar(255) NOT NULL, `UUID` varchar(255) NOT NULL,
@ -204,21 +204,21 @@ CREATE TABLE IF NOT EXISTS `land` (
`ObscureMusic` tinyint(1) NOT NULL DEFAULT '0', `ObscureMusic` tinyint(1) NOT NULL DEFAULT '0',
`ObscureMedia` tinyint(1) NOT NULL DEFAULT '0', `ObscureMedia` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`UUID`) PRIMARY KEY (`UUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `landaccesslist` ( CREATE TABLE IF NOT EXISTS `landaccesslist` (
`LandUUID` varchar(255) DEFAULT NULL, `LandUUID` varchar(255) DEFAULT NULL,
`AccessUUID` varchar(255) DEFAULT NULL, `AccessUUID` varchar(255) DEFAULT NULL,
`Flags` int(11) DEFAULT NULL, `Flags` int(11) DEFAULT NULL,
`Expires` int(11) NOT NULL DEFAULT '0' `Expires` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `regionban` ( CREATE TABLE IF NOT EXISTS `regionban` (
`regionUUID` varchar(36) NOT NULL, `regionUUID` varchar(36) NOT NULL,
`bannedUUID` varchar(36) NOT NULL, `bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL, `bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL `bannedIpHostMask` varchar(16) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `regionsettings` ( CREATE TABLE IF NOT EXISTS `regionsettings` (
`regionUUID` char(36) NOT NULL, `regionUUID` char(36) NOT NULL,
@ -265,7 +265,7 @@ CREATE TABLE IF NOT EXISTS `regionsettings` (
`parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0', `covenant_datetime` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`regionUUID`) PRIMARY KEY (`regionUUID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `regionwindlight` ( CREATE TABLE IF NOT EXISTS `regionwindlight` (
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', `region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',

View File

@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `usernotes` (
`targetuuid` varchar(36) NOT NULL, `targetuuid` varchar(36) NOT NULL,
`notes` text NOT NULL, `notes` text NOT NULL,
UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`) UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userpicks` ( CREATE TABLE IF NOT EXISTS `userpicks` (
@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `userpicks` (
`enabled` enum('true','false') NOT NULL, `enabled` enum('true','false') NOT NULL,
`gatekeeper` varchar(255), `gatekeeper` varchar(255),
PRIMARY KEY (`pickuuid`) PRIMARY KEY (`pickuuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userprofile` ( CREATE TABLE IF NOT EXISTS `userprofile` (
@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `userprofile` (
`profileFirstImage` varchar(36) NOT NULL, `profileFirstImage` varchar(36) NOT NULL,
`profileFirstText` text NOT NULL, `profileFirstText` text NOT NULL,
PRIMARY KEY (`useruuid`) PRIMARY KEY (`useruuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userdata` ( CREATE TABLE IF NOT EXISTS `userdata` (
`UserId` char(36) NOT NULL, `UserId` char(36) NOT NULL,
@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `userdata` (
`DataKey` varchar(255), `DataKey` varchar(255),
`DataVal` varchar(255), `DataVal` varchar(255),
PRIMARY KEY (`UserId`,`TagId`) PRIMARY KEY (`UserId`,`TagId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `usersettings` ( CREATE TABLE IF NOT EXISTS `usersettings` (
`useruuid` varchar(36) NOT NULL, `useruuid` varchar(36) NOT NULL,
@ -81,6 +81,6 @@ CREATE TABLE IF NOT EXISTS `usersettings` (
`visible` enum('true','false') NOT NULL, `visible` enum('true','false') NOT NULL,
`email` varchar(254) NOT NULL, `email` varchar(254) NOT NULL,
PRIMARY KEY (`useruuid`) PRIMARY KEY (`useruuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
commit; commit;

View File

@ -18,7 +18,7 @@ CREATE TABLE `os_groups_groups` (
PRIMARY KEY (`GroupID`), PRIMARY KEY (`GroupID`),
UNIQUE KEY `Name` (`Name`), UNIQUE KEY `Name` (`Name`),
FULLTEXT KEY `Name_2` (`Name`) FULLTEXT KEY `Name_2` (`Name`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
CREATE TABLE `os_groups_membership` ( CREATE TABLE `os_groups_membership` (
@ -31,7 +31,7 @@ CREATE TABLE `os_groups_membership` (
`AccessToken` char(36) NOT NULL default '', `AccessToken` char(36) NOT NULL default '',
PRIMARY KEY (`GroupID`,`PrincipalID`), PRIMARY KEY (`GroupID`,`PrincipalID`),
KEY `PrincipalID` (`PrincipalID`) KEY `PrincipalID` (`PrincipalID`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
CREATE TABLE `os_groups_roles` ( CREATE TABLE `os_groups_roles` (
@ -43,7 +43,7 @@ CREATE TABLE `os_groups_roles` (
`Powers` bigint(20) unsigned NOT NULL default '0', `Powers` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`GroupID`,`RoleID`), PRIMARY KEY (`GroupID`,`RoleID`),
KEY `GroupID` (`GroupID`) KEY `GroupID` (`GroupID`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
CREATE TABLE `os_groups_rolemembership` ( CREATE TABLE `os_groups_rolemembership` (
@ -52,7 +52,7 @@ CREATE TABLE `os_groups_rolemembership` (
`PrincipalID` VARCHAR(255) NOT NULL default '', `PrincipalID` VARCHAR(255) NOT NULL default '',
PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`), PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`),
KEY `PrincipalID` (`PrincipalID`) KEY `PrincipalID` (`PrincipalID`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
CREATE TABLE `os_groups_invites` ( CREATE TABLE `os_groups_invites` (
@ -63,7 +63,7 @@ CREATE TABLE `os_groups_invites` (
`TMStamp` timestamp NOT NULL, `TMStamp` timestamp NOT NULL,
PRIMARY KEY (`InviteID`), PRIMARY KEY (`InviteID`),
UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`) UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
CREATE TABLE `os_groups_notices` ( CREATE TABLE `os_groups_notices` (
@ -81,13 +81,13 @@ CREATE TABLE `os_groups_notices` (
PRIMARY KEY (`NoticeID`), PRIMARY KEY (`NoticeID`),
KEY `GroupID` (`GroupID`), KEY `GroupID` (`GroupID`),
KEY `TMStamp` (`TMStamp`) KEY `TMStamp` (`TMStamp`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
CREATE TABLE `os_groups_principals` ( CREATE TABLE `os_groups_principals` (
`PrincipalID` VARCHAR(255) NOT NULL default '', `PrincipalID` VARCHAR(255) NOT NULL default '',
`ActiveGroupID` char(36) NOT NULL default '', `ActiveGroupID` char(36) NOT NULL default '',
PRIMARY KEY (`PrincipalID`) PRIMARY KEY (`PrincipalID`)
) ENGINE=MyISAM; ) ENGINE=InnoDB;
COMMIT; COMMIT;

View File

@ -71,6 +71,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnRegionInfoChange;
public event ChangeDelegate OnEstateInfoChange; public event ChangeDelegate OnEstateInfoChange;
public event MessageDelegate OnEstateMessage; public event MessageDelegate OnEstateMessage;
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
private int m_delayCount = 0; private int m_delayCount = 0;
@ -1193,13 +1195,20 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)
{ {
EstateTeleportOneUserHomeRequest evOverride = OnEstateTeleportOneUserHomeRequest;
if(evOverride != null)
{
evOverride(remover_client, invoice, senderID, prey);
return;
}
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
return; return;
if (prey != UUID.Zero) if (prey != UUID.Zero)
{ {
ScenePresence s = Scene.GetScenePresence(prey); ScenePresence s = Scene.GetScenePresence(prey);
if (s != null) if (s != null && !s.IsDeleted && !s.IsInTransit)
{ {
if (!Scene.TeleportClientHome(prey, s.ControllingClient)) if (!Scene.TeleportClientHome(prey, s.ControllingClient))
{ {
@ -1212,6 +1221,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
{ {
EstateTeleportAllUsersHomeRequest evOverride = OnEstateTeleportAllUsersHomeRequest;
if(evOverride != null)
{
evOverride(remover_client, invoice, senderID);
return;
}
if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) if (!Scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false))
return; return;

View File

@ -46,16 +46,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected XEstateModule m_EstateModule; protected XEstateModule m_EstateModule;
private string token;
public EstateConnector(XEstateModule module) public EstateConnector(XEstateModule module, string _token)
{ {
m_EstateModule = module; m_EstateModule = module;
token = _token;
} }
public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID) public void SendTeleportHomeOneUser(uint EstateID, UUID PreyID)
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "teleport_home_one_user"; sendData["METHOD"] = "teleport_home_one_user";
sendData["TOKEN"] = token;
sendData["EstateID"] = EstateID.ToString(); sendData["EstateID"] = EstateID.ToString();
sendData["PreyID"] = PreyID.ToString(); sendData["PreyID"] = PreyID.ToString();
@ -67,6 +70,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "teleport_home_all_users"; sendData["METHOD"] = "teleport_home_all_users";
sendData["TOKEN"] = token;
sendData["EstateID"] = EstateID.ToString(); sendData["EstateID"] = EstateID.ToString();
@ -77,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "update_covenant"; sendData["METHOD"] = "update_covenant";
sendData["TOKEN"] = token;
sendData["CovenantID"] = CovenantID.ToString(); sendData["CovenantID"] = CovenantID.ToString();
sendData["EstateID"] = EstateID.ToString(); sendData["EstateID"] = EstateID.ToString();
@ -99,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "update_estate"; sendData["METHOD"] = "update_estate";
sendData["TOKEN"] = token;
sendData["EstateID"] = EstateID.ToString(); sendData["EstateID"] = EstateID.ToString();
@ -119,6 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["METHOD"] = "estate_message"; sendData["METHOD"] = "estate_message";
sendData["TOKEN"] = token;
sendData["EstateID"] = EstateID.ToString(); sendData["EstateID"] = EstateID.ToString();
sendData["FromID"] = FromID.ToString(); sendData["FromID"] = FromID.ToString();
@ -132,47 +139,43 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID); List<UUID> regions = m_EstateModule.Scenes[0].GetEstateRegions((int)EstateID);
UUID ScopeID = UUID.Zero; // Don't send to the same instance twice
List<string> done = new List<string>();
// Handle local regions locally // Handle local regions locally
//
lock (m_EstateModule.Scenes) lock (m_EstateModule.Scenes)
{ {
foreach (Scene s in m_EstateModule.Scenes) foreach (Scene s in m_EstateModule.Scenes)
{ {
if (regions.Contains(s.RegionInfo.RegionID)) RegionInfo sreg = s.RegionInfo;
if (regions.Contains(sreg.RegionID))
{ {
// All regions in one estate are in the same scope. string url = sreg.ExternalHostName + ":" + sreg.HttpPort;
// Use that scope. regions.Remove(sreg.RegionID);
// if(!done.Contains(url)) // we may have older regs with same url lost in dbs
ScopeID = s.RegionInfo.ScopeID; done.Add(url);
regions.Remove(s.RegionInfo.RegionID);
} }
} }
} }
// Our own region should always be in the above list. if(regions.Count == 0)
// In a standalone this would not be true. But then, return;
// Scope ID is not relevat there. Use first scope.
//
if (ScopeID == UUID.Zero)
ScopeID = m_EstateModule.Scenes[0].RegionInfo.ScopeID;
// Don't send to the same instance twice Scene baseScene = m_EstateModule.Scenes[0];
// UUID ScopeID = baseScene.RegionInfo.ScopeID;
List<string> done = new List<string>(); IGridService gridService = baseScene.GridService;
if(gridService == null)
return;
// Send to remote regions // Send to remote regions
//
foreach (UUID regionID in regions) foreach (UUID regionID in regions)
{ {
GridRegion region = m_EstateModule.Scenes[0].GridService.GetRegionByUUID(ScopeID, regionID); GridRegion region = gridService.GetRegionByUUID(ScopeID, regionID);
if (region != null) if (region != null)
{ {
string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; string url = region.ExternalHostName + ":" + region.HttpPort;
if(done.Contains(url)) if(done.Contains(url))
continue; continue;
Call(region, sendData); Call(region, sendData);
done.Add(url); done.Add(url);
} }
@ -185,7 +188,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
// m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString); // m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString);
try try
{ {
string url = "http://" + region.ExternalHostName + ":" + region.HttpPort; string url = "";
if(string.IsNullOrEmpty(region.ServerURI))
url = "http://" + region.ExternalHostName + ":" + region.HttpPort;
else
url = region.ServerURI;
string reply = SynchronousRestFormsRequester.MakeRequest("POST", string reply = SynchronousRestFormsRequester.MakeRequest("POST",
url + "/estate", url + "/estate",
reqString); reqString);

View File

@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected List<Scene> m_Scenes = new List<Scene>(); protected List<Scene> m_Scenes = new List<Scene>();
protected bool m_InInfoUpdate = false; protected bool m_InInfoUpdate = false;
private string token = "7db8eh2gvgg45jj";
public bool InInfoUpdate public bool InInfoUpdate
{ {
@ -69,17 +70,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
int port = 0; int port = 0;
IConfig estateConfig = config.Configs["Estate"]; IConfig estateConfig = config.Configs["Estates"];
if (estateConfig != null) if (estateConfig != null)
{ {
port = estateConfig.GetInt("Port", 0); port = estateConfig.GetInt("Port", 0);
// this will need to came from somewhere else
token = estateConfig.GetString("Token", token);
} }
m_EstateConnector = new EstateConnector(this); m_EstateConnector = new EstateConnector(this, token);
// Instantiate the request handler // Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)port); IHttpServer server = MainServer.GetHttpServer((uint)port);
server.AddStreamHandler(new EstateRequestHandler(this)); server.AddStreamHandler(new EstateRequestHandler(this, token));
} }
public void PostInitialise() public void PostInitialise()
@ -94,8 +97,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
lock (m_Scenes) lock (m_Scenes)
m_Scenes.Add(scene); m_Scenes.Add(scene);
scene.EventManager.OnNewClient += OnNewClient;
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
@ -105,12 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
em.OnRegionInfoChange += OnRegionInfoChange; em.OnRegionInfoChange += OnRegionInfoChange;
em.OnEstateInfoChange += OnEstateInfoChange; em.OnEstateInfoChange += OnEstateInfoChange;
em.OnEstateMessage += OnEstateMessage; em.OnEstateMessage += OnEstateMessage;
em.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
em.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
scene.EventManager.OnNewClient -= OnNewClient;
lock (m_Scenes) lock (m_Scenes)
m_Scenes.Remove(scene); m_Scenes.Remove(scene);
} }
@ -181,13 +182,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message); m_EstateConnector.SendEstateMessage(estateID, FromID, FromName, Message);
} }
private void OnNewClient(IClientAPI client)
{
client.OnEstateTeleportOneUserHomeRequest += OnEstateTeleportOneUserHomeRequest;
client.OnEstateTeleportAllUsersHomeRequest += OnEstateTeleportAllUsersHomeRequest;
}
private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey) private void OnEstateTeleportOneUserHomeRequest(IClientAPI client, UUID invoice, UUID senderID, UUID prey)
{ {
if (prey == UUID.Zero) if (prey == UUID.Zero)
@ -205,17 +199,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
foreach (Scene s in Scenes) foreach (Scene s in Scenes)
{ {
if (s == scene)
continue; // Already handles by estate module
if (s.RegionInfo.EstateSettings.EstateID != estateID) if (s.RegionInfo.EstateSettings.EstateID != estateID)
continue; continue;
ScenePresence p = scene.GetScenePresence(prey); ScenePresence p = scene.GetScenePresence(prey);
if (p != null && !p.IsChildAgent ) if (p != null && !p.IsChildAgent )
{
if(!p.IsDeleted && !p.IsInTransit)
{ {
p.ControllingClient.SendTeleportStart(16); p.ControllingClient.SendTeleportStart(16);
scene.TeleportClientHome(prey, p.ControllingClient); scene.TeleportClientHome(prey, p.ControllingClient);
} }
return;
}
} }
m_EstateConnector.SendTeleportHomeOneUser(estateID, prey); m_EstateConnector.SendTeleportHomeOneUser(estateID, prey);
@ -235,8 +231,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
foreach (Scene s in Scenes) foreach (Scene s in Scenes)
{ {
if (s == scene)
continue; // Already handles by estate module
if (s.RegionInfo.EstateSettings.EstateID != estateID) if (s.RegionInfo.EstateSettings.EstateID != estateID)
continue; continue;

View File

@ -48,11 +48,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected XEstateModule m_EstateModule; protected XEstateModule m_EstateModule;
protected Object m_RequestLock = new Object(); protected Object m_RequestLock = new Object();
private string token;
public EstateRequestHandler(XEstateModule fmodule) public EstateRequestHandler(XEstateModule fmodule, string _token)
: base("POST", "/estate") : base("POST", "/estate")
{ {
m_EstateModule = fmodule; m_EstateModule = fmodule;
token = _token;
} }
protected override byte[] ProcessRequest(string path, Stream requestData, protected override byte[] ProcessRequest(string path, Stream requestData,
@ -75,6 +77,15 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (!request.ContainsKey("METHOD")) if (!request.ContainsKey("METHOD"))
return FailureResult(); return FailureResult();
if (!request.ContainsKey("TOKEN"))
return FailureResult();
string reqToken = request["TOKEN"].ToString();
request.Remove("TOKEN");
if(token != reqToken)
return FailureResult();
string method = request["METHOD"].ToString(); string method = request["METHOD"].ToString();
request.Remove("METHOD"); request.Remove("METHOD");

View File

@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces
event ChangeDelegate OnRegionInfoChange; event ChangeDelegate OnRegionInfoChange;
event ChangeDelegate OnEstateInfoChange; event ChangeDelegate OnEstateInfoChange;
event MessageDelegate OnEstateMessage; event MessageDelegate OnEstateMessage;
event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
uint GetRegionFlags(); uint GetRegionFlags();
bool IsManager(UUID avatarID); bool IsManager(UUID avatarID);