aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-04-22 18:15:43 +0000
committerJustin Clarke Casey2009-04-22 18:15:43 +0000
commit2c81e41c8a884ece643f3079349b033d03b6b774 (patch)
treebea7956ef00378f47fa420e82ffb665a137a9630 /OpenSim/Framework/Communications
parentFrom: Alan Webb <alan_webb@us.ibm.com> (diff)
downloadopensim-SC-2c81e41c8a884ece643f3079349b033d03b6b774.zip
opensim-SC-2c81e41c8a884ece643f3079349b033d03b6b774.tar.gz
opensim-SC-2c81e41c8a884ece643f3079349b033d03b6b774.tar.bz2
opensim-SC-2c81e41c8a884ece643f3079349b033d03b6b774.tar.xz
* Fission OGS1UserServices into user service and OGS1 user data plugin components
* Make OGS1UserServices inherit from UserManagerBase * This allows grid mode regions to use the same user data plugin infrastructure as grid servers and standalone OpenSims
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/IAvatarService.cs12
-rw-r--r--OpenSim/Framework/Communications/Services/LoginService.cs13
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs108
3 files changed, 68 insertions, 65 deletions
diff --git a/OpenSim/Framework/Communications/IAvatarService.cs b/OpenSim/Framework/Communications/IAvatarService.cs
index 3822e9f..db583e1 100644
--- a/OpenSim/Framework/Communications/IAvatarService.cs
+++ b/OpenSim/Framework/Communications/IAvatarService.cs
@@ -31,10 +31,18 @@ namespace OpenSim.Framework.Communications
31{ 31{
32 public interface IAvatarService 32 public interface IAvatarService
33 { 33 {
34 /// Get's the User Appearance 34 /// <summary>
35 /// Get avatar appearance information
36 /// </summary>
37 /// <param name="user"></param>
38 /// <returns></returns>
35 AvatarAppearance GetUserAppearance(UUID user); 39 AvatarAppearance GetUserAppearance(UUID user);
36 40
41 /// <summary>
42 /// Update avatar appearance information
43 /// </summary>
44 /// <param name="user"></param>
45 /// <param name="appearance"></param>
37 void UpdateUserAppearance(UUID user, AvatarAppearance appearance); 46 void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
38
39 } 47 }
40} 48}
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs
index 72a4281..1b71367 100644
--- a/OpenSim/Framework/Communications/Services/LoginService.cs
+++ b/OpenSim/Framework/Communications/Services/LoginService.cs
@@ -1147,14 +1147,15 @@ namespace OpenSim.Framework.Communications.Services
1147 if (m_userManager.VerifySession(guess_aid, guess_sid)) 1147 if (m_userManager.VerifySession(guess_aid, guess_sid))
1148 { 1148 {
1149 authed = "TRUE"; 1149 authed = "TRUE";
1150 m_log.InfoFormat("[UserManager]: CheckAuthSession TRUE for user {0}", guess_aid);
1151 }
1152 else
1153 {
1154 m_log.InfoFormat("[UserManager]: CheckAuthSession FALSE");
1155 return Util.CreateUnknownUserErrorResponse();
1150 } 1156 }
1151 m_log.InfoFormat("[UserManager]: CheckAuthSession TRUE for user {0}", guess_aid);
1152 }
1153 else
1154 {
1155 m_log.InfoFormat("[UserManager]: CheckAuthSession FALSE");
1156 return Util.CreateUnknownUserErrorResponse();
1157 } 1157 }
1158
1158 Hashtable responseData = new Hashtable(); 1159 Hashtable responseData = new Hashtable();
1159 responseData["auth_session"] = authed; 1160 responseData["auth_session"] = authed;
1160 response.Value = responseData; 1161 response.Value = responseData;
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 1115041..3b43622 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Framework.Communications
50 /// <value> 50 /// <value>
51 /// List of plugins to search for user data 51 /// List of plugins to search for user data
52 /// </value> 52 /// </value>
53 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); 53 private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>();
54 54
55 protected IInterServiceInventoryServices m_interServiceInventoryService; 55 protected IInterServiceInventoryServices m_interServiceInventoryService;
56 56
@@ -69,7 +69,7 @@ namespace OpenSim.Framework.Communications
69 /// <param name="plugin">The plugin that will provide user data</param> 69 /// <param name="plugin">The plugin that will provide user data</param>
70 public void AddPlugin(IUserDataPlugin plugin) 70 public void AddPlugin(IUserDataPlugin plugin)
71 { 71 {
72 _plugins.Add(plugin); 72 m_plugins.Add(plugin);
73 } 73 }
74 74
75 /// <summary> 75 /// <summary>
@@ -84,15 +84,15 @@ namespace OpenSim.Framework.Communications
84 /// </param> 84 /// </param>
85 public void AddPlugin(string provider, string connect) 85 public void AddPlugin(string provider, string connect)
86 { 86 {
87 _plugins.AddRange(DataPluginFactory.LoadDataPlugins<IUserDataPlugin>(provider, connect)); 87 m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IUserDataPlugin>(provider, connect));
88 } 88 }
89 89
90 #region Get UserProfile 90 #region Get UserProfile
91 91
92 // see IUserService 92 // see IUserService
93 public UserProfileData GetUserProfile(string fname, string lname) 93 public virtual UserProfileData GetUserProfile(string fname, string lname)
94 { 94 {
95 foreach (IUserDataPlugin plugin in _plugins) 95 foreach (IUserDataPlugin plugin in m_plugins)
96 { 96 {
97 UserProfileData profile = plugin.GetUserByName(fname, lname); 97 UserProfileData profile = plugin.GetUserByName(fname, lname);
98 98
@@ -108,7 +108,7 @@ namespace OpenSim.Framework.Communications
108 108
109 public void LogoutUsers(UUID regionID) 109 public void LogoutUsers(UUID regionID)
110 { 110 {
111 foreach (IUserDataPlugin plugin in _plugins) 111 foreach (IUserDataPlugin plugin in m_plugins)
112 { 112 {
113 plugin.LogoutUsers(regionID); 113 plugin.LogoutUsers(regionID);
114 } 114 }
@@ -116,7 +116,7 @@ namespace OpenSim.Framework.Communications
116 116
117 public void ResetAttachments(UUID userID) 117 public void ResetAttachments(UUID userID)
118 { 118 {
119 foreach (IUserDataPlugin plugin in _plugins) 119 foreach (IUserDataPlugin plugin in m_plugins)
120 { 120 {
121 plugin.ResetAttachments(userID); 121 plugin.ResetAttachments(userID);
122 } 122 }
@@ -124,12 +124,20 @@ namespace OpenSim.Framework.Communications
124 124
125 public UserProfileData GetUserProfile(Uri uri) 125 public UserProfileData GetUserProfile(Uri uri)
126 { 126 {
127 throw new NotImplementedException(); 127 foreach (IUserDataPlugin plugin in m_plugins)
128 {
129 UserProfileData profile = plugin.GetUserByUri(uri);
130
131 if (null != profile)
132 return profile;
133 }
134
135 return null;
128 } 136 }
129 137
130 public UserAgentData GetAgentByUUID(UUID userId) 138 public virtual UserAgentData GetAgentByUUID(UUID userId)
131 { 139 {
132 foreach (IUserDataPlugin plugin in _plugins) 140 foreach (IUserDataPlugin plugin in m_plugins)
133 { 141 {
134 UserAgentData agent = plugin.GetAgentByUUID(userId); 142 UserAgentData agent = plugin.GetAgentByUUID(userId);
135 143
@@ -150,7 +158,7 @@ namespace OpenSim.Framework.Communications
150 // see IUserService 158 // see IUserService
151 public virtual UserProfileData GetUserProfile(UUID uuid) 159 public virtual UserProfileData GetUserProfile(UUID uuid)
152 { 160 {
153 foreach (IUserDataPlugin plugin in _plugins) 161 foreach (IUserDataPlugin plugin in m_plugins)
154 { 162 {
155 UserProfileData profile = plugin.GetUserByUUID(uuid); 163 UserProfileData profile = plugin.GetUserByUUID(uuid);
156 164
@@ -164,10 +172,10 @@ namespace OpenSim.Framework.Communications
164 return null; 172 return null;
165 } 173 }
166 174
167 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query) 175 public virtual List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
168 { 176 {
169 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); 177 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
170 foreach (IUserDataPlugin plugin in _plugins) 178 foreach (IUserDataPlugin plugin in m_plugins)
171 { 179 {
172 try 180 try
173 { 181 {
@@ -188,9 +196,9 @@ namespace OpenSim.Framework.Communications
188 /// </summary> 196 /// </summary>
189 /// <param name="data"></param> 197 /// <param name="data"></param>
190 /// <returns></returns> 198 /// <returns></returns>
191 public bool UpdateUserProfile(UserProfileData data) 199 public virtual bool UpdateUserProfile(UserProfileData data)
192 { 200 {
193 foreach (IUserDataPlugin plugin in _plugins) 201 foreach (IUserDataPlugin plugin in m_plugins)
194 { 202 {
195 try 203 try
196 { 204 {
@@ -217,7 +225,7 @@ namespace OpenSim.Framework.Communications
217 /// <returns>Agent profiles</returns> 225 /// <returns>Agent profiles</returns>
218 public UserAgentData GetUserAgent(UUID uuid) 226 public UserAgentData GetUserAgent(UUID uuid)
219 { 227 {
220 foreach (IUserDataPlugin plugin in _plugins) 228 foreach (IUserDataPlugin plugin in m_plugins)
221 { 229 {
222 try 230 try
223 { 231 {
@@ -244,7 +252,7 @@ namespace OpenSim.Framework.Communications
244 /// <returns>A user agent</returns> 252 /// <returns>A user agent</returns>
245 public UserAgentData GetUserAgent(string name) 253 public UserAgentData GetUserAgent(string name)
246 { 254 {
247 foreach (IUserDataPlugin plugin in _plugins) 255 foreach (IUserDataPlugin plugin in m_plugins)
248 { 256 {
249 try 257 try
250 { 258 {
@@ -267,7 +275,7 @@ namespace OpenSim.Framework.Communications
267 /// <returns>A user agent</returns> 275 /// <returns>A user agent</returns>
268 public UserAgentData GetUserAgent(string fname, string lname) 276 public UserAgentData GetUserAgent(string fname, string lname)
269 { 277 {
270 foreach (IUserDataPlugin plugin in _plugins) 278 foreach (IUserDataPlugin plugin in m_plugins)
271 { 279 {
272 try 280 try
273 { 281 {
@@ -287,9 +295,9 @@ namespace OpenSim.Framework.Communications
287 /// </summary> 295 /// </summary>
288 /// <param name="name">the UUID of the friend list owner</param> 296 /// <param name="name">the UUID of the friend list owner</param>
289 /// <returns>A List of FriendListItems that contains info about the user's friends</returns> 297 /// <returns>A List of FriendListItems that contains info about the user's friends</returns>
290 public List<FriendListItem> GetUserFriendList(UUID ownerID) 298 public virtual List<FriendListItem> GetUserFriendList(UUID ownerID)
291 { 299 {
292 foreach (IUserDataPlugin plugin in _plugins) 300 foreach (IUserDataPlugin plugin in m_plugins)
293 { 301 {
294 try 302 try
295 { 303 {
@@ -309,9 +317,9 @@ namespace OpenSim.Framework.Communications
309 return null; 317 return null;
310 } 318 }
311 319
312 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids) 320 public virtual Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
313 { 321 {
314 foreach (IUserDataPlugin plugin in _plugins) 322 foreach (IUserDataPlugin plugin in m_plugins)
315 { 323 {
316 try 324 try
317 { 325 {
@@ -332,7 +340,7 @@ namespace OpenSim.Framework.Communications
332 340
333 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) 341 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey)
334 { 342 {
335 foreach (IUserDataPlugin plugin in _plugins) 343 foreach (IUserDataPlugin plugin in m_plugins)
336 { 344 {
337 try 345 try
338 { 346 {
@@ -345,13 +353,13 @@ namespace OpenSim.Framework.Communications
345 } 353 }
346 } 354 }
347 355
348 public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) 356 public virtual void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
349 { 357 {
350 foreach (IUserDataPlugin plugin in _plugins) 358 foreach (IUserDataPlugin plugin in m_plugins)
351 { 359 {
352 try 360 try
353 { 361 {
354 plugin.AddNewUserFriend(friendlistowner,friend,perms); 362 plugin.AddNewUserFriend(friendlistowner, friend, perms);
355 } 363 }
356 catch (Exception e) 364 catch (Exception e)
357 { 365 {
@@ -360,9 +368,9 @@ namespace OpenSim.Framework.Communications
360 } 368 }
361 } 369 }
362 370
363 public void RemoveUserFriend(UUID friendlistowner, UUID friend) 371 public virtual void RemoveUserFriend(UUID friendlistowner, UUID friend)
364 { 372 {
365 foreach (IUserDataPlugin plugin in _plugins) 373 foreach (IUserDataPlugin plugin in m_plugins)
366 { 374 {
367 try 375 try
368 { 376 {
@@ -375,9 +383,9 @@ namespace OpenSim.Framework.Communications
375 } 383 }
376 } 384 }
377 385
378 public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) 386 public virtual void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
379 { 387 {
380 foreach (IUserDataPlugin plugin in _plugins) 388 foreach (IUserDataPlugin plugin in m_plugins)
381 { 389 {
382 try 390 try
383 { 391 {
@@ -394,7 +402,7 @@ namespace OpenSim.Framework.Communications
394 /// Resets the currentAgent in the user profile 402 /// Resets the currentAgent in the user profile
395 /// </summary> 403 /// </summary>
396 /// <param name="agentID">The agent's ID</param> 404 /// <param name="agentID">The agent's ID</param>
397 public void ClearUserAgent(UUID agentID) 405 public virtual void ClearUserAgent(UUID agentID)
398 { 406 {
399 UserProfileData profile = GetUserProfile(agentID); 407 UserProfileData profile = GetUserProfile(agentID);
400 408
@@ -408,7 +416,6 @@ namespace OpenSim.Framework.Communications
408 UpdateUserProfile(profile); 416 UpdateUserProfile(profile);
409 } 417 }
410 418
411
412 #endregion 419 #endregion
413 420
414 #region CreateAgent 421 #region CreateAgent
@@ -544,7 +551,7 @@ namespace OpenSim.Framework.Communications
544 /// <param name="regionhandle"></param> 551 /// <param name="regionhandle"></param>
545 /// <param name="position"></param> 552 /// <param name="position"></param>
546 /// <param name="lookat"></param> 553 /// <param name="lookat"></param>
547 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat) 554 public virtual void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
548 { 555 {
549 if (StatsManager.UserStats != null) 556 if (StatsManager.UserStats != null)
550 StatsManager.UserStats.AddLogout(); 557 StatsManager.UserStats.AddLogout();
@@ -583,15 +590,6 @@ namespace OpenSim.Framework.Communications
583 } 590 }
584 } 591 }
585 592
586 /// <summary>
587 /// Process a user logoff from OpenSim (deprecated as of 2008-08-27)
588 /// </summary>
589 /// <param name="userid"></param>
590 /// <param name="regionid"></param>
591 /// <param name="regionhandle"></param>
592 /// <param name="posx"></param>
593 /// <param name="posy"></param>
594 /// <param name="posz"></param>
595 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz) 593 public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz)
596 { 594 {
597 LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3()); 595 LogOffUser(userid, regionid, regionhandle, new Vector3(posx, posy, posz), new Vector3());
@@ -643,7 +641,7 @@ namespace OpenSim.Framework.Communications
643 user.HomeRegionY = regY; 641 user.HomeRegionY = regY;
644 user.Email = email; 642 user.Email = email;
645 643
646 foreach (IUserDataPlugin plugin in _plugins) 644 foreach (IUserDataPlugin plugin in m_plugins)
647 { 645 {
648 try 646 try
649 { 647 {
@@ -669,13 +667,13 @@ namespace OpenSim.Framework.Communications
669 } 667 }
670 668
671 /// <summary> 669 /// <summary>
672 /// Reset a user password 670 /// Reset a user password.
673 /// </summary> 671 /// </summary>
674 /// <param name="firstName"></param> 672 /// <param name="firstName"></param>
675 /// <param name="lastName"></param> 673 /// <param name="lastName"></param>
676 /// <param name="newPassword"></param> 674 /// <param name="newPassword"></param>
677 /// <returns>true if the update was successful, false otherwise</returns> 675 /// <returns>true if the update was successful, false otherwise</returns>
678 public bool ResetUserPassword(string firstName, string lastName, string newPassword) 676 public virtual bool ResetUserPassword(string firstName, string lastName, string newPassword)
679 { 677 {
680 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty); 678 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(newPassword) + ":" + String.Empty);
681 679
@@ -705,7 +703,7 @@ namespace OpenSim.Framework.Communications
705 /// <param name="agentdata">The agent data to be added</param> 703 /// <param name="agentdata">The agent data to be added</param>
706 public bool AddUserAgent(UserAgentData agentdata) 704 public bool AddUserAgent(UserAgentData agentdata)
707 { 705 {
708 foreach (IUserDataPlugin plugin in _plugins) 706 foreach (IUserDataPlugin plugin in m_plugins)
709 { 707 {
710 try 708 try
711 { 709 {
@@ -725,9 +723,9 @@ namespace OpenSim.Framework.Communications
725 /// </summary> 723 /// </summary>
726 /// <param name="user"></param> 724 /// <param name="user"></param>
727 /// <returns></returns> 725 /// <returns></returns>
728 public AvatarAppearance GetUserAppearance(UUID user) 726 public virtual AvatarAppearance GetUserAppearance(UUID user)
729 { 727 {
730 foreach (IUserDataPlugin plugin in _plugins) 728 foreach (IUserDataPlugin plugin in m_plugins)
731 { 729 {
732 try 730 try
733 { 731 {
@@ -741,14 +739,9 @@ namespace OpenSim.Framework.Communications
741 return null; 739 return null;
742 } 740 }
743 741
744 /// <summary> 742 public virtual void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
745 /// Update avatar appearance information
746 /// </summary>
747 /// <param name="user"></param>
748 /// <param name="appearance"></param>
749 public void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
750 { 743 {
751 foreach (IUserDataPlugin plugin in _plugins) 744 foreach (IUserDataPlugin plugin in m_plugins)
752 { 745 {
753 try 746 try
754 { 747 {
@@ -838,8 +831,8 @@ namespace OpenSim.Framework.Communications
838 return false; 831 return false;
839 } 832 }
840 } 833 }
841 834
842 public bool VerifySession(UUID userID, UUID sessionID) 835 public virtual bool VerifySession(UUID userID, UUID sessionID)
843 { 836 {
844 UserProfileData userProfile = GetUserProfile(userID); 837 UserProfileData userProfile = GetUserProfile(userID);
845 838
@@ -851,6 +844,7 @@ namespace OpenSim.Framework.Communications
851 return true; 844 return true;
852 } 845 }
853 } 846 }
847
854 return false; 848 return false;
855 } 849 }
856 850