diff options
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); |