aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-28 02:51:34 +0100
committerJustin Clark-Casey (justincc)2012-03-28 02:51:34 +0100
commit12d3ea3029854b48b302459226fc88415e78630c (patch)
treed8db7d3b74cf23d8fc6ce999ebeeda6cd4355ce0 /OpenSim/Region/CoreModules/Framework
parentminor: Add some documentation to OnNewClient and OnClientClosed events (diff)
downloadopensim-SC_OLD-12d3ea3029854b48b302459226fc88415e78630c.zip
opensim-SC_OLD-12d3ea3029854b48b302459226fc88415e78630c.tar.gz
opensim-SC_OLD-12d3ea3029854b48b302459226fc88415e78630c.tar.bz2
opensim-SC_OLD-12d3ea3029854b48b302459226fc88415e78630c.tar.xz
Add "friends show cache <first-name> <last-name>" command for debugging purposes.
This adds a reverse lookup (name -> ID) to IUserManagement instead of hitting the UserAccountService directly.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 0397478..f4ed67b 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -297,6 +297,35 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
297 297
298 #region IUserManagement 298 #region IUserManagement
299 299
300 public UUID GetUserIdByName(string name)
301 {
302 string[] parts = name.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
303 if (parts.Length < 2)
304 throw new Exception("Name must have 2 components");
305
306 return GetUserIdByName(parts[0], parts[1]);
307 }
308
309 public UUID GetUserIdByName(string firstName, string lastName)
310 {
311 // TODO: Optimize for reverse lookup if this gets used by non-console commands.
312 lock (m_UserCache)
313 {
314 foreach (UserData user in m_UserCache.Values)
315 {
316 if (user.FirstName == firstName && user.LastName == lastName)
317 return user.Id;
318 }
319 }
320
321 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, firstName, lastName);
322
323 if (account != null)
324 return account.PrincipalID;
325
326 return UUID.Zero;
327 }
328
300 public string GetUserName(UUID uuid) 329 public string GetUserName(UUID uuid)
301 { 330 {
302 string[] names = GetUserNames(uuid); 331 string[] names = GetUserNames(uuid);