diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/CoreModules/Framework/UserManagement | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/UserManagement')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 7ecbd26..a536757 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -336,6 +336,104 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | <<<<<<< HEAD | ||
340 | ======= | ||
341 | /// <summary> | ||
342 | /// | ||
343 | /// </summary> | ||
344 | /// <param name="uuid"></param> | ||
345 | /// <param name="names">Caller please provide a properly instantiated array for names, string[2]</param> | ||
346 | /// <returns></returns> | ||
347 | private bool TryGetUserNames(UUID uuid, string[] names) | ||
348 | { | ||
349 | if (names == null) | ||
350 | names = new string[2]; | ||
351 | |||
352 | if (TryGetUserNamesFromCache(uuid, names)) | ||
353 | return true; | ||
354 | |||
355 | if (TryGetUserNamesFromServices(uuid, names)) | ||
356 | return true; | ||
357 | |||
358 | return false; | ||
359 | } | ||
360 | |||
361 | private bool TryGetUserNamesFromCache(UUID uuid, string[] names) | ||
362 | { | ||
363 | lock (m_UserCache) | ||
364 | { | ||
365 | if (m_UserCache.ContainsKey(uuid)) | ||
366 | { | ||
367 | names[0] = m_UserCache[uuid].FirstName; | ||
368 | names[1] = m_UserCache[uuid].LastName; | ||
369 | |||
370 | return true; | ||
371 | } | ||
372 | } | ||
373 | |||
374 | return false; | ||
375 | } | ||
376 | |||
377 | /// <summary> | ||
378 | /// Try to get the names bound to the given uuid, from the services. | ||
379 | /// </summary> | ||
380 | /// <returns>True if the name was found, false if not.</returns> | ||
381 | /// <param name='uuid'></param> | ||
382 | /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param> | ||
383 | private bool TryGetUserNamesFromServices(UUID uuid, string[] names) | ||
384 | { | ||
385 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, uuid); | ||
386 | |||
387 | if (account != null) | ||
388 | { | ||
389 | names[0] = account.FirstName; | ||
390 | names[1] = account.LastName; | ||
391 | |||
392 | UserData user = new UserData(); | ||
393 | user.FirstName = account.FirstName; | ||
394 | user.LastName = account.LastName; | ||
395 | |||
396 | lock (m_UserCache) | ||
397 | m_UserCache[uuid] = user; | ||
398 | |||
399 | return true; | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | // Let's try the GridUser service | ||
404 | GridUserInfo uInfo = m_Scenes[0].GridUserService.GetGridUserInfo(uuid.ToString()); | ||
405 | if (uInfo != null) | ||
406 | { | ||
407 | string url, first, last, tmp; | ||
408 | UUID u; | ||
409 | if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out u, out url, out first, out last, out tmp)) | ||
410 | { | ||
411 | AddUser(uuid, first, last, url); | ||
412 | |||
413 | if (m_UserCache.ContainsKey(uuid)) | ||
414 | { | ||
415 | names[0] = m_UserCache[uuid].FirstName; | ||
416 | names[1] = m_UserCache[uuid].LastName; | ||
417 | |||
418 | return true; | ||
419 | } | ||
420 | } | ||
421 | else | ||
422 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Unable to parse UUI {0}", uInfo.UserID); | ||
423 | } | ||
424 | // else | ||
425 | // { | ||
426 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: No grid user found for {0}", uuid); | ||
427 | // } | ||
428 | |||
429 | names[0] = "Unknown"; | ||
430 | names[1] = "UserUMMTGUN9"; | ||
431 | |||
432 | return false; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | >>>>>>> avn/ubitvar | ||
339 | #region IUserManagement | 437 | #region IUserManagement |
340 | 438 | ||
341 | public UUID GetUserIdByName(string name) | 439 | public UUID GetUserIdByName(string name) |