diff options
author | UbitUmarov | 2017-05-11 23:14:02 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-11 23:14:02 +0100 |
commit | 1b7aee89d3422aec0b3a74d6695f7cfa859a7f9c (patch) | |
tree | f45b3465211e3c8b4052c8001918160cbd4dbecd /OpenSim/Services | |
parent | merge (diff) | |
parent | remove a coment added by mistake (diff) | |
download | opensim-SC-1b7aee89d3422aec0b3a74d6695f7cfa859a7f9c.zip opensim-SC-1b7aee89d3422aec0b3a74d6695f7cfa859a7f9c.tar.gz opensim-SC-1b7aee89d3422aec0b3a74d6695f7cfa859a7f9c.tar.bz2 opensim-SC-1b7aee89d3422aec0b3a74d6695f7cfa859a7f9c.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Services')
5 files changed, 249 insertions, 79 deletions
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index b80700f..9bf3cf8 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -35,8 +35,8 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
36 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 36 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
37 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
38 | using OpenSim.Services.Connectors.InstantMessage; | ||
38 | using OpenSim.Services.Connectors.Hypergrid; | 39 | using OpenSim.Services.Connectors.Hypergrid; |
39 | |||
40 | using OpenMetaverse; | 40 | using OpenMetaverse; |
41 | 41 | ||
42 | using Nini.Config; | 42 | using Nini.Config; |
@@ -71,6 +71,7 @@ namespace OpenSim.Services.HypergridService | |||
71 | private static string m_ExternalName; | 71 | private static string m_ExternalName; |
72 | private static Uri m_Uri; | 72 | private static Uri m_Uri; |
73 | private static GridRegion m_DefaultGatewayRegion; | 73 | private static GridRegion m_DefaultGatewayRegion; |
74 | private bool m_allowDuplicatePresences = false; | ||
74 | 75 | ||
75 | public GatekeeperService(IConfigSource config, ISimulationService simService) | 76 | public GatekeeperService(IConfigSource config, ISimulationService simService) |
76 | { | 77 | { |
@@ -144,6 +145,12 @@ namespace OpenSim.Services.HypergridService | |||
144 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) | 145 | if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) |
145 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); | 146 | throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); |
146 | 147 | ||
148 | IConfig presenceConfig = config.Configs["PresenceService"]; | ||
149 | if (presenceConfig != null) | ||
150 | { | ||
151 | m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); | ||
152 | } | ||
153 | |||
147 | m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); | 154 | m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); |
148 | } | 155 | } |
149 | } | 156 | } |
@@ -369,6 +376,36 @@ namespace OpenSim.Services.HypergridService | |||
369 | return false; | 376 | return false; |
370 | } | 377 | } |
371 | 378 | ||
379 | if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e")) | ||
380 | { | ||
381 | // really? | ||
382 | reason = "Invalid account ID"; | ||
383 | return false; | ||
384 | } | ||
385 | |||
386 | if(m_GridUserService != null) | ||
387 | { | ||
388 | string PrincipalIDstr = account.PrincipalID.ToString(); | ||
389 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr); | ||
390 | |||
391 | if(!m_allowDuplicatePresences) | ||
392 | { | ||
393 | if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) | ||
394 | { | ||
395 | if(SendAgentGodKillToRegion(UUID.Zero, account.PrincipalID, guinfo)) | ||
396 | { | ||
397 | m_log.InfoFormat( | ||
398 | "[GATEKEEPER SERVICE]: Login failed for {0} {1}, reason: already logged in", | ||
399 | account.FirstName, account.LastName); | ||
400 | reason = "You appear to be already logged in on destiny grid " + | ||
401 | "Please wait a a minute or two and retry. " + | ||
402 | "If this takes longer than a few minutes please contact the grid owner. "; | ||
403 | return false; | ||
404 | } | ||
405 | } | ||
406 | } | ||
407 | } | ||
408 | |||
372 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); | 409 | m_log.DebugFormat("[GATEKEEPER SERVICE]: User {0} is ok", aCircuit.Name); |
373 | 410 | ||
374 | bool isFirstLogin = false; | 411 | bool isFirstLogin = false; |
@@ -389,26 +426,6 @@ namespace OpenSim.Services.HypergridService | |||
389 | return false; | 426 | return false; |
390 | } | 427 | } |
391 | 428 | ||
392 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); | ||
393 | |||
394 | // Also login foreigners with GridUser service | ||
395 | if (m_GridUserService != null && account == null) | ||
396 | { | ||
397 | string userId = aCircuit.AgentID.ToString(); | ||
398 | string first = aCircuit.firstname, last = aCircuit.lastname; | ||
399 | if (last.StartsWith("@")) | ||
400 | { | ||
401 | string[] parts = aCircuit.firstname.Split('.'); | ||
402 | if (parts.Length >= 2) | ||
403 | { | ||
404 | first = parts[0]; | ||
405 | last = parts[1]; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; | ||
410 | m_GridUserService.LoggedIn(userId); | ||
411 | } | ||
412 | } | 429 | } |
413 | 430 | ||
414 | // | 431 | // |
@@ -465,7 +482,33 @@ namespace OpenSim.Services.HypergridService | |||
465 | true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) | 482 | true, aCircuit.startpos, new List<UUID>(), ctx, out reason)) |
466 | return false; | 483 | return false; |
467 | 484 | ||
468 | return m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason); | 485 | bool didit = m_SimulationService.CreateAgent(source, destination, aCircuit, (uint)loginFlag, ctx, out reason); |
486 | |||
487 | if(didit) | ||
488 | { | ||
489 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Login presence {0} is ok", aCircuit.Name); | ||
490 | |||
491 | if(!isFirstLogin && m_GridUserService != null && account == null) | ||
492 | { | ||
493 | // Also login foreigners with GridUser service | ||
494 | string userId = aCircuit.AgentID.ToString(); | ||
495 | string first = aCircuit.firstname, last = aCircuit.lastname; | ||
496 | if (last.StartsWith("@")) | ||
497 | { | ||
498 | string[] parts = aCircuit.firstname.Split('.'); | ||
499 | if (parts.Length >= 2) | ||
500 | { | ||
501 | first = parts[0]; | ||
502 | last = parts[1]; | ||
503 | } | ||
504 | } | ||
505 | |||
506 | userId += ";" + aCircuit.ServiceURLs["HomeURI"] + ";" + first + " " + last; | ||
507 | m_GridUserService.LoggedIn(userId); | ||
508 | } | ||
509 | } | ||
510 | |||
511 | return didit; | ||
469 | } | 512 | } |
470 | 513 | ||
471 | protected bool Authenticate(AgentCircuitData aCircuit) | 514 | protected bool Authenticate(AgentCircuitData aCircuit) |
@@ -563,6 +606,40 @@ namespace OpenSim.Services.HypergridService | |||
563 | return exception; | 606 | return exception; |
564 | } | 607 | } |
565 | 608 | ||
609 | private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo) | ||
610 | { | ||
611 | UUID regionID = guinfo.LastRegionID; | ||
612 | GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
613 | if(regInfo == null) | ||
614 | return false; | ||
615 | |||
616 | string regURL = regInfo.ServerURI; | ||
617 | if(String.IsNullOrEmpty(regURL)) | ||
618 | return false; | ||
619 | |||
620 | UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e"); | ||
621 | |||
622 | GridInstantMessage msg = new GridInstantMessage(); | ||
623 | msg.imSessionID = UUID.Zero.Guid; | ||
624 | msg.fromAgentID = guuid.Guid; | ||
625 | msg.toAgentID = agentID.Guid; | ||
626 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
627 | msg.fromAgentName = "GRID"; | ||
628 | msg.message = string.Format("New login detected"); | ||
629 | msg.dialog = 250; // God kick | ||
630 | msg.fromGroup = false; | ||
631 | msg.offline = (byte)0; | ||
632 | msg.ParentEstateID = 0; | ||
633 | msg.Position = Vector3.Zero; | ||
634 | msg.RegionID = scopeID.Guid; | ||
635 | msg.binaryBucket = new byte[1] {0}; | ||
636 | InstantMessageServiceConnector.SendInstantMessage(regURL,msg); | ||
637 | |||
638 | m_GridUserService.LoggedOut(agentID.ToString(), | ||
639 | UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt); | ||
640 | |||
641 | return true; | ||
642 | } | ||
566 | #endregion | 643 | #endregion |
567 | } | 644 | } |
568 | } | 645 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index ba3cb2f..6f2cdd5 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -254,7 +254,6 @@ namespace OpenSim.Services.HypergridService | |||
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | |||
258 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination | 257 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination |
259 | GridRegion region = new GridRegion(gatekeeper); | 258 | GridRegion region = new GridRegion(gatekeeper); |
260 | region.ServerURI = gatekeeper.ServerURI; | 259 | region.ServerURI = gatekeeper.ServerURI; |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 32e14a1..823fd36 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -82,9 +82,8 @@ namespace OpenSim.Services.LLLoginService | |||
82 | "false"); | 82 | "false"); |
83 | AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", | 83 | AlreadyLoggedInProblem = new LLFailedLoginResponse("presence", |
84 | "You appear to be already logged in. " + | 84 | "You appear to be already logged in. " + |
85 | "If this is not the case please wait for your session to timeout. " + | 85 | "Please wait a a minute or two and retry. " + |
86 | "If this takes longer than a few minutes please contact the grid owner. " + | 86 | "If this takes longer than a few minutes please contact the grid owner. ", |
87 | "Please wait 5 minutes if you are going to connect to a region nearby to the region you were at previously.", | ||
88 | "false"); | 87 | "false"); |
89 | InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false"); | 88 | InternalError = new LLFailedLoginResponse("Internal Error", "Error generating Login Response", "false"); |
90 | } | 89 | } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index fc45f86..3ccdc9c 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -40,6 +40,7 @@ using OpenMetaverse; | |||
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
42 | using OpenSim.Server.Base; | 42 | using OpenSim.Server.Base; |
43 | using OpenSim.Services.Connectors.InstantMessage; | ||
43 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
44 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 45 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
45 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 46 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
@@ -89,6 +90,7 @@ namespace OpenSim.Services.LLLoginService | |||
89 | protected string m_DeniedClients; | 90 | protected string m_DeniedClients; |
90 | protected string m_MessageUrl; | 91 | protected string m_MessageUrl; |
91 | protected string m_DSTZone; | 92 | protected string m_DSTZone; |
93 | protected bool m_allowDuplicatePresences = false; | ||
92 | 94 | ||
93 | IConfig m_LoginServerConfig; | 95 | IConfig m_LoginServerConfig; |
94 | // IConfig m_ClientsConfig; | 96 | // IConfig m_ClientsConfig; |
@@ -140,6 +142,11 @@ namespace OpenSim.Services.LLLoginService | |||
140 | if (groupConfig != null) | 142 | if (groupConfig != null) |
141 | m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); | 143 | m_MaxAgentGroups = groupConfig.GetInt("MaxAgentGroups", 42); |
142 | 144 | ||
145 | IConfig presenceConfig = config.Configs["PresenceService"]; | ||
146 | if (presenceConfig != null) | ||
147 | { | ||
148 | m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); | ||
149 | } | ||
143 | 150 | ||
144 | // Clean up some of these vars | 151 | // Clean up some of these vars |
145 | if (m_MapTileURL != String.Empty) | 152 | if (m_MapTileURL != String.Empty) |
@@ -370,6 +377,29 @@ namespace OpenSim.Services.LLLoginService | |||
370 | return LLFailedLoginResponse.UserProblem; | 377 | return LLFailedLoginResponse.UserProblem; |
371 | } | 378 | } |
372 | 379 | ||
380 | if(account.PrincipalID == new UUID("6571e388-6218-4574-87db-f9379718315e")) | ||
381 | { | ||
382 | // really? | ||
383 | return LLFailedLoginResponse.UserProblem; | ||
384 | } | ||
385 | |||
386 | string PrincipalIDstr = account.PrincipalID.ToString(); | ||
387 | GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(PrincipalIDstr); | ||
388 | |||
389 | if(!m_allowDuplicatePresences) | ||
390 | { | ||
391 | if(guinfo != null && guinfo.Online && guinfo.LastRegionID != UUID.Zero) | ||
392 | { | ||
393 | if(SendAgentGodKillToRegion(scopeID, account.PrincipalID, guinfo)) | ||
394 | { | ||
395 | m_log.InfoFormat( | ||
396 | "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: already logged in", | ||
397 | firstName, lastName); | ||
398 | return LLFailedLoginResponse.AlreadyLoggedInProblem; | ||
399 | } | ||
400 | } | ||
401 | } | ||
402 | |||
373 | // | 403 | // |
374 | // Get the user's inventory | 404 | // Get the user's inventory |
375 | // | 405 | // |
@@ -406,7 +436,7 @@ namespace OpenSim.Services.LLLoginService | |||
406 | // | 436 | // |
407 | if (m_PresenceService != null) | 437 | if (m_PresenceService != null) |
408 | { | 438 | { |
409 | success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); | 439 | success = m_PresenceService.LoginAgent(PrincipalIDstr, session, secureSession); |
410 | 440 | ||
411 | if (!success) | 441 | if (!success) |
412 | { | 442 | { |
@@ -421,7 +451,6 @@ namespace OpenSim.Services.LLLoginService | |||
421 | // Change Online status and get the home region | 451 | // Change Online status and get the home region |
422 | // | 452 | // |
423 | GridRegion home = null; | 453 | GridRegion home = null; |
424 | GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); | ||
425 | 454 | ||
426 | // We are only going to complain about no home if the user actually tries to login there, to avoid | 455 | // We are only going to complain about no home if the user actually tries to login there, to avoid |
427 | // spamming the console. | 456 | // spamming the console. |
@@ -504,6 +533,10 @@ namespace OpenSim.Services.LLLoginService | |||
504 | return new LLFailedLoginResponse("key", reason, "false"); | 533 | return new LLFailedLoginResponse("key", reason, "false"); |
505 | 534 | ||
506 | } | 535 | } |
536 | |||
537 | // only now we can assume a login | ||
538 | guinfo = m_GridUserService.LoggedIn(PrincipalIDstr); | ||
539 | |||
507 | // Get Friends list | 540 | // Get Friends list |
508 | FriendInfo[] friendsList = new FriendInfo[0]; | 541 | FriendInfo[] friendsList = new FriendInfo[0]; |
509 | if (m_FriendsService != null) | 542 | if (m_FriendsService != null) |
@@ -832,6 +865,9 @@ namespace OpenSim.Services.LLLoginService | |||
832 | reason = string.Empty; | 865 | reason = string.Empty; |
833 | uint circuitCode = 0; | 866 | uint circuitCode = 0; |
834 | AgentCircuitData aCircuit = null; | 867 | AgentCircuitData aCircuit = null; |
868 | dest = null; | ||
869 | |||
870 | bool success = false; | ||
835 | 871 | ||
836 | if (m_UserAgentService == null) | 872 | if (m_UserAgentService == null) |
837 | { | 873 | { |
@@ -842,28 +878,14 @@ namespace OpenSim.Services.LLLoginService | |||
842 | simConnector = m_LocalSimulationService; | 878 | simConnector = m_LocalSimulationService; |
843 | else if (m_RemoteSimulationService != null) | 879 | else if (m_RemoteSimulationService != null) |
844 | simConnector = m_RemoteSimulationService; | 880 | simConnector = m_RemoteSimulationService; |
845 | } | ||
846 | else // User Agent Service is on | ||
847 | { | ||
848 | if (gatekeeper == null) // login to local grid | ||
849 | { | ||
850 | if (hostName == string.Empty) | ||
851 | SetHostAndPort(m_GatekeeperURL); | ||
852 | 881 | ||
853 | gatekeeper = new GridRegion(destination); | 882 | if(simConnector == null) |
854 | gatekeeper.ExternalHostName = hostName; | 883 | return null; |
855 | gatekeeper.HttpPort = (uint)port; | ||
856 | gatekeeper.ServerURI = m_GatekeeperURL; | ||
857 | } | ||
858 | m_log.Debug("[LLLOGIN SERVICE]: no gatekeeper detected..... using " + m_GatekeeperURL); | ||
859 | } | ||
860 | |||
861 | bool success = false; | ||
862 | 884 | ||
863 | if (m_UserAgentService == null && simConnector != null) | ||
864 | { | ||
865 | circuitCode = (uint)Util.RandomClass.Next(); ; | 885 | circuitCode = (uint)Util.RandomClass.Next(); ; |
866 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); | 886 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, |
887 | clientIP.Address.ToString(), viewer, channel, mac, id0); | ||
888 | |||
867 | success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason); | 889 | success = LaunchAgentDirectly(simConnector, destination, aCircuit, flags, out reason); |
868 | if (!success && m_GridService != null) | 890 | if (!success && m_GridService != null) |
869 | { | 891 | { |
@@ -885,10 +907,22 @@ namespace OpenSim.Services.LLLoginService | |||
885 | } | 907 | } |
886 | } | 908 | } |
887 | 909 | ||
888 | if (m_UserAgentService != null) | 910 | else |
889 | { | 911 | { |
912 | if (gatekeeper == null) // login to local grid | ||
913 | { | ||
914 | if (hostName == string.Empty) | ||
915 | SetHostAndPort(m_GatekeeperURL); | ||
916 | |||
917 | gatekeeper = new GridRegion(destination); | ||
918 | gatekeeper.ExternalHostName = hostName; | ||
919 | gatekeeper.HttpPort = (uint)port; | ||
920 | gatekeeper.ServerURI = m_GatekeeperURL; | ||
921 | } | ||
890 | circuitCode = (uint)Util.RandomClass.Next(); ; | 922 | circuitCode = (uint)Util.RandomClass.Next(); ; |
891 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); | 923 | aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, |
924 | clientIP.Address.ToString(), viewer, channel, mac, id0); | ||
925 | |||
892 | aCircuit.teleportFlags |= (uint)flags; | 926 | aCircuit.teleportFlags |= (uint)flags; |
893 | success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); | 927 | success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); |
894 | if (!success && m_GridService != null) | 928 | if (!success && m_GridService != null) |
@@ -1080,6 +1114,41 @@ namespace OpenSim.Services.LLLoginService | |||
1080 | break; | 1114 | break; |
1081 | } | 1115 | } |
1082 | } | 1116 | } |
1117 | |||
1118 | private bool SendAgentGodKillToRegion(UUID scopeID, UUID agentID , GridUserInfo guinfo) | ||
1119 | { | ||
1120 | UUID regionID = guinfo.LastRegionID; | ||
1121 | GridRegion regInfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
1122 | if(regInfo == null) | ||
1123 | return false; | ||
1124 | |||
1125 | string regURL = regInfo.ServerURI; | ||
1126 | if(String.IsNullOrEmpty(regURL)) | ||
1127 | return false; | ||
1128 | |||
1129 | UUID guuid = new UUID("6571e388-6218-4574-87db-f9379718315e"); | ||
1130 | |||
1131 | GridInstantMessage msg = new GridInstantMessage(); | ||
1132 | msg.imSessionID = UUID.Zero.Guid; | ||
1133 | msg.fromAgentID = guuid.Guid; | ||
1134 | msg.toAgentID = agentID.Guid; | ||
1135 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
1136 | msg.fromAgentName = "GRID"; | ||
1137 | msg.message = string.Format("New login detected"); | ||
1138 | msg.dialog = 250; // God kick | ||
1139 | msg.fromGroup = false; | ||
1140 | msg.offline = (byte)0; | ||
1141 | msg.ParentEstateID = 0; | ||
1142 | msg.Position = Vector3.Zero; | ||
1143 | msg.RegionID = scopeID.Guid; | ||
1144 | msg.binaryBucket = new byte[1] {0}; | ||
1145 | InstantMessageServiceConnector.SendInstantMessage(regURL,msg); | ||
1146 | |||
1147 | m_GridUserService.LoggedOut(agentID.ToString(), | ||
1148 | UUID.Zero, guinfo.LastRegionID, guinfo.LastPosition, guinfo.LastLookAt); | ||
1149 | |||
1150 | return true; | ||
1151 | } | ||
1083 | } | 1152 | } |
1084 | 1153 | ||
1085 | #endregion | 1154 | #endregion |
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index a22754f..48929ee 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -43,6 +43,7 @@ namespace OpenSim.Services.UserAccountService | |||
43 | public class UserAccountService : UserAccountServiceBase, IUserAccountService | 43 | public class UserAccountService : UserAccountServiceBase, IUserAccountService |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | private static readonly UUID UUID_GRID_GOD = new UUID("6571e388-6218-4574-87db-f9379718315e"); | ||
46 | private static UserAccountService m_RootInstance; | 47 | private static UserAccountService m_RootInstance; |
47 | 48 | ||
48 | /// <summary> | 49 | /// <summary> |
@@ -85,38 +86,63 @@ namespace OpenSim.Services.UserAccountService | |||
85 | 86 | ||
86 | m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false); | 87 | m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false); |
87 | 88 | ||
88 | // In case there are several instances of this class in the same process, | 89 | // create a system grid god account |
89 | // the console commands are only registered for the root instance | 90 | UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD); |
90 | if (m_RootInstance == null && MainConsole.Instance != null) | 91 | if(ggod == null) |
92 | { | ||
93 | UserAccountData d = new UserAccountData(); | ||
94 | |||
95 | d.FirstName = "GRID"; | ||
96 | d.LastName = "SERVICES"; | ||
97 | d.PrincipalID = UUID_GRID_GOD; | ||
98 | d.ScopeID = UUID.Zero; | ||
99 | d.Data = new Dictionary<string, string>(); | ||
100 | d.Data["Email"] = string.Empty; | ||
101 | d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString(); | ||
102 | d.Data["UserLevel"] = "240"; | ||
103 | d.Data["UserFlags"] = "0"; | ||
104 | d.Data["ServiceURLs"] = string.Empty; | ||
105 | |||
106 | m_Database.Store(d); | ||
107 | } | ||
108 | |||
109 | if (m_RootInstance == null) | ||
91 | { | 110 | { |
92 | m_RootInstance = this; | 111 | m_RootInstance = this; |
93 | MainConsole.Instance.Commands.AddCommand("Users", false, | 112 | |
94 | "create user", | 113 | // In case there are several instances of this class in the same process, |
95 | "create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]", | 114 | // the console commands are only registered for the root instance |
96 | "Create a new user", HandleCreateUser); | 115 | if (MainConsole.Instance != null) |
97 | 116 | { | |
98 | MainConsole.Instance.Commands.AddCommand("Users", false, | 117 | |
99 | "reset user password", | 118 | MainConsole.Instance.Commands.AddCommand("Users", false, |
100 | "reset user password [<first> [<last> [<password>]]]", | 119 | "create user", |
101 | "Reset a user password", HandleResetUserPassword); | 120 | "create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]", |
102 | 121 | "Create a new user", HandleCreateUser); | |
103 | MainConsole.Instance.Commands.AddCommand("Users", false, | 122 | |
104 | "reset user email", | 123 | MainConsole.Instance.Commands.AddCommand("Users", false, |
105 | "reset user email [<first> [<last> [<email>]]]", | 124 | "reset user password", |
106 | "Reset a user email address", HandleResetUserEmail); | 125 | "reset user password [<first> [<last> [<password>]]]", |
107 | 126 | "Reset a user password", HandleResetUserPassword); | |
108 | MainConsole.Instance.Commands.AddCommand("Users", false, | 127 | |
109 | "set user level", | 128 | MainConsole.Instance.Commands.AddCommand("Users", false, |
110 | "set user level [<first> [<last> [<level>]]]", | 129 | "reset user email", |
111 | "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " | 130 | "reset user email [<first> [<last> [<email>]]]", |
112 | + "this account will be treated as god-moded. " | 131 | "Reset a user email address", HandleResetUserEmail); |
113 | + "It will also affect the 'login level' command. ", | 132 | |
114 | HandleSetUserLevel); | 133 | MainConsole.Instance.Commands.AddCommand("Users", false, |
115 | 134 | "set user level", | |
116 | MainConsole.Instance.Commands.AddCommand("Users", false, | 135 | "set user level [<first> [<last> [<level>]]]", |
117 | "show account", | 136 | "Set user level. If >= 200 and 'allow_grid_gods = true' in OpenSim.ini, " |
118 | "show account <first> <last>", | 137 | + "this account will be treated as god-moded. " |
119 | "Show account details for the given user", HandleShowAccount); | 138 | + "It will also affect the 'login level' command. ", |
139 | HandleSetUserLevel); | ||
140 | |||
141 | MainConsole.Instance.Commands.AddCommand("Users", false, | ||
142 | "show account", | ||
143 | "show account <first> <last>", | ||
144 | "Show account details for the given user", HandleShowAccount); | ||
145 | } | ||
120 | } | 146 | } |
121 | } | 147 | } |
122 | 148 | ||