aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs131
1 files changed, 126 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5f1497a..eee288a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -338,6 +338,9 @@ namespace OpenSim.Region.Framework.Scenes
338 protected ICapabilitiesModule m_capsModule; 338 protected ICapabilitiesModule m_capsModule;
339 protected IGroupsModule m_groupsModule; 339 protected IGroupsModule m_groupsModule;
340 340
341 // The lists of groups to automatically add to logging in users.
342 private Dictionary<string, string[]> m_AutoGroups;
343
341 private Dictionary<string, string> m_extraSettings; 344 private Dictionary<string, string> m_extraSettings;
342 345
343 /// <summary> 346 /// <summary>
@@ -1156,6 +1159,50 @@ namespace OpenSim.Region.Framework.Scenes
1156 1159
1157 #endregion Interest Management 1160 #endregion Interest Management
1158 1161
1162 #region Group
1163
1164 IConfig groupsConfig = m_config.Configs["Groups"];
1165 m_AutoGroups = new Dictionary<string, string[]>();
1166 if (groupsConfig != null)
1167 {
1168 string groups = groupsConfig.GetString("AddDefaultGroup", string.Empty);
1169 if (groups.Length > 0)
1170 {
1171 try
1172 {
1173 m_AutoGroups.Add("local", groups.Split('|'));
1174 }
1175 catch (ArgumentException)
1176 {
1177 m_log.Warn("[SCENE]: Duplicated AddDefaultGroup option.");
1178 }
1179 }
1180 string[] keys = groupsConfig.GetKeys();
1181 if (0 < keys.Length)
1182 {
1183 foreach (string k in keys)
1184 {
1185 if (k.StartsWith("AddHGDefaultGroup_"))
1186 {
1187 groups = groupsConfig.GetString(k, string.Empty);
1188 if (groups.Length > 0)
1189 {
1190 try
1191 {
1192 m_AutoGroups.Add(k.Substring(18), groups.Split('|'));
1193 }
1194 catch (ArgumentException)
1195 {
1196 m_log.WarnFormat("[SCENE]: Duplicated {0} option.", k);
1197 }
1198 }
1199 }
1200 }
1201 }
1202 }
1203
1204 #endregion Group
1205
1159 StatsReporter = new SimStatsReporter(this); 1206 StatsReporter = new SimStatsReporter(this);
1160 1207
1161 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1208 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
@@ -4333,6 +4380,7 @@ namespace OpenSim.Region.Framework.Scenes
4333 protected virtual bool AuthorizeUser(AgentCircuitData agent, bool bypassAccessControl, out string reason) 4380 protected virtual bool AuthorizeUser(AgentCircuitData agent, bool bypassAccessControl, out string reason)
4334 { 4381 {
4335 reason = String.Empty; 4382 reason = String.Empty;
4383 bool isLocal = false;
4336 4384
4337 if (!m_strictAccessControl) 4385 if (!m_strictAccessControl)
4338 return true; 4386 return true;
@@ -4342,7 +4390,7 @@ namespace OpenSim.Region.Framework.Scenes
4342 if (AuthorizationService != null) 4390 if (AuthorizationService != null)
4343 { 4391 {
4344 if (!AuthorizationService.IsAuthorizedForRegion( 4392 if (!AuthorizationService.IsAuthorizedForRegion(
4345 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason)) 4393 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason, out isLocal))
4346 { 4394 {
4347 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}", 4395 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because: {4}",
4348 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason); 4396 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName, reason);
@@ -4375,6 +4423,79 @@ namespace OpenSim.Region.Framework.Scenes
4375 return false; 4423 return false;
4376 } 4424 }
4377 4425
4426 List<UUID> agentGroups = new List<UUID>();
4427 GroupMembershipData[] GroupMembership = null;
4428 if(m_groupsModule != null)
4429 GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
4430
4431 if (null != GroupMembership)
4432 {
4433 for(int i = 0;i < GroupMembership.Length;i++)
4434 agentGroups.Add(GroupMembership[i].GroupID);
4435 // We get called twice, the first time the name is set to a single space.
4436 // The first time is from QueryAccess(), the second from NewUserConnection()
4437// if (" " != agent.Name)
4438 {
4439 string grid = "";
4440 if (isLocal)
4441 {
4442 grid = "local";
4443 m_log.InfoFormat("[CONNECTION BEGIN]: LOCAL agent {0} {1} {2} {3}, checking auto groups.", agent.firstname, agent.lastname, agent.Name, agent.AgentID);
4444 }
4445 else
4446 {
4447 // agent.AgentID could look like this - @grid.com:8002 01234567-89ab-cdef-0123-456789abcdef
4448 // Or agent.lastname could.
4449 string a = agent.AgentID.ToString();
4450 if ("@" == a.Substring(0, 1))
4451 {
4452 grid = a.Split(':')[0].Substring(1);
4453 m_log.InfoFormat("[CONNECTION BEGIN]: HYPERGRID agent {0} from grid {1}, checking auto groups.", agent.AgentID, grid);
4454 }
4455 else
4456 {
4457 a = agent.lastname;
4458 if (String.Empty != a)
4459 {
4460 if ("@" == a.Substring(0, 1))
4461 {
4462 grid = a.Split(':')[0].Substring(1);
4463 m_log.InfoFormat("[CONNECTION BEGIN]: HYPERGRID agent {0} from grid {1}, checking auto groups.", agent.firstname, grid);
4464 }
4465 }
4466 }
4467 }
4468 string[] groupIDs = null;
4469 try
4470 {
4471 groupIDs = m_AutoGroups[grid];
4472 }
4473 catch (KeyNotFoundException)
4474 {
4475 // Do nothing.
4476 }
4477 if (null != groupIDs)
4478 {
4479 foreach(string name in groupIDs)
4480 {
4481 GroupRecord g = m_groupsModule.GetGroupRecord(name);
4482 if (null != g)
4483 {
4484 UUID group = g.GroupID;
4485 if(!agentGroups.Contains(group))
4486 {
4487 m_groupsModule.JoinGroup(agent.AgentID.ToString(), group);
4488 agentGroups.Add(group);
4489 m_log.InfoFormat("[CONNECTION BEGIN]: Automatically added {0} to group {1}.", agent.AgentID, name);
4490 }
4491 }
4492 else
4493 m_log.ErrorFormat("[CONNECTION BEGIN]: Bogus group {0}, not adding {1}.", name, agent.AgentID);
4494 }
4495 }
4496 }
4497 }
4498
4378 // public access 4499 // public access
4379 if (RegionInfo.EstateSettings.PublicAccess) 4500 if (RegionInfo.EstateSettings.PublicAccess)
4380 return true; 4501 return true;
@@ -4401,8 +4522,8 @@ namespace OpenSim.Region.Framework.Scenes
4401 if(estateGroups.Length == 0) 4522 if(estateGroups.Length == 0)
4402 goto Label_GroupsDone; 4523 goto Label_GroupsDone;
4403 4524
4404 List<UUID> agentGroups = new List<UUID>(); 4525//// List<UUID> agentGroups = new List<UUID>();
4405 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID); 4526//// GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(agent.AgentID);
4406 4527
4407 if(GroupMembership == null) 4528 if(GroupMembership == null)
4408 { 4529 {
@@ -4413,8 +4534,8 @@ namespace OpenSim.Region.Framework.Scenes
4413 if(GroupMembership.Length == 0) 4534 if(GroupMembership.Length == 0)
4414 goto Label_GroupsDone; 4535 goto Label_GroupsDone;
4415 4536
4416 for(int i = 0;i < GroupMembership.Length;i++) 4537//// for(int i = 0;i < GroupMembership.Length;i++)
4417 agentGroups.Add(GroupMembership[i].GroupID); 4538//// agentGroups.Add(GroupMembership[i].GroupID);
4418 4539
4419 foreach(UUID group in estateGroups) 4540 foreach(UUID group in estateGroups)
4420 { 4541 {