updated the IAuthorizationService interface so that a message is passed back and can be displayed at the client when an avatar is denied access to a region
parent
8622f205d7
commit
281ad1251c
|
@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID)
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
|
||||
{
|
||||
return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID);
|
||||
return m_AuthorizationService.IsAuthorizedForRegion(userID, regionID, out message);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,11 +117,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID)
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
|
||||
{
|
||||
m_log.InfoFormat("[REMOTE AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} for region {1}", userID, regionID);
|
||||
|
||||
bool isAuthorized = true;
|
||||
message = String.Empty;
|
||||
|
||||
// get the scene this call is being made for
|
||||
Scene scene = null;
|
||||
|
@ -140,7 +141,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization
|
|||
{
|
||||
UserProfileData profile = scene.CommsManager.UserService.GetUserProfile(new UUID(userID));
|
||||
isAuthorized = IsAuthorizedForRegion(userID, profile.FirstName, profile.SurName,
|
||||
profile.Email, scene.RegionInfo.RegionName, regionID);
|
||||
profile.Email, scene.RegionInfo.RegionName, regionID, out message);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3253,10 +3253,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (AuthorizationService != null)
|
||||
{
|
||||
if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString()))
|
||||
if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason))
|
||||
{
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
//reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ namespace OpenSim.Server.Handlers.Authorization
|
|||
XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
|
||||
AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request);
|
||||
|
||||
bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.RegionID);
|
||||
string message = String.Empty;
|
||||
bool authorized = m_AuthorizationService.IsAuthorizedForRegion(Authorization.ID, Authorization.RegionID,out message);
|
||||
|
||||
AuthorizationResponse result = new AuthorizationResponse(authorized, Authorization.ID + " has been authorized");
|
||||
|
||||
|
|
|
@ -48,8 +48,9 @@ namespace OpenSim.Services.AuthorizationService
|
|||
m_log.Info("[AUTHORIZATION CONNECTOR]: Local Authorization service enabled");
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID)
|
||||
public bool IsAuthorizedForRegion(string userID, string regionID, out string message)
|
||||
{
|
||||
message = "Authorized";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors
|
|||
m_ResponseOnFailure = responseOnFailure;
|
||||
}
|
||||
|
||||
public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID)
|
||||
public bool IsAuthorizedForRegion(string userID, string firstname, string surname, string email, string regionName, string regionID, out string message)
|
||||
{
|
||||
// do a remote call to the authorization server specified in the AuthorizationServerURI
|
||||
m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI);
|
||||
|
@ -105,10 +105,12 @@ namespace OpenSim.Services.Connectors
|
|||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message);
|
||||
message="";
|
||||
return m_ResponseOnFailure;
|
||||
}
|
||||
|
||||
m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message);
|
||||
message = response.Message;
|
||||
|
||||
return response.IsAuthorized;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenSim.Services.Interfaces
|
|||
// This method returns a simple true false indicating
|
||||
// whether or not a user has access to the region
|
||||
//
|
||||
bool IsAuthorizedForRegion(string userID, string regionID);
|
||||
bool IsAuthorizedForRegion(string userID, string regionID, out string message);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue