Possible my last ever OpenSim/OGS contribution (if I continue to feel like this):

Re-added a CLI "create user" command to the userserver, only currently works if using DB4o as the database provider. 
Added Xml config files to both the UserServer and Gridserver (UserServerConfig.xml and GridServerConfig.xml), so that the database provider can be set in it. (both currently default to DB4o , so maybe Adam will want to change it back to defaulting to MySQL)
zircon^2
MW 2007-05-25 16:27:07 +00:00
parent eaf4b3f1a9
commit b2d588ed1c
18 changed files with 308 additions and 201 deletions

View File

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# Visual C# Express 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenUser.Config.UserConfigDb4o", "OpenGridServices\OpenUser.Config\UserConfigDb4o\OpenUser.Config.UserConfigDb4o.csproj", "{7E494328-0000-0000-0000-000000000000}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.AssetServer", "OpenGridServices\OpenGridServices.AssetServer\OpenGridServices.AssetServer.csproj", "{0021261B-0000-0000-0000-000000000000}"
@ -29,15 +29,6 @@ Global
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
({1E3F341A-0000-0000-0000-000000000000}).4 = ({62CDF671-0000-0000-0000-000000000000})
({39BD9497-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).6 = ({62CDF671-0000-0000-0000-000000000000})
({21BFC8E2-0000-0000-0000-000000000000}).7 = ({7924FD35-0000-0000-0000-000000000000})
({0A563AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000})
({66591469-0000-0000-0000-000000000000}).5 = ({62CDF671-0000-0000-0000-000000000000})
({0F3C3AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000})
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU

View File

@ -24,8 +24,8 @@
<include name="System.Xml.dll" />
<include name="../../../bin/libsecondlife.dll" />
<include name="../../../bin/Db4objects.Db4o.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="../../../bin/OpenSim.Framework.dll" />
<include name="../../../bin/OpenSim.Framework.Console.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />

View File

@ -66,6 +66,11 @@ namespace OpenGrid.Framework.Data.DB4o
}
}
public void addNewUserProfile(UserProfileData user)
{
manager.AddRow(user);
}
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return true;

View File

@ -121,6 +121,10 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
public void addNewUserProfile(UserProfileData user)
{
}
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return false;

View File

@ -51,6 +51,12 @@ namespace OpenGrid.Framework.Data
/// <returns>The current agent session</returns>
UserAgentData getAgentByName(string fname, string lname);
/// <summary>
/// Adds a new User profile to the database
/// </summary>
/// <param name="user">UserProfile to add</param>
void addNewUserProfile(UserProfileData user);
/// <summary>
/// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
/// </summary>

View File

@ -5,11 +5,13 @@ using System.Collections;
using System.Collections.Generic;
using libsecondlife;
namespace OpenGrid.Framework.Manager {
namespace OpenGrid.Framework.Manager
{
public delegate void GridManagerCallback(string param);
public class GridManagementAgent {
public class GridManagementAgent
{
private GridManagerCallback thecallback;
private string sendkey;
@ -51,13 +53,16 @@ namespace OpenGrid.Framework.Manager {
Hashtable responseData = new Hashtable();
// TODO: Switch this over to using OpenGrid.Framework.Data
if( requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) {
if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
{
response.IsFault = false;
LLUUID new_session = LLUUID.Random();
Sessions.Add(new_session);
responseData["session_id"] = new_session.ToString();
responseData["msg"] = "Login OK";
} else {
}
else
{
response.IsFault = true;
responseData["error"] = "Invalid username or password";
}

View File

@ -20,10 +20,10 @@
<include name="${project::get-base-directory()}/${build.dir}" />
</lib>
<include name="System.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Servers.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="XMLRPC.dll" />
<include name="../../bin/XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -23,13 +23,13 @@
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="OpenSim.GridInterfaces.Local.dll" />
<include name="OpenSim.Servers.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.GridInterfaces.Local.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="XMLRPC.dll" />
<include name="../../bin/XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -41,6 +41,7 @@ using OpenSim.Framework.Sims;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Servers;
using OpenSim.GenericConfig;
namespace OpenGridServices.GridServer
{
@ -49,10 +50,12 @@ namespace OpenGridServices.GridServer
public class OpenGrid_Main : BaseServer, conscmd_callback
{
private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
private string GridDll = "OpenGrid.Framework.Data.MySQL.dll";
private string GridDll = "OpenGrid.Framework.Data.DB4o.dll";
public GridConfig Cfg;
public static OpenGrid_Main thegrid;
protected IGenericConfig localXMLConfig;
public static bool setuponly;
//public LLUUID highestUUID;
@ -95,8 +98,10 @@ namespace OpenGridServices.GridServer
}
public void managercallback(string cmd) {
switch(cmd) {
public void managercallback(string cmd)
{
switch (cmd)
{
case "shutdown":
RunCmd("shutdown", new string[0]);
break;
@ -106,6 +111,11 @@ namespace OpenGridServices.GridServer
public void Startup()
{
this.localXMLConfig = new XmlConfig("GridServerConfig.xml");
this.localXMLConfig.LoadData();
this.ConfigDB(this.localXMLConfig);
this.localXMLConfig.Close();
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration");
Cfg = this.LoadConfigDll(this.ConfigDll);
Cfg.InitConfig();
@ -235,5 +245,28 @@ namespace OpenGridServices.GridServer
public void Show(string ShowWhat)
{
}
private void ConfigDB(IGenericConfig configData)
{
try
{
string attri = "";
attri = configData.GetAttribute("DataBaseProvider");
if (attri == "")
{
GridDll = "OpenGrid.Framework.Data.DB4o.dll";
configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll");
}
else
{
GridDll = attri;
}
configData.Commit();
}
catch (Exception e)
{
}
}
}
}

View File

@ -82,6 +82,10 @@
<HintPath>OpenSim.Servers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenSim.GenericConfig.Xml" >
<HintPath>OpenSim.GenericConfig.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="libsecondlife.dll" >
<HintPath>..\..\bin\libsecondlife.dll</HintPath>
<Private>False</Private>

View File

@ -23,14 +23,15 @@
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="OpenSim.Servers.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="../../bin/OpenGrid.Framework.Data.dll" />
<include name="../../bin/OpenGrid.Framework.Manager.dll" />
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="XMLRPC.dll" />
<include name="../../bin/XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -40,6 +40,8 @@ using OpenSim.Framework.Inventory;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Console;
using OpenSim.Servers;
using OpenSim.Framework.Utilities;
using OpenSim.GenericConfig;
namespace OpenGridServices.UserServer
{
@ -48,8 +50,9 @@ namespace OpenGridServices.UserServer
public class OpenUser_Main : BaseServer, conscmd_callback
{
private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll";
private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll";
private string StorageDll = "OpenGrid.Framework.Data.DB4o.dll";
private UserConfig Cfg;
protected IGenericConfig localXMLConfig;
public UserManager m_userManager; // Replaces below.
@ -88,6 +91,11 @@ namespace OpenGridServices.UserServer
public void Startup()
{
this.localXMLConfig = new XmlConfig("UserServerConfig.xml");
this.localXMLConfig.LoadData();
this.ConfigDB(this.localXMLConfig);
this.localXMLConfig.Close();
MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration");
Cfg = this.LoadConfigDll(this.ConfigDll);
Cfg.InitConfig();
@ -112,33 +120,22 @@ namespace OpenGridServices.UserServer
switch (what)
{
case "user":
m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Commandline user creation is currently disabled.");
break;
/*
string tempfirstname;
string templastname;
string tempMD5Passwd;
uint regX = 997;
uint regY = 996;
tempfirstname = m_console.CmdPrompt("First name");
templastname = m_console.CmdPrompt("Last name");
tempMD5Passwd = m_console.PasswdPrompt("Password");
regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X"));
regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y"));
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
tempMD5Passwd = s.ToString();
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
UserProfile newuser = m_userProfileManager.CreateNewProfile(tempfirstname, templastname, tempMD5Passwd);
newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f);
newuser.homepos = new LLVector3(128f, 128f, 150f);
m_userProfileManager.SaveUserProfiles();
m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
break;
*/
}
}
@ -162,6 +159,29 @@ namespace OpenGridServices.UserServer
}
}
private void ConfigDB(IGenericConfig configData)
{
try
{
string attri = "";
attri = configData.GetAttribute("DataBaseProvider");
if (attri == "")
{
StorageDll = "OpenGrid.Framework.Data.DB4o.dll";
configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll");
}
else
{
StorageDll = attri;
}
configData.Commit();
}
catch (Exception e)
{
}
}
private UserConfig LoadConfigDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);

View File

@ -78,6 +78,10 @@
<HintPath>OpenSim.Framework.Console.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenSim.GenericConfig.Xml" >
<HintPath>OpenSim.GenericConfig.Xml.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="OpenSim.Servers" >
<HintPath>OpenSim.Servers.dll</HintPath>
<Private>False</Private>

View File

@ -23,13 +23,14 @@
<include name="System.dll" />
<include name="System.Data.dll" />
<include name="System.Xml.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenSim.Framework.dll" />
<include name="../../bin/OpenSim.Framework.Console.dll" />
<include name="../../bin/OpenGrid.Framework.Data.dll" />
<include name="OpenSim.Servers.dll" />
<include name="../../bin/OpenSim.GenericConfig.Xml.dll" />
<include name="../../bin/OpenSim.Servers.dll" />
<include name="../../bin/libsecondlife.dll" />
<include name="../../bin/Db4objects.Db4o.dll" />
<include name="XMLRPC.dll" />
<include name="../../bin/XMLRPC.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />

View File

@ -52,6 +52,37 @@ namespace OpenGridServices.UserServer
pluginAssembly = null;
}
/// <summary>
///
/// </summary>
/// <param name="user"></param>
public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
{
UserProfileData user = new UserProfileData();
user.homeLocation = new LLVector3(128, 128, 100);
user.UUID = LLUUID.Random();
user.username = firstName;
user.surname = lastName;
user.passwordHash = pass;
user.passwordSalt = "";
user.created = Util.UnixTimeSinceEpoch();
user.homeLookAt = new LLVector3(100, 100, 100);
user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256));
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
{
try
{
plugin.Value.addNewUserProfile(user);
}
catch (Exception e)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
}
}
}
/// <summary>
/// Loads a user profile from a database by UUID
/// </summary>

View File

@ -24,8 +24,8 @@
<include name="System.Xml.dll" />
<include name="../../../bin/libsecondlife.dll" />
<include name="../../../bin/Db4objects.Db4o.dll" />
<include name="OpenSim.Framework.dll" />
<include name="OpenSim.Framework.Console.dll" />
<include name="../../../bin/OpenSim.Framework.dll" />
<include name="../../../bin/OpenSim.Framework.Console.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" />

View File

@ -702,6 +702,7 @@
<Reference name="OpenSim.Servers"/>
<Reference name="OpenGrid.Framework.Data"/>
<Reference name="OpenGrid.Framework.Manager"/>
<Reference name="OpenSim.GenericConfig.Xml"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Db4objects.Db4o.dll"/>
<Reference name="XMLRPC"/>
@ -759,6 +760,7 @@
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenGrid.Framework.Data"/>
<Reference name="OpenSim.GenericConfig.Xml"/>
<Reference name="OpenSim.Servers"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Db4objects.Db4o.dll"/>