mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
* refactor: move CreateUser into UserServiceAdmin
This commit is contained in:
@@ -106,8 +106,12 @@ namespace OpenSim.Framework.Communications
|
||||
protected NetworkServersInfo m_networkServersInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Interface to administrative user service calls.
|
||||
/// Interface to user service for administrating users.
|
||||
/// </summary>
|
||||
public IUserServiceAdmin UserServiceAdmin
|
||||
{
|
||||
get { return m_userServiceAdmin; }
|
||||
}
|
||||
protected IUserServiceAdmin m_userServiceAdmin;
|
||||
|
||||
public BaseHttpServer HttpServer
|
||||
@@ -247,63 +251,6 @@ namespace OpenSim.Framework.Communications
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Persistently adds a user to OpenSim.
|
||||
/// </summary>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="email"></param>
|
||||
/// <param name="regX"></param>
|
||||
/// <param name="regY"></param>
|
||||
/// <returns>The UUID of the added user. Returns UUID.Zero if the add was unsuccessful</returns>
|
||||
public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
|
||||
{
|
||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||
|
||||
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY);
|
||||
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
||||
if (userProf == null)
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
|
||||
m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
|
||||
return userProf.ID;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the user.
|
||||
/// </summary>
|
||||
/// <param name="firstName">The first name.</param>
|
||||
/// <param name="lastName">The last name.</param>
|
||||
/// <param name="password">The password.</param>
|
||||
/// <param name="email">The email.</param>
|
||||
/// <param name="regX">The reg X.</param>
|
||||
/// <param name="regY">The reg Y.</param>
|
||||
/// <param name="SetUUID">The set UUID.</param>
|
||||
/// <returns></returns>
|
||||
public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
|
||||
{
|
||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||
|
||||
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY, SetUUID);
|
||||
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
||||
if (userProf == null)
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
|
||||
m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
|
||||
return userProf.ID;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset a user password
|
||||
|
||||
@@ -32,29 +32,29 @@ namespace OpenSim.Framework.Communications
|
||||
public interface IUserServiceAdmin
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a new user profile
|
||||
/// Add a new user
|
||||
/// </summary>
|
||||
/// <param name="firstName">The first name.</param>
|
||||
/// <param name="lastName">The last name.</param>
|
||||
/// <param name="firstName">The first name</param>
|
||||
/// <param name="lastName">The last name</param>
|
||||
/// <param name="pass">password of avatar</param>
|
||||
/// <param name="email">email of user</param>
|
||||
/// <param name="regX">region X.</param>
|
||||
/// <param name="regY">region Y.</param>
|
||||
/// <returns></returns>
|
||||
UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY);
|
||||
/// <param name="regX">region X</param>
|
||||
/// <param name="regY">region Y</param>
|
||||
/// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
|
||||
UUID AddUser(string firstName, string lastName, string pass, string email, uint regX, uint regY);
|
||||
|
||||
/// <summary>
|
||||
/// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
|
||||
/// Add a new user with a specified UUID. SHOULD ONLY BE USED in very special circumstances from modules!
|
||||
/// </summary>
|
||||
/// <param name="firstName">The first name.</param>
|
||||
/// <param name="lastName">The last name.</param>
|
||||
/// <param name="firstName">The first name</param>
|
||||
/// <param name="lastName">The last name</param>
|
||||
/// <param name="pass">password of avatar</param>
|
||||
/// <param name="email">email of user</param>
|
||||
/// <param name="regX">region X.</param>
|
||||
/// <param name="regY">region Y.</param>
|
||||
/// <param name="setUUID">The set UUID.</param>
|
||||
/// <returns></returns>
|
||||
UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID);
|
||||
/// <param name="regX">region X</param>
|
||||
/// <param name="regY">region Y</param>
|
||||
/// <param name="setUUID">The set UUID</param>
|
||||
/// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
|
||||
UUID AddUser(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID);
|
||||
|
||||
/// <summary>
|
||||
/// Reset a user password
|
||||
|
||||
@@ -82,7 +82,6 @@ namespace OpenSim.Framework.Communications
|
||||
get { return "default"; }
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
|
||||
{
|
||||
// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId);
|
||||
|
||||
@@ -52,6 +52,17 @@ namespace OpenSim.Framework.Communications
|
||||
/// List of plugins to search for user data
|
||||
/// </value>
|
||||
private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>();
|
||||
|
||||
private IInterServiceInventoryServices m_interServiceInventoryService;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="interServiceInventoryService"></param>
|
||||
public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService)
|
||||
{
|
||||
m_interServiceInventoryService = interServiceInventoryService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new user data plugin - plugins will be requested in the order they were added.
|
||||
@@ -80,7 +91,7 @@ namespace OpenSim.Framework.Communications
|
||||
_plugins.AddRange(loader.Plugins);
|
||||
}
|
||||
|
||||
#region Get UserProfile
|
||||
#region Get UserProfile
|
||||
|
||||
// see IUserService
|
||||
public UserProfileData GetUserProfile(string fname, string lname)
|
||||
@@ -586,39 +597,42 @@ namespace OpenSim.Framework.Communications
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Add a new user profile
|
||||
/// Add a new user
|
||||
/// </summary>
|
||||
/// <param name="firstName">first name.</param>
|
||||
/// <param name="lastName">last name.</param>
|
||||
/// <param name="pass">password</param>
|
||||
/// <param name="email">email.</param>
|
||||
/// <param name="regX">location X.</param>
|
||||
/// <param name="regY">location Y.</param>
|
||||
/// <returns></returns>
|
||||
public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY)
|
||||
/// <param name="firstName">first name</param>
|
||||
/// <param name="lastName">last name</param>
|
||||
/// <param name="password">password</param>
|
||||
/// <param name="email">email</param>
|
||||
/// <param name="regX">location X</param>
|
||||
/// <param name="regY">location Y</param>
|
||||
/// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
|
||||
public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
|
||||
{
|
||||
return AddUserProfile(firstName, lastName, pass, email, regX, regY, UUID.Random());
|
||||
return AddUser(firstName, lastName, password, email, regX, regY, UUID.Random());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the user profile.
|
||||
/// Add a new user
|
||||
/// </summary>
|
||||
/// <param name="firstName">first name.</param>
|
||||
/// <param name="lastName">last name.</param>
|
||||
/// <param name="pass">password</param>
|
||||
/// <param name="email">email.</param>
|
||||
/// <param name="regX">location X.</param>
|
||||
/// <param name="regY">location Y.</param>
|
||||
/// <param name="firstName">first name</param>
|
||||
/// <param name="lastName">last name</param>
|
||||
/// <param name="password">password</param>
|
||||
/// <param name="email">email</param>
|
||||
/// <param name="regX">location X</param>
|
||||
/// <param name="regY">location Y</param>
|
||||
/// <param name="SetUUID">UUID of avatar.</param>
|
||||
/// <returns></returns>
|
||||
public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID SetUUID)
|
||||
/// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
|
||||
public UUID AddUser(
|
||||
string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
|
||||
{
|
||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||
|
||||
UserProfileData user = new UserProfileData();
|
||||
user.HomeLocation = new Vector3(128, 128, 100);
|
||||
user.ID = SetUUID;
|
||||
user.FirstName = firstName;
|
||||
user.SurName = lastName;
|
||||
user.PasswordHash = pass;
|
||||
user.PasswordHash = md5PasswdHash;
|
||||
user.PasswordSalt = String.Empty;
|
||||
user.Created = Util.UnixTimeSinceEpoch();
|
||||
user.HomeLookAt = new Vector3(100, 100, 100);
|
||||
@@ -638,7 +652,17 @@ namespace OpenSim.Framework.Communications
|
||||
}
|
||||
}
|
||||
|
||||
return user.ID;
|
||||
UserProfileData userProf = GetUserProfile(firstName, lastName);
|
||||
if (userProf == null)
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_interServiceInventoryService.CreateNewUserInventory(userProf.ID);
|
||||
|
||||
return userProf.ID;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user