diff options
author | Diva Canto | 2012-03-27 19:09:03 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-27 19:09:03 -0700 |
commit | 4007f62158601a0441977bc89a9e5a1469b782ce (patch) | |
tree | 841d0e0704eb48aa0c7b723ea888c41d5b16baf0 /OpenSim/Region/CoreModules/Framework | |
parent | HG: Switch root folders from under the viewer. Towards HG 2.0. This is guarde... (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-4007f62158601a0441977bc89a9e5a1469b782ce.zip opensim-SC_OLD-4007f62158601a0441977bc89a9e5a1469b782ce.tar.gz opensim-SC_OLD-4007f62158601a0441977bc89a9e5a1469b782ce.tar.bz2 opensim-SC_OLD-4007f62158601a0441977bc89a9e5a1469b782ce.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 29 |
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); |