diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 0e5e782c42..a82a58d83f 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -37,6 +37,9 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework.UserManagement { + /// + /// Base class for user management (create, read, etc) + /// public abstract class UserManagerBase : IUserService { public UserConfig _config; @@ -84,22 +87,23 @@ namespace OpenSim.Framework.UserManagement /// Loads a user profile from a database by UUID /// /// The target UUID - /// A user profile + /// A user profile. Returns null if no user profile is found. public UserProfileData GetUserProfile(LLUUID uuid) { foreach (KeyValuePair plugin in _plugins) { - try + UserProfileData profile = plugin.Value.GetUserByUUID(uuid); + + if (null != profile) { - UserProfileData profile = plugin.Value.GetUserByUUID(uuid); profile.currentAgent = getUserAgent(profile.UUID); return profile; - } - catch (Exception e) - { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); - } + } } + + MainLog.Instance.Notice( + "USERSTORAGE", + "Could not find user " + uuid.ToStringHyphenated() + " in persistent storage."); return null; } @@ -123,55 +127,28 @@ namespace OpenSim.Framework.UserManagement return pickerlist; } - - /// - /// Loads a user profile by name - /// - /// The target name - /// A user profile - public UserProfileData GetUserProfile(string name) - { - foreach (KeyValuePair plugin in _plugins) - { - try - { - UserProfileData profile = plugin.Value.GetUserByName(name); - profile.currentAgent = getUserAgent(profile.UUID); - return profile; - } - catch (Exception e) - { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); - } - } - - return null; - } - /// /// Loads a user profile by name /// /// First name /// Last name - /// A user profile + /// A user profile. Returns null if no profile is found public UserProfileData GetUserProfile(string fname, string lname) { foreach (KeyValuePair plugin in _plugins) { - try + UserProfileData profile = plugin.Value.GetUserByName(fname, lname); + + if (profile != null) { - UserProfileData profile = plugin.Value.GetUserByName(fname, lname); - profile.currentAgent = getUserAgent(profile.UUID); - return profile; } - catch (Exception e) - { - MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); - } } - + + MainLog.Instance.Notice( + "USERSTORAGE", "Could not find user " + fname + " " + lname + " in persistent storage."); + return null; } diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs index c235e961ee..80b65c1bab 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs @@ -61,16 +61,6 @@ namespace OpenSim.Framework.Data.MSSQL database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); } - /// - /// Searches the database for a specified user profile - /// - /// The account name of the user - /// A user profile - public UserProfileData GetUserByName(string name) - { - return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]); - } - /// /// Searches the database for a specified user profile by name components /// @@ -188,11 +178,7 @@ namespace OpenSim.Framework.Data.MSSQL return returnlist; } - /// - /// Searches the database for a specified user profile by UUID - /// - /// The account ID - /// The users profile + // See IUserData public UserProfileData GetUserByUUID(LLUUID uuid) { try diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index e5cbe45318..6a7cf4925b 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs @@ -113,23 +113,8 @@ namespace OpenSim.Framework.Data.MySQL } #endregion - - /// - /// Searches the database for a specified user profile - /// - /// The account name of the user - /// A user profile - public UserProfileData GetUserByName(string name) - { - return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]); - } - /// - /// Searches the database for a specified user profile by name components - /// - /// The first part of the account name - /// The second part of the account name - /// A user profile + // see IUserData public UserProfileData GetUserByName(string user, string last) { try @@ -244,11 +229,7 @@ namespace OpenSim.Framework.Data.MySQL return returnlist; } - /// - /// Searches the database for a specified user profile by UUID - /// - /// The account ID - /// The users profile + // see IUserData public UserProfileData GetUserByUUID(LLUUID uuid) { try diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index da272776b6..346febcf9d 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -72,11 +72,7 @@ namespace OpenSim.Framework.Data.SQLite return; } - /// - /// Loads a specified user profile from a UUID - /// - /// The user's UUID - /// A user profile + // see IUserData public UserProfileData GetUserByUUID(LLUUID uuid) { lock (ds) @@ -99,22 +95,7 @@ namespace OpenSim.Framework.Data.SQLite } } - /// - /// Returns a user by searching for its name - /// - /// The user's account name - /// A matching user profile - public UserProfileData GetUserByName(string name) - { - return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]); - } - - /// - /// Returns a user by searching for its name - /// - /// The first part of the user's account name - /// The second part of the user's account name - /// A matching user profile + // see IUserData public UserProfileData GetUserByName(string fname, string lname) { string select = "surname = '" + lname + "' and username = '" + fname + "'"; diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs index a32bf6cc08..0679a686f7 100644 --- a/OpenSim/Framework/IUserData.cs +++ b/OpenSim/Framework/IUserData.cs @@ -38,17 +38,10 @@ namespace OpenSim.Framework /// /// Returns a user profile from a database via their UUID /// - /// The accounts UUID - /// The user data profile + /// The user's UUID + /// The user data profile. Returns null if no user is found UserProfileData GetUserByUUID(LLUUID user); - /// - /// Returns a users profile by searching their username - /// - /// The users username - /// The user data profile - UserProfileData GetUserByName(string name); - /// /// Returns a users profile by searching their username parts /// diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs index 298bde552a..3440e3063d 100644 --- a/OpenSim/Framework/IUserService.cs +++ b/OpenSim/Framework/IUserService.cs @@ -33,7 +33,7 @@ namespace OpenSim.Framework public interface IUserService { UserProfileData GetUserProfile(string firstName, string lastName); - UserProfileData GetUserProfile(string name); + //UserProfileData GetUserProfile(string name); UserProfileData GetUserProfile(LLUUID userId); void clearUserAgent(LLUUID avatarID); List GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query); diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 103c76f1fa..37cea1f1d5 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -31,6 +31,7 @@ using System.Collections; using System.Collections.Generic; using libsecondlife; using OpenSim.Framework; +using OpenSim.Framework.Console; using OpenSim.Framework.UserManagement; using InventoryFolder=OpenSim.Framework.InventoryFolder; @@ -72,7 +73,8 @@ namespace OpenSim.Region.Communications.Local if (!authUsers) { //no current user account so make one - Console.WriteLine("No User account found so creating a new one "); + MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one."); + m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); profile = m_userManager.GetUserProfile(firstname, lastname); @@ -91,12 +93,14 @@ namespace OpenSim.Region.Communications.Local if (!authUsers) { //for now we will accept any password in sandbox mode - Console.WriteLine("authorising user"); + MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)"); + return true; } else { - Console.WriteLine("Authenticating " + profile.username + " " + profile.surname); + MainLog.Instance.Notice( + "LOGIN", "Authenticating " + profile.username + " " + profile.surname); password = password.Remove(0, 3); //remove $1$ @@ -153,7 +157,7 @@ namespace OpenSim.Region.Communications.Local } else { - Console.WriteLine("not found region " + currentRegion); + MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); } } diff --git a/bin/mysql_connection.ini b/bin/mysql_connection.ini index c8c6c8cc12..7644f63997 100644 --- a/bin/mysql_connection.ini +++ b/bin/mysql_connection.ini @@ -1,7 +1,7 @@ [mysqlconnection] hostname=localhost -database=database -username=username -password=password +database=opensim +username=root +password=passw0rd pooling=false -port=3306 \ No newline at end of file +port=3306