From 515e62dc2f4614b140da222c082d3cd69c5960d4 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Mon, 27 Apr 2009 11:51:25 +0000 Subject: From: Alan M Webb Added support for access control lists. Scene: Added test to AddNewClient for an entry in the access list when connecting to a region with limited access. EstateSettings: Added an HasAccess(UUID) property to test for an entry in the estate's access list. RemoteAdmin: Add RPC calls for admin_acl_list, clear, add, and remove. --- OpenSim/Region/Framework/Scenes/Scene.cs | 82 +++++++++++++++++++------------- 1 file changed, 49 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 70713c4..c7d32cc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1846,11 +1846,25 @@ namespace OpenSim.Region.Framework.Scenes public override void AddNewClient(IClientAPI client) { - if (m_regInfo.EstateSettings.IsBanned(client.AgentId)) + bool welcome = true; + + if(m_regInfo.EstateSettings.IsBanned(client.AgentId)) { m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", client.AgentId, client.FirstName, client.LastName, RegionInfo.RegionName); client.SendAlertMessage("Denied access to region " + RegionInfo.RegionName + ". You have been banned from that region."); + welcome = false; + } + else if (!m_regInfo.EstateSettings.PublicAccess && !m_regInfo.EstateSettings.HasAccess(client.AgentId)) + { + m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access", + client.AgentId, client.FirstName, client.LastName, RegionInfo.RegionName); + client.SendAlertMessage("Denied access to private region " + RegionInfo.RegionName + ". You do not have access to this region."); + welcome = false; + } + + if(!welcome) + { try { IEventQueue eq = RequestModuleInterface(); @@ -1867,50 +1881,52 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.DebugFormat("[SCENE]: Exception while closing banned client {0} {1}: {2}", client.FirstName, client.LastName, e.Message); + m_log.DebugFormat("[SCENE]: Exception while closing unwelcome client {0} {1}: {2}", client.FirstName, client.LastName, e.Message); } } + else + { + SubscribeToClientEvents(client); + ScenePresence presence; - SubscribeToClientEvents(client); - ScenePresence presence; + if (m_restorePresences.ContainsKey(client.AgentId)) + { + m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); - if (m_restorePresences.ContainsKey(client.AgentId)) - { - m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); + presence = m_restorePresences[client.AgentId]; + m_restorePresences.Remove(client.AgentId); - presence = m_restorePresences[client.AgentId]; - m_restorePresences.Remove(client.AgentId); + // This is one of two paths to create avatars that are + // used. This tends to get called more in standalone + // than grid, not really sure why, but as such needs + // an explicity appearance lookup here. + AvatarAppearance appearance = null; + GetAvatarAppearance(client, out appearance); + presence.Appearance = appearance; - // This is one of two paths to create avatars that are - // used. This tends to get called more in standalone - // than grid, not really sure why, but as such needs - // an explicity appearance lookup here. - AvatarAppearance appearance = null; - GetAvatarAppearance(client, out appearance); - presence.Appearance = appearance; + presence.initializeScenePresence(client, RegionInfo, this); - presence.initializeScenePresence(client, RegionInfo, this); + m_sceneGraph.AddScenePresence(presence); - m_sceneGraph.AddScenePresence(presence); + lock (m_restorePresences) + { + Monitor.PulseAll(m_restorePresences); + } + } + else + { + m_log.DebugFormat( + "[SCENE]: Adding new child agent for {0} in {1}", + client.Name, RegionInfo.RegionName); - lock (m_restorePresences) - { - Monitor.PulseAll(m_restorePresences); - } - } - else - { - m_log.DebugFormat( - "[SCENE]: Adding new child agent for {0} in {1}", - client.Name, RegionInfo.RegionName); + CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); - CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); + CreateAndAddScenePresence(client); + } - CreateAndAddScenePresence(client); + m_LastLogin = Environment.TickCount; + EventManager.TriggerOnNewClient(client); } - - m_LastLogin = Environment.TickCount; - EventManager.TriggerOnNewClient(client); } protected virtual void SubscribeToClientEvents(IClientAPI client) -- cgit v1.1