aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorUbitUmarov2016-08-19 03:05:25 +0100
committerUbitUmarov2016-08-19 03:05:25 +0100
commit7ba3fb7b5d9c883b7a99d19f893ff6d43689b629 (patch)
tree1ea4937e30520d440979ab02e92882f6f54a3e73 /OpenSim/Region/CoreModules/Framework
parentfix entity update flags update (diff)
parent catch some NULL refs (diff)
downloadopensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.zip
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.gz
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.bz2
opensim-SC-7ba3fb7b5d9c883b7a99d19f893ff6d43689b629.tar.xz
merge issue
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs146
1 files changed, 145 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index b72593c..eabeaf1 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -481,6 +481,151 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
481 return user.FirstName + " " + user.LastName; 481 return user.FirstName + " " + user.LastName;
482 } 482 }
483 483
484 public virtual Dictionary<UUID,string> GetUsersNames(string[] ids)
485 {
486 Dictionary<UUID,string> ret = new Dictionary<UUID,string>();
487 if(m_Scenes.Count <= 0)
488 return ret;
489
490 List<string> missing = new List<string>();
491 Dictionary<UUID,string> untried = new Dictionary<UUID, string>();
492
493 // look in cache
494 UserData userdata = new UserData();
495
496 UUID uuid = UUID.Zero;
497 foreach(string id in ids)
498 {
499 if(UUID.TryParse(id, out uuid))
500 {
501 lock (m_UserCache)
502 {
503 if (m_UserCache.TryGetValue(uuid, out userdata) &&
504 userdata.FirstName != "Unknown" && userdata.FirstName != string.Empty)
505 {
506 string name = userdata.FirstName + " " + userdata.LastName;
507
508 if(userdata.HasGridUserTried)
509 ret[uuid] = name;
510 else
511 {
512 untried[uuid] = name;
513 missing.Add(id);
514 }
515 }
516 else
517 missing.Add(id);
518 }
519 }
520 }
521
522 if(missing.Count == 0)
523 return ret;
524
525 // try user account service
526 List<UserAccount> accounts = m_Scenes[0].UserAccountService.GetUserAccounts(
527 m_Scenes[0].RegionInfo.ScopeID, missing);
528
529 if(accounts.Count != 0)
530 {
531 foreach(UserAccount uac in accounts)
532 {
533 if(uac != null)
534 {
535 string name = uac.FirstName + " " + uac.LastName;
536 ret[uac.PrincipalID] = name;
537 missing.Remove(uac.PrincipalID.ToString()); // slowww
538 untried.Remove(uac.PrincipalID);
539
540 userdata = new UserData();
541 userdata.Id = uac.PrincipalID;
542 userdata.FirstName = uac.FirstName;
543 userdata.LastName = uac.LastName;
544 userdata.HomeURL = string.Empty;
545 userdata.IsUnknownUser = false;
546 userdata.HasGridUserTried = true;
547 lock (m_UserCache)
548 m_UserCache[uac.PrincipalID] = userdata;
549 }
550 }
551 }
552
553 if (missing.Count == 0 || m_Scenes[0].GridUserService == null)
554 return ret;
555
556 // try grid user service
557
558 GridUserInfo[] pinfos = m_Scenes[0].GridUserService.GetGridUserInfo(missing.ToArray());
559 if(pinfos.Length > 0)
560 {
561 foreach(GridUserInfo uInfo in pinfos)
562 {
563 if (uInfo != null)
564 {
565 string url, first, last, tmp;
566
567 if(uInfo.UserID.Length <= 36)
568 continue;
569
570 if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out uuid, out url, out first, out last, out tmp))
571 {
572 if (url != string.Empty)
573 {
574 try
575 {
576 userdata = new UserData();
577 userdata.FirstName = first.Replace(" ", ".") + "." + last.Replace(" ", ".");
578 userdata.LastName = "@" + new Uri(url).Authority;
579 userdata.Id = uuid;
580 userdata.HomeURL = url;
581 userdata.IsUnknownUser = false;
582 userdata.HasGridUserTried = true;
583 lock (m_UserCache)
584 m_UserCache[uuid] = userdata;
585
586 string name = userdata.FirstName + " " + userdata.LastName;
587 ret[uuid] = name;
588 missing.Remove(uuid.ToString());
589 untried.Remove(uuid);
590 }
591 catch
592 {
593 }
594 }
595 }
596 }
597 }
598 }
599
600 // add the untried in cache that still failed
601 if(untried.Count > 0)
602 {
603 foreach(KeyValuePair<UUID, string> kvp in untried)
604 {
605 ret[kvp.Key] = kvp.Value;
606 missing.Remove((kvp.Key).ToString());
607 }
608 }
609
610 // add the UMMthings ( not sure we should)
611 if(missing.Count > 0)
612 {
613 foreach(string id in missing)
614 {
615 if(UUID.TryParse(id, out uuid) && uuid != UUID.Zero)
616 {
617 if (m_Scenes[0].LibraryService != null &&
618 (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
619 ret[uuid] = "Mr OpenSim";
620 else
621 ret[uuid] = "Unknown UserUMMAU43";
622 }
623 }
624 }
625
626 return ret;
627 }
628
484 public virtual string GetUserHomeURL(UUID userID) 629 public virtual string GetUserHomeURL(UUID userID)
485 { 630 {
486 UserData user; 631 UserData user;
@@ -584,7 +729,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
584 else 729 else
585 { 730 {
586 userdata = new UserData(); 731 userdata = new UserData();
587 userdata.HasGridUserTried = false;
588 userdata.Id = uuid; 732 userdata.Id = uuid;
589 userdata.FirstName = "Unknown"; 733 userdata.FirstName = "Unknown";
590 userdata.LastName = "UserUMMAU42"; 734 userdata.LastName = "UserUMMAU42";