From c4fe094ce0293f9438e51117490479be0130001a Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 1 Aug 2019 18:40:46 +1000 Subject: AddDefaultGroup and AddHGDefaultGroup_ config options added. --- OpenSim/Region/Framework/Scenes/Scene.cs | 81 +++++++++++++------------------- 1 file changed, 33 insertions(+), 48 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b0a7300..ba08aab 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4394,7 +4394,9 @@ namespace OpenSim.Region.Framework.Scenes } List agentGroups = new List(); - GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); + GroupMembershipData[] GroupMembership = null; + if(m_groupsModule != null) + GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); if (null != GroupMembership) { @@ -4403,59 +4405,42 @@ namespace OpenSim.Region.Framework.Scenes // We get called twice, the first time the name is set to a single space. // if (" " != agent.Name) { + string grid = "local"; + // agent.AgentID could look like this - @grid.com:8002 01234567-89ab-cdef-0123-456789abcdef + string a = agent.AgentID.ToString(); + if ("@" == a.Substring(0, 1)) + { + grid = a.Split(':')[0].Substring(1); + m_log.InfoFormat("[CONNECTION BEGIN]: HYPERGRID agent {0} from grid {1}, checking auto groups.", agent.AgentID, grid); + } + string[] groupIDs = null; try { - // Check for auto add groups here and add them if needed. - if (UserManagementModule.IsLocalGridUser(agent.AgentID)) - { - string[] groupIDs = m_AutoGroups["local"]; - foreach(string name in groupIDs) - { - GroupRecord g = m_groupsModule.GetGroupRecord(name); - if (null != g) - { - UUID group = g.GroupID; - if(!agentGroups.Contains(group)) - { - m_groupsModule.JoinGroup(agent.AgentID.ToString(), group); - agentGroups.Add(group); - m_log.InfoFormat("[CONNECTION BEGIN]: Automatically added {0} to group {1}.", agent.AgentID, name); - } - } - else - m_log.ErrorFormat("[CONNECTION BEGIN]: Bogus group {0}, not adding {1}.", name, agent.AgentID); - } - } - else - { - // agent.AgentID should look like this - @grid.com:8002 01234567-89ab-cdef-0123-456789abcdef - string grid = agent.AgentID.ToString().Split(':')[0]; - grid = grid.Substring(1); - m_log.InfoFormat("[CONNECTION BEGIN]: HYPERGRID agent {0} from grid {1}, checking auto groups.", agent.AgentID, grid); - string[] groupIDs = m_AutoGroups[grid]; - foreach(string name in groupIDs) - { - GroupRecord g = m_groupsModule.GetGroupRecord(name); - if (null != g) - { - UUID group = g.GroupID; - if(!agentGroups.Contains(group)) - { - m_groupsModule.JoinGroup(agent.AgentID.ToString(), group); - agentGroups.Add(group); - m_log.InfoFormat("[CONNECTION BEGIN]: Automatically added HYPERGRIDDER {0} @ {1} to group {2}.", agent.AgentID, grid, name); - } - } - else - m_log.ErrorFormat("[CONNECTION BEGIN]: Bogus group {0} for HYPERGRIDDERS, not adding {1}.", name, agent.AgentID); - } - } - } + groupIDs = m_AutoGroups[grid]; + } catch (KeyNotFoundException) { // Do nothing. } - + if (null != groupIDs) + { + foreach(string name in groupIDs) + { + GroupRecord g = m_groupsModule.GetGroupRecord(name); + if (null != g) + { + UUID group = g.GroupID; + if(!agentGroups.Contains(group)) + { + m_groupsModule.JoinGroup(agent.AgentID.ToString(), group); + agentGroups.Add(group); + m_log.InfoFormat("[CONNECTION BEGIN]: Automatically added {0} to group {1}.", agent.AgentID, name); + } + } + else + m_log.ErrorFormat("[CONNECTION BEGIN]: Bogus group {0}, not adding {1}.", name, agent.AgentID); + } + } } } -- cgit v1.1