aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Local
diff options
context:
space:
mode:
authorMW2007-08-13 15:55:36 +0000
committerMW2007-08-13 15:55:36 +0000
commit04b1767886af28fa1793c46a1cbe4b3f49eefca6 (patch)
treef7c1fc2fc19a5dce8e4e78537ff6a87c75a7dda2 /OpenSim/Region/Communications/Local
parentAdded the SetPartText access method to SceneObjectGroup to set the text of me... (diff)
downloadopensim-SC_OLD-04b1767886af28fa1793c46a1cbe4b3f49eefca6.zip
opensim-SC_OLD-04b1767886af28fa1793c46a1cbe4b3f49eefca6.tar.gz
opensim-SC_OLD-04b1767886af28fa1793c46a1cbe4b3f49eefca6.tar.bz2
opensim-SC_OLD-04b1767886af28fa1793c46a1cbe4b3f49eefca6.tar.xz
Separated Login Service from usermanager, which helps to clean up the code a bit and also should help to integrate the inventory server (when it is wrote/finished).
Diffstat (limited to 'OpenSim/Region/Communications/Local')
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs14
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs101
2 files changed, 10 insertions, 105 deletions
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index a0bbf6d..3ad33f4 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -37,23 +37,25 @@ namespace OpenSim.Region.Communications.Local
37{ 37{
38 public class CommunicationsLocal : CommunicationsManager 38 public class CommunicationsLocal : CommunicationsManager
39 { 39 {
40 public LocalBackEndServices SandBoxServices = new LocalBackEndServices(); 40 public LocalBackEndServices InstanceServices = new LocalBackEndServices();
41 public LocalUserServices UserServices; 41 public LocalUserServices UserServices;
42 public LocalLoginService LoginServices;
42 43
43 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage ) 44 public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool accountsAuthenticate, string welcomeMessage )
44 : base(serversInfo, httpServer, assetCache) 45 : base(serversInfo, httpServer, assetCache)
45 { 46 {
46 UserServices = new LocalUserServices(this, serversInfo, accountsAuthenticate, welcomeMessage); 47 UserServices = new LocalUserServices(this, serversInfo);
47 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll"); 48 UserServices.AddPlugin("OpenSim.Framework.Data.DB4o.dll");
48 UserServer = UserServices; 49 UserServer = UserServices;
49 GridServer = SandBoxServices; 50 GridServer = InstanceServices;
50 InterRegion = SandBoxServices; 51 InterRegion = InstanceServices;
51 httpServer.AddXmlRPCHandler("login_to_simulator", UserServices.XmlRpcLoginMethod); 52 LoginServices = new LocalLoginService(UserServices, welcomeMessage, this, serversInfo, accountsAuthenticate);
53 httpServer.AddXmlRPCHandler("login_to_simulator", LoginServices.XmlRpcLoginMethod);
52 } 54 }
53 55
54 internal void InformRegionOfLogin(ulong regionHandle, Login login) 56 internal void InformRegionOfLogin(ulong regionHandle, Login login)
55 { 57 {
56 this.SandBoxServices.AddNewSession(regionHandle, login); 58 this.InstanceServices.AddNewSession(regionHandle, login);
57 } 59 }
58 60
59 public void doCreate(string what) 61 public void doCreate(string what)
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index 63f8c21..65732bd 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -15,20 +15,14 @@ namespace OpenSim.Region.Communications.Local
15 private NetworkServersInfo serversInfo; 15 private NetworkServersInfo serversInfo;
16 private uint defaultHomeX ; 16 private uint defaultHomeX ;
17 private uint defaultHomeY; 17 private uint defaultHomeY;
18 private bool authUsers = false;
19 private string welcomeMessage = "Welcome to OpenSim";
20 18
21 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate, string welcomeMess) 19
20 public LocalUserServices(CommunicationsLocal parent, NetworkServersInfo serversInfo)
22 { 21 {
23 m_Parent = parent; 22 m_Parent = parent;
24 this.serversInfo = serversInfo; 23 this.serversInfo = serversInfo;
25 defaultHomeX = this.serversInfo.DefaultHomeLocX; 24 defaultHomeX = this.serversInfo.DefaultHomeLocX;
26 defaultHomeY = this.serversInfo.DefaultHomeLocY; 25 defaultHomeY = this.serversInfo.DefaultHomeLocY;
27 this.authUsers = authenticate;
28 if (welcomeMess != "")
29 {
30 this.welcomeMessage = welcomeMess;
31 }
32 } 26 }
33 27
34 public UserProfileData GetUserProfile(string firstName, string lastName) 28 public UserProfileData GetUserProfile(string firstName, string lastName)
@@ -46,97 +40,6 @@ namespace OpenSim.Region.Communications.Local
46 return this.getUserProfile(avatarID); 40 return this.getUserProfile(avatarID);
47 } 41 }
48 42
49 /// <summary>
50 ///
51 /// </summary>
52 /// <returns></returns>
53 public override string GetMessage()
54 {
55 return welcomeMessage;
56 }
57
58 public override UserProfileData GetTheUser(string firstname, string lastname)
59 {
60 UserProfileData profile = getUserProfile(firstname, lastname);
61 if (profile != null)
62 {
63
64 return profile;
65 }
66
67 if (!authUsers)
68 {
69 //no current user account so make one
70 Console.WriteLine("No User account found so creating a new one ");
71 this.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
72
73 profile = getUserProfile(firstname, lastname);
74
75 return profile;
76 }
77 return null;
78 }
79
80 public override bool AuthenticateUser(UserProfileData profile, string password)
81 {
82 if (!authUsers)
83 {
84 //for now we will accept any password in sandbox mode
85 Console.WriteLine("authorising user");
86 return true;
87 }
88 else
89 {
90 Console.WriteLine( "Authenticating " + profile.username + " " + profile.surname);
91
92 password = password.Remove(0, 3); //remove $1$
93
94 string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
95
96 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
97 }
98 }
99
100 public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
101 {
102 ulong currentRegion = theUser.currentAgent.currentHandle;
103 RegionInfo reg = m_Parent.GridServer.RequestNeighbourInfo(currentRegion);
104
105 if (reg != null)
106 {
107 response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
108 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
109 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
110 string capsPath = Util.GetRandomCapsPath();
111 response.SimAddress = reg.ExternalEndPoint.Address.ToString();
112 response.SimPort = (Int32)reg.ExternalEndPoint.Port;
113 response.RegionX = reg.RegionLocX ;
114 response.RegionY = reg.RegionLocY ;
115
116 //following port needs changing as we don't want a http listener for every region (or do we?)
117 response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
118 theUser.currentAgent.currentRegion = reg.SimUUID;
119 theUser.currentAgent.currentHandle = reg.RegionHandle;
120
121 Login _login = new Login();
122 //copy data to login object
123 _login.First = response.Firstname;
124 _login.Last = response.Lastname;
125 _login.Agent = response.AgentID;
126 _login.Session = response.SessionID;
127 _login.SecureSession = response.SecureSessionID;
128 _login.CircuitCode = (uint)response.CircuitCode;
129 _login.CapsPath = capsPath;
130
131 m_Parent.InformRegionOfLogin(currentRegion, _login);
132 }
133 else
134 {
135 Console.WriteLine("not found region " + currentRegion);
136 }
137
138 }
139
140 public UserProfileData SetupMasterUser(string firstName, string lastName) 43 public UserProfileData SetupMasterUser(string firstName, string lastName)
141 { 44 {
142 return SetupMasterUser(firstName, lastName, ""); 45 return SetupMasterUser(firstName, lastName, "");