Mantis#2660. Thank you kindly, Ruud Lathrop for a patch that:
This patch adds the option of adding the email when you create a new user. This works in Gridmode as none Gridmode. This option is also added to RemoteAdminPlugin. With a new handler you can create a user with a email.0.6.1-post-fixes
parent
0460c19bcd
commit
02fd7751d9
|
@ -93,6 +93,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod, false);
|
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod, false);
|
||||||
m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod, false);
|
m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod, false);
|
||||||
m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod, false);
|
m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod, false);
|
||||||
|
//This handler creates a user with a email,
|
||||||
|
m_httpd.AddXmlRPCHandler("admin_create_user_email", XmlRpcCreateUserMethodEmail, false);
|
||||||
m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod, false);
|
m_httpd.AddXmlRPCHandler("admin_exists_user", XmlRpcUserExistsMethod, false);
|
||||||
m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod, false);
|
m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod, false);
|
||||||
m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod, false);
|
m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod, false);
|
||||||
|
@ -472,7 +474,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("master avatar does not exist, creating it");
|
m_log.InfoFormat("master avatar does not exist, creating it");
|
||||||
// ...or create new user
|
// ...or create new user
|
||||||
userID = m_app.CreateUser(masterFirst, masterLast, masterPassword, region.RegionLocX, region.RegionLocY);
|
userID = m_app.CreateUser(masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
|
||||||
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
|
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
|
||||||
masterFirst, masterLast));
|
masterFirst, masterLast));
|
||||||
}
|
}
|
||||||
|
@ -647,7 +649,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
// check completeness
|
// check completeness
|
||||||
checkStringParameters(request, new string[] { "password", "user_firstname",
|
checkStringParameters(request, new string[] { "password", "user_firstname",
|
||||||
"user_lastname", "user_password" });
|
"user_lastname", "user_password", });
|
||||||
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
|
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
|
||||||
|
|
||||||
// check password
|
// check password
|
||||||
|
@ -658,6 +660,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
string firstname = (string) requestData["user_firstname"];
|
string firstname = (string) requestData["user_firstname"];
|
||||||
string lastname = (string) requestData["user_lastname"];
|
string lastname = (string) requestData["user_lastname"];
|
||||||
string passwd = (string) requestData["user_password"];
|
string passwd = (string) requestData["user_password"];
|
||||||
|
string email = ""; //Empty string for email
|
||||||
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
|
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
|
||||||
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
|
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
|
||||||
|
|
||||||
|
@ -665,7 +668,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
if (null != userProfile)
|
if (null != userProfile)
|
||||||
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
|
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
|
||||||
|
|
||||||
UUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY);
|
UUID userID = m_app.CreateUser(firstname, lastname, passwd, email, regX, regY);
|
||||||
|
|
||||||
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
|
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
|
||||||
firstname, lastname));
|
firstname, lastname));
|
||||||
|
@ -692,6 +695,101 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new user account.
|
||||||
|
/// <summary>
|
||||||
|
/// <param name="request">incoming XML RPC request</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// XmlRpcCreateUserMethod takes the following XMLRPC
|
||||||
|
/// parameters
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader><term>parameter name</term><description>description</description></listheader>
|
||||||
|
/// <item><term>password</term>
|
||||||
|
/// <description>admin password as set in OpenSim.ini</description></item>
|
||||||
|
/// <item><term>user_firstname</term>
|
||||||
|
/// <description>avatar's first name</description></item>
|
||||||
|
/// <item><term>user_lastname</term>
|
||||||
|
/// <description>avatar's last name</description></item>
|
||||||
|
/// <item><term>user_password</term>
|
||||||
|
/// <description>avatar's password</description></item>
|
||||||
|
/// <item><term>start_region_x</term>
|
||||||
|
/// <description>avatar's start region coordinates, X value</description></item>
|
||||||
|
/// <item><term>start_region_y</term>
|
||||||
|
/// <description>avatar's start region coordinates, Y value</description></item>
|
||||||
|
/// <item><term>user_email</term>
|
||||||
|
/// <description>email of avatar</description></item>
|
||||||
|
/// </list>
|
||||||
|
///
|
||||||
|
/// XmlRpcCreateUserMethod returns
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader><term>name</term><description>description</description></listheader>
|
||||||
|
/// <item><term>success</term>
|
||||||
|
/// <description>true or false</description></item>
|
||||||
|
/// <item><term>error</term>
|
||||||
|
/// <description>error message if success is false</description></item>
|
||||||
|
/// <item><term>avatar_uuid</term>
|
||||||
|
/// <description>UUID of the newly created avatar
|
||||||
|
/// account; UUID.Zero if failed.
|
||||||
|
/// </description></item>
|
||||||
|
/// </list>
|
||||||
|
/// </remarks>
|
||||||
|
public XmlRpcResponse XmlRpcCreateUserMethodEmail(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
m_log.Info("[RADMIN]: CreateUser: new request");
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable)request.Params[0];
|
||||||
|
|
||||||
|
// check completeness
|
||||||
|
checkStringParameters(request, new string[] { "password", "user_firstname",
|
||||||
|
"user_lastname", "user_password", "user_email" });
|
||||||
|
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
|
||||||
|
|
||||||
|
// check password
|
||||||
|
if (!String.IsNullOrEmpty(requiredPassword) &&
|
||||||
|
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
||||||
|
|
||||||
|
// do the job
|
||||||
|
string firstname = (string)requestData["user_firstname"];
|
||||||
|
string lastname = (string)requestData["user_lastname"];
|
||||||
|
string passwd = (string)requestData["user_password"];
|
||||||
|
string email = (string)requestData["user_email"];
|
||||||
|
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
|
||||||
|
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
|
||||||
|
|
||||||
|
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
||||||
|
if (null != userProfile)
|
||||||
|
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
|
||||||
|
|
||||||
|
UUID userID = m_app.CreateUser(firstname, lastname, passwd, email, regX, regY);
|
||||||
|
|
||||||
|
if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
|
||||||
|
firstname, lastname));
|
||||||
|
|
||||||
|
responseData["success"] = "true";
|
||||||
|
responseData["avatar_uuid"] = userID.ToString();
|
||||||
|
|
||||||
|
response.Value = responseData;
|
||||||
|
|
||||||
|
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
|
||||||
|
m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
|
||||||
|
|
||||||
|
responseData["success"] = "false";
|
||||||
|
responseData["avatar_uuid"] = UUID.Zero.ToString();
|
||||||
|
responseData["error"] = e.Message;
|
||||||
|
|
||||||
|
response.Value = responseData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check whether a certain user account exists.
|
/// Check whether a certain user account exists.
|
||||||
|
|
|
@ -255,14 +255,15 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="firstName"></param>
|
/// <param name="firstName"></param>
|
||||||
/// <param name="lastName"></param>
|
/// <param name="lastName"></param>
|
||||||
/// <param name="password"></param>
|
/// <param name="password"></param>
|
||||||
|
/// <param name="email"></param>
|
||||||
/// <param name="regX"></param>
|
/// <param name="regX"></param>
|
||||||
/// <param name="regY"></param>
|
/// <param name="regY"></param>
|
||||||
/// <returns>The UUID of the added user. Returns UUID.Zero if the add was unsuccessful</returns>
|
/// <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, uint regX, uint regY)
|
public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
|
||||||
{
|
{
|
||||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||||
|
|
||||||
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY);
|
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY);
|
||||||
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
||||||
if (userProf == null)
|
if (userProf == null)
|
||||||
{
|
{
|
||||||
|
@ -276,11 +277,22 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID AddUser(string firstName, string lastName, string password, uint regX, uint regY, UUID SetUUID)
|
/// <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);
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||||
|
|
||||||
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY, SetUUID);
|
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY, SetUUID);
|
||||||
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
|
||||||
if (userProf == null)
|
if (userProf == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,15 +35,15 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads a user profile by name
|
/// Loads a user profile by name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fname">First name</param>
|
/// <param name="firstName">First name</param>
|
||||||
/// <param name="lname">Last name</param>
|
/// <param name="lastName">Last name</param>
|
||||||
/// <returns>A user profile. Returns null if no profile is found</returns>
|
/// <returns>A user profile. Returns null if no profile is found</returns>
|
||||||
UserProfileData GetUserProfile(string firstName, string lastName);
|
UserProfileData GetUserProfile(string firstName, string lastName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads a user profile from a database by UUID
|
/// Loads a user profile from a database by UUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uuid">The target UUID</param>
|
/// <param name="userId">The target UUID</param>
|
||||||
/// <returns>A user profile. Returns null if no user profile is found.</returns>
|
/// <returns>A user profile. Returns null if no user profile is found.</returns>
|
||||||
UserProfileData GetUserProfile(UUID userId);
|
UserProfileData GetUserProfile(UUID userId);
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs off a user on the user server
|
/// Logs off a user on the user server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserID">UUID of the user</param>
|
/// <param name="userid">UUID of the user</param>
|
||||||
/// <param name="regionID">UUID of the Region</param>
|
/// <param name="regionid">UUID of the Region</param>
|
||||||
/// <param name="regionhandle">regionhandle</param>
|
/// <param name="regionhandle">regionhandle</param>
|
||||||
/// <param name="position">final position</param>
|
/// <param name="position">final position</param>
|
||||||
/// <param name="lookat">final lookat</param>
|
/// <param name="lookat">final lookat</param>
|
||||||
|
@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs off a user on the user server (deprecated as of 2008-08-27)
|
/// Logs off a user on the user server (deprecated as of 2008-08-27)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UserID">UUID of the user</param>
|
/// <param name="userid">UUID of the user</param>
|
||||||
/// <param name="regionID">UUID of the Region</param>
|
/// <param name="regionid">UUID of the Region</param>
|
||||||
/// <param name="regionhandle">regionhandle</param>
|
/// <param name="regionhandle">regionhandle</param>
|
||||||
/// <param name="posx">final position x</param>
|
/// <param name="posx">final position x</param>
|
||||||
/// <param name="posy">final position y</param>
|
/// <param name="posy">final position y</param>
|
||||||
|
@ -118,7 +118,8 @@ namespace OpenSim.Framework.Communications
|
||||||
/// Updates the current region the User is in
|
/// Updates the current region the User is in
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="avatarid">User Region the Avatar is IN</param>
|
/// <param name="avatarid">User Region the Avatar is IN</param>
|
||||||
/// <param name="retionuuid">User Region the Avatar is IN</param>
|
/// <param name="regionuuid">User Region the Avatar is IN</param>
|
||||||
|
/// <param name="regionhandle">User region handle</param>
|
||||||
void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle);
|
void UpdateUserCurrentRegion(UUID avatarid, UUID regionuuid, ulong regionhandle);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -34,11 +34,27 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a new user profile
|
/// Add a new user profile
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="firstName">The first name.</param>
|
||||||
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
|
/// <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);
|
||||||
|
|
||||||
// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
|
/// <summary>
|
||||||
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID setUUID);
|
/// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
|
||||||
|
/// </summary>
|
||||||
|
/// <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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset a user password
|
/// Reset a user password
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace OpenSim.Framework.Communications
|
||||||
/// Adds a new user server plugin - user servers will be requested in the order they were loaded.
|
/// Adds a new user server plugin - user servers will be requested in the order they were loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The filename to the user server plugin DLL</param>
|
/// <param name="provider">The filename to the user server plugin DLL</param>
|
||||||
|
/// <param name="connect"></param>
|
||||||
public void AddPlugin(string provider, string connect)
|
public void AddPlugin(string provider, string connect)
|
||||||
{
|
{
|
||||||
PluginLoader<IUserDataPlugin> loader =
|
PluginLoader<IUserDataPlugin> loader =
|
||||||
|
@ -580,15 +581,32 @@ namespace OpenSim.Framework.Communications
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Add a new user profile
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user"></param>
|
/// <param name="firstName">first name.</param>
|
||||||
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
|
/// <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)
|
||||||
{
|
{
|
||||||
return AddUserProfile(firstName, lastName, pass, regX, regY, UUID.Random());
|
return AddUserProfile(firstName, lastName, pass, email, regX, regY, UUID.Random());
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID SetUUID)
|
/// <summary>
|
||||||
|
/// Adds the user profile.
|
||||||
|
/// </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="SetUUID">UUID of avatar.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID SetUUID)
|
||||||
{
|
{
|
||||||
UserProfileData user = new UserProfileData();
|
UserProfileData user = new UserProfileData();
|
||||||
user.HomeLocation = new Vector3(128, 128, 100);
|
user.HomeLocation = new Vector3(128, 128, 100);
|
||||||
|
@ -601,6 +619,7 @@ namespace OpenSim.Framework.Communications
|
||||||
user.HomeLookAt = new Vector3(100, 100, 100);
|
user.HomeLookAt = new Vector3(100, 100, 100);
|
||||||
user.HomeRegionX = regX;
|
user.HomeRegionX = regX;
|
||||||
user.HomeRegionY = regY;
|
user.HomeRegionY = regY;
|
||||||
|
user.Email = email;
|
||||||
|
|
||||||
foreach (IUserDataPlugin plugin in _plugins)
|
foreach (IUserDataPlugin plugin in _plugins)
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,62 +162,12 @@ namespace OpenSim.Grid.UserServer
|
||||||
m_httpServer.AddXmlRPCHandler("update_user_profile", m_userManager.XmlRpcResponseXmlRPCUpdateUserProfile);
|
m_httpServer.AddXmlRPCHandler("update_user_profile", m_userManager.XmlRpcResponseXmlRPCUpdateUserProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void do_create(string what)
|
public void do_create(string[] args)
|
||||||
{
|
{
|
||||||
switch (what)
|
switch (args[0])
|
||||||
{
|
{
|
||||||
case "user":
|
case "user":
|
||||||
string tempfirstname = m_console.CmdPrompt("First name");
|
CreateUser(args);
|
||||||
string templastname = m_console.CmdPrompt("Last name");
|
|
||||||
//tempMD5Passwd = m_console.PasswdPrompt("Password");
|
|
||||||
string tempMD5Passwd = m_console.CmdPrompt("Password");
|
|
||||||
uint regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
|
|
||||||
uint regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
|
|
||||||
|
|
||||||
if (null != m_userManager.GetUserProfile(tempfirstname, templastname))
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
|
|
||||||
|
|
||||||
UUID userID = new UUID();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
|
|
||||||
{
|
|
||||||
throw new Exception(
|
|
||||||
String.Format(
|
|
||||||
"The inventory creation request for user {0} did not succeed."
|
|
||||||
+ " Please contact your inventory service provider for more information.",
|
|
||||||
userID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat(
|
|
||||||
"[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
|
|
||||||
Cfg.InventoryUrl + "CreateInventory/", userID);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_lastCreatedUser = userID;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,6 +196,85 @@ namespace OpenSim.Grid.UserServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
||||||
|
protected void CreateUser(string[] cmdparams)
|
||||||
|
{
|
||||||
|
string firstName;
|
||||||
|
string lastName;
|
||||||
|
string password;
|
||||||
|
string email;
|
||||||
|
uint regX = 1000;
|
||||||
|
uint regY = 1000;
|
||||||
|
|
||||||
|
if (cmdparams.Length < 2)
|
||||||
|
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
||||||
|
else firstName = cmdparams[1];
|
||||||
|
|
||||||
|
if (cmdparams.Length < 3)
|
||||||
|
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
||||||
|
else lastName = cmdparams[2];
|
||||||
|
|
||||||
|
if (cmdparams.Length < 4)
|
||||||
|
password = MainConsole.Instance.PasswdPrompt("Password");
|
||||||
|
else password = cmdparams[3];
|
||||||
|
|
||||||
|
if (cmdparams.Length < 5)
|
||||||
|
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
|
||||||
|
else regX = Convert.ToUInt32(cmdparams[4]);
|
||||||
|
|
||||||
|
if (cmdparams.Length < 6)
|
||||||
|
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
||||||
|
else regY = Convert.ToUInt32(cmdparams[5]);
|
||||||
|
|
||||||
|
if (cmdparams.Length < 7)
|
||||||
|
email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||||
|
else email = cmdparams[6];
|
||||||
|
|
||||||
|
if (null == m_userManager.GetUserProfile(firstName, lastName))
|
||||||
|
{
|
||||||
|
password = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||||
|
|
||||||
|
UUID userID = new UUID();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
userID = m_userManager.AddUserProfile(firstName, lastName, password, email, regX, regY);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
|
||||||
|
{
|
||||||
|
throw new Exception(
|
||||||
|
String.Format("The inventory creation request for user {0} did not succeed."
|
||||||
|
+ " Please contact your inventory service provider for more information.", userID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (WebException)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
|
||||||
|
Cfg.InventoryUrl + "CreateInventory/", userID);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_lastCreatedUser = userID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset a user password.
|
/// Reset a user password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -277,7 +306,7 @@ namespace OpenSim.Grid.UserServer
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case "create":
|
case "create":
|
||||||
do_create(cmdparams[0]);
|
do_create(cmdparams);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "reset":
|
case "reset":
|
||||||
|
|
|
@ -516,7 +516,14 @@ namespace OpenSim
|
||||||
switch (args[0])
|
switch (args[0])
|
||||||
{
|
{
|
||||||
case "user":
|
case "user":
|
||||||
|
if (ConfigurationSettings.Standalone)
|
||||||
|
{
|
||||||
CreateUser(args);
|
CreateUser(args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_console.Notice("Create user is not available in grid mode, use the user-server.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -537,7 +544,14 @@ namespace OpenSim
|
||||||
switch (args[1])
|
switch (args[1])
|
||||||
{
|
{
|
||||||
case "password":
|
case "password":
|
||||||
|
if (ConfigurationSettings.Standalone)
|
||||||
|
{
|
||||||
ResetUserPassword(args);
|
ResetUserPassword(args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_console.Notice("Reset user password is not available in grid mode, use the user-server.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,12 +748,13 @@ namespace OpenSim
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new user
|
/// Create a new user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmdparams"></param>
|
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
||||||
protected void CreateUser(string[] cmdparams)
|
protected void CreateUser(string[] cmdparams)
|
||||||
{
|
{
|
||||||
string firstName;
|
string firstName;
|
||||||
string lastName;
|
string lastName;
|
||||||
string password;
|
string password;
|
||||||
|
string email;
|
||||||
uint regX = 1000;
|
uint regX = 1000;
|
||||||
uint regY = 1000;
|
uint regY = 1000;
|
||||||
|
|
||||||
|
@ -751,7 +766,7 @@ namespace OpenSim
|
||||||
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
||||||
else lastName = cmdparams[2];
|
else lastName = cmdparams[2];
|
||||||
|
|
||||||
if ( cmdparams.Length < 4 )
|
if (cmdparams.Length < 4)
|
||||||
password = MainConsole.Instance.PasswdPrompt("Password");
|
password = MainConsole.Instance.PasswdPrompt("Password");
|
||||||
else password = cmdparams[3];
|
else password = cmdparams[3];
|
||||||
|
|
||||||
|
@ -763,9 +778,13 @@ namespace OpenSim
|
||||||
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
||||||
else regY = Convert.ToUInt32(cmdparams[5]);
|
else regY = Convert.ToUInt32(cmdparams[5]);
|
||||||
|
|
||||||
|
if (cmdparams.Length < 7)
|
||||||
|
email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||||
|
else email = cmdparams[6];
|
||||||
|
|
||||||
if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName))
|
if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName))
|
||||||
{
|
{
|
||||||
CreateUser(firstName, lastName, password, regX, regY);
|
CreateUser(firstName, lastName, password, email, regX, regY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -298,9 +298,9 @@ namespace OpenSim
|
||||||
m_assetCache = new AssetCache(assetServer);
|
m_assetCache = new AssetCache(assetServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, uint regX, uint regY)
|
public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, string email, uint regX, uint regY)
|
||||||
{
|
{
|
||||||
return m_commsManager.AddUser(tempfirstname, templastname, tempPasswd, regX, regY);
|
return m_commsManager.AddUser(tempfirstname, templastname, tempPasswd, email, regX, regY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
//no current user account so make one
|
//no current user account so make one
|
||||||
m_log.Info("[LOGIN]: No user account found so creating a new one.");
|
m_log.Info("[LOGIN]: No user account found so creating a new one.");
|
||||||
|
|
||||||
m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
|
m_userManager.AddUserProfile(firstname, lastname, "test", "", defaultHomeX, defaultHomeY);
|
||||||
|
|
||||||
profile = m_userManager.GetUserProfile(firstname, lastname);
|
profile = m_userManager.GetUserProfile(firstname, lastname);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.Communications.Local
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
|
Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
|
||||||
AddUserProfile(firstName, lastName, password, m_defaultHomeX, m_defaultHomeY);
|
AddUserProfile(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY);
|
||||||
|
|
||||||
profile = GetUserProfile(firstName, lastName);
|
profile = GetUserProfile(firstName, lastName);
|
||||||
|
|
||||||
|
|
|
@ -530,7 +530,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
|
||||||
// get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
|
// get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
|
||||||
if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
|
if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
|
||||||
{
|
{
|
||||||
homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
|
homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), "", homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
|
||||||
UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
|
UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
|
||||||
if (userProfile2 != null)
|
if (userProfile2 != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue