diff options
author | Diva Canto | 2010-01-10 19:50:09 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-10 19:50:09 -0800 |
commit | 2415d36bed4ccc2025c62f7e8e0a58fc3d76928a (patch) | |
tree | 652c51bc606590bbeb04b916992923387455612d /OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | |
parent | CommunicationsManager is practically empty. Only NetworkServersInfo is there. (diff) | |
download | opensim-SC_OLD-2415d36bed4ccc2025c62f7e8e0a58fc3d76928a.zip opensim-SC_OLD-2415d36bed4ccc2025c62f7e8e0a58fc3d76928a.tar.gz opensim-SC_OLD-2415d36bed4ccc2025c62f7e8e0a58fc3d76928a.tar.bz2 opensim-SC_OLD-2415d36bed4ccc2025c62f7e8e0a58fc3d76928a.tar.xz |
OpenSim.Region.Communications.* is no more. Thanks to everyone who contributed to these!
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1UserServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs deleted file mode 100644 index ed3526d..0000000 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text.RegularExpressions; | ||
34 | using System.Xml.Serialization; | ||
35 | using log4net; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Data; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Framework.Communications; | ||
41 | using OpenSim.Framework.Communications.Clients; | ||
42 | |||
43 | namespace OpenSim.Region.Communications.OGS1 | ||
44 | { | ||
45 | public class OGS1UserServices : UserManagerBase | ||
46 | { | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | public OGS1UserServices(CommunicationsManager commsManager) | ||
50 | : base(commsManager) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public override void ClearUserAgent(UUID avatarID) | ||
55 | { | ||
56 | // TODO: implement | ||
57 | // It may be possible to use the UserManagerBase implementation. | ||
58 | } | ||
59 | |||
60 | protected virtual string GetUserServerURL(UUID userID) | ||
61 | { | ||
62 | return m_commsManager.NetworkServersInfo.UserURL; | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Logs off a user on the user server | ||
67 | /// </summary> | ||
68 | /// <param name="UserID">UUID of the user</param> | ||
69 | /// <param name="regionID">UUID of the Region</param> | ||
70 | /// <param name="regionhandle">regionhandle</param> | ||
71 | /// <param name="position">final position</param> | ||
72 | /// <param name="lookat">final lookat</param> | ||
73 | public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) | ||
74 | { | ||
75 | Hashtable param = new Hashtable(); | ||
76 | param["avatar_uuid"] = userid.Guid.ToString(); | ||
77 | param["region_uuid"] = regionid.Guid.ToString(); | ||
78 | param["region_handle"] = regionhandle.ToString(); | ||
79 | param["region_pos_x"] = position.X.ToString(); | ||
80 | param["region_pos_y"] = position.Y.ToString(); | ||
81 | param["region_pos_z"] = position.Z.ToString(); | ||
82 | param["lookat_x"] = lookat.X.ToString(); | ||
83 | param["lookat_y"] = lookat.Y.ToString(); | ||
84 | param["lookat_z"] = lookat.Z.ToString(); | ||
85 | |||
86 | IList parameters = new ArrayList(); | ||
87 | parameters.Add(param); | ||
88 | XmlRpcRequest req = new XmlRpcRequest("logout_of_simulator", parameters); | ||
89 | |||
90 | try | ||
91 | { | ||
92 | req.Send(GetUserServerURL(userid), 3000); | ||
93 | } | ||
94 | catch (WebException) | ||
95 | { | ||
96 | m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff"); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | /// <summary> | ||
101 | /// Retrieve the user information for the given master uuid. | ||
102 | /// </summary> | ||
103 | /// <param name="uuid"></param> | ||
104 | /// <returns></returns> | ||
105 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | ||
106 | { | ||
107 | return SetupMasterUser(firstName, lastName, String.Empty); | ||
108 | } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Retrieve the user information for the given master uuid. | ||
112 | /// </summary> | ||
113 | /// <param name="uuid"></param> | ||
114 | /// <returns></returns> | ||
115 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
116 | { | ||
117 | UserProfileData profile = GetUserProfile(firstName, lastName); | ||
118 | return profile; | ||
119 | } | ||
120 | |||
121 | /// <summary> | ||
122 | /// Retrieve the user information for the given master uuid. | ||
123 | /// </summary> | ||
124 | /// <param name="uuid"></param> | ||
125 | /// <returns></returns> | ||
126 | public override UserProfileData SetupMasterUser(UUID uuid) | ||
127 | { | ||
128 | UserProfileData data = GetUserProfile(uuid); | ||
129 | |||
130 | if (data == null) | ||
131 | { | ||
132 | throw new Exception( | ||
133 | "Could not retrieve profile for master user " + uuid + ". User server did not respond to the request."); | ||
134 | } | ||
135 | |||
136 | return data; | ||
137 | } | ||
138 | |||
139 | public override bool VerifySession(UUID userID, UUID sessionID) | ||
140 | { | ||
141 | m_log.DebugFormat("[OGS1 USER SERVICES]: Verifying user session for " + userID); | ||
142 | return AuthClient.VerifySession(GetUserServerURL(userID), userID, sessionID); | ||
143 | } | ||
144 | |||
145 | public override bool AuthenticateUserByPassword(UUID userID, string password) | ||
146 | { | ||
147 | Hashtable param = new Hashtable(); | ||
148 | param["user_uuid"] = userID.ToString(); | ||
149 | param["password"] = password; | ||
150 | IList parameters = new ArrayList(); | ||
151 | parameters.Add(param); | ||
152 | XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters); | ||
153 | XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); | ||
154 | |||
155 | // Temporary measure to deal with older services | ||
156 | if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD) | ||
157 | { | ||
158 | throw new Exception( | ||
159 | String.Format( | ||
160 | "XMLRPC method 'authenticate_user_by_password' not yet implemented by user service at {0}", | ||
161 | m_commsManager.NetworkServersInfo.UserURL)); | ||
162 | } | ||
163 | |||
164 | Hashtable respData = (Hashtable)resp.Value; | ||
165 | |||
166 | if ((string)respData["auth_user"] == "TRUE") | ||
167 | { | ||
168 | return true; | ||
169 | } | ||
170 | else | ||
171 | { | ||
172 | return false; | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | } \ No newline at end of file | ||