Plumb a code path for the entity transfer module to ask a destination scene
whether or not an agent is allowed there as a root agent.viewer-2-initial-appearance
parent
796216e44f
commit
4df1d25d23
|
@ -257,6 +257,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QueryAccess(GridRegion destination, UUID id)
|
||||||
|
{
|
||||||
|
if (destination == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
foreach (Scene s in m_sceneList)
|
||||||
|
{
|
||||||
|
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
||||||
|
{
|
||||||
|
//m_log.Debug("[LOCAL COMMS]: Found region to send QueryAccess");
|
||||||
|
return s.QueryAccess(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_sceneList)
|
||||||
|
|
|
@ -239,6 +239,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QueryAccess(GridRegion destination, UUID id)
|
||||||
|
{
|
||||||
|
if (destination == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Try local first
|
||||||
|
if (m_localBackend.QueryAccess(destination, id))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// else do the remote thing
|
||||||
|
if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
|
||||||
|
return m_remoteConnector.QueryAccess(destination, id);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
||||||
{
|
{
|
||||||
// Try local first
|
// Try local first
|
||||||
|
|
|
@ -4953,5 +4953,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
DeleteSceneObject(grp, true);
|
DeleteSceneObject(grp, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is called across the simulation connector to
|
||||||
|
// determine if a given agent is allowed in this region
|
||||||
|
// AS A ROOT AGENT. Returning false here will prevent them
|
||||||
|
// from logging into the region, teleporting into the region
|
||||||
|
// or corssing the broder walking, but will NOT prevent
|
||||||
|
// child agent creation, thereby emulating the SL behavior.
|
||||||
|
public bool QueryAccess(UUID agentID)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,11 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
DoAgentDelete(request, responsedata, agentID, action, regionID);
|
DoAgentDelete(request, responsedata, agentID, action, regionID);
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
else if (method.Equals("QUERYACCESSS"))
|
||||||
|
{
|
||||||
|
DoQueryAccess(request, responsedata, agentID, regionID);
|
||||||
|
return responsedata;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
|
m_log.InfoFormat("[AGENT HANDLER]: method {0} not supported in agent message", method);
|
||||||
|
@ -300,6 +305,27 @@ namespace OpenSim.Server.Handlers.Simulation
|
||||||
return m_SimulationService.UpdateAgent(destination, agent);
|
return m_SimulationService.UpdateAgent(destination, agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
||||||
|
{
|
||||||
|
if (m_SimulationService == null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[AGENT HANDLER]: Agent QUERY called. Harmless but useless.");
|
||||||
|
responsedata["content_type"] = "application/json";
|
||||||
|
responsedata["int_response_code"] = HttpStatusCode.NotImplemented;
|
||||||
|
responsedata["str_response_string"] = string.Empty;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GridRegion destination = new GridRegion();
|
||||||
|
destination.RegionID = regionID;
|
||||||
|
|
||||||
|
bool result = m_SimulationService.QueryAccess(destination, id);
|
||||||
|
|
||||||
|
responsedata["int_response_code"] = HttpStatusCode.OK;
|
||||||
|
responsedata["str_response_string"] = result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
|
||||||
{
|
{
|
||||||
if (m_SimulationService == null)
|
if (m_SimulationService == null)
|
||||||
|
|
|
@ -409,6 +409,65 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QueryAccess(GridRegion destination, UUID id)
|
||||||
|
{
|
||||||
|
IPEndPoint ext = destination.ExternalEndPoint;
|
||||||
|
if (ext == null) return false;
|
||||||
|
// Eventually, we want to use a caps url instead of the agentID
|
||||||
|
string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
|
||||||
|
|
||||||
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
|
||||||
|
request.Method = "QUERYACCESS";
|
||||||
|
request.Timeout = 10000;
|
||||||
|
//request.Headers.Add("authorization", ""); // coming soon
|
||||||
|
|
||||||
|
HttpWebResponse webResponse = null;
|
||||||
|
string reply = string.Empty;
|
||||||
|
StreamReader sr = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
webResponse = (HttpWebResponse)request.GetResponse();
|
||||||
|
if (webResponse == null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent query ");
|
||||||
|
}
|
||||||
|
|
||||||
|
sr = new StreamReader(webResponse.GetResponseStream());
|
||||||
|
reply = sr.ReadToEnd().Trim();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent query {0}", ex.Message);
|
||||||
|
// ignore, really
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (sr != null)
|
||||||
|
sr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (webResponse.StatusCode == HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
|
||||||
|
result = bool.Parse(reply);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
||||||
{
|
{
|
||||||
WebRequest request = WebRequest.Create(uri);
|
WebRequest request = WebRequest.Create(uri);
|
||||||
|
|
|
@ -60,6 +60,8 @@ namespace OpenSim.Services.Interfaces
|
||||||
|
|
||||||
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
|
bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
|
||||||
|
|
||||||
|
bool QueryAccess(GridRegion destination, UUID id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Message from receiving region to departing region, telling it got contacted by the client.
|
/// Message from receiving region to departing region, telling it got contacted by the client.
|
||||||
/// When sent over REST, it invokes the opaque uri.
|
/// When sent over REST, it invokes the opaque uri.
|
||||||
|
|
Loading…
Reference in New Issue