* In Standalone, add a persistant account for the OGP user.

* Gridmode, this has no effect at all.
0.6.0-stable
Teravus Ovares 2008-09-25 08:42:48 +00:00
parent 85ff004fb5
commit 17be1b736d
4 changed files with 80 additions and 8 deletions

View File

@ -261,6 +261,24 @@ namespace OpenSim.Framework.Communications
return userProf.ID;
}
}
public UUID AddUser(string firstName, string lastName, string password, uint regX, uint regY, UUID SetUUID)
{
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, 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

View File

@ -35,8 +35,11 @@ namespace OpenSim.Framework.Communications
/// Add a new user profile
/// </summary>
/// <param name="user"></param>
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID setUUID);
/// <summary>
/// Reset a user password
/// </summary>

View File

@ -545,10 +545,15 @@ namespace OpenSim.Framework.Communications
/// </summary>
/// <param name="user"></param>
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
{
return AddUserProfile(firstName, lastName, pass, regX, regY, UUID.Random());
}
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID SetUUID)
{
UserProfileData user = new UserProfileData();
user.HomeLocation = new Vector3(128, 128, 100);
user.ID = UUID.Random();
user.ID = SetUUID;
user.FirstName = firstName;
user.SurName = lastName;
user.PasswordHash = pass;
@ -572,7 +577,7 @@ namespace OpenSim.Framework.Communications
return user.ID;
}
/// <summary>
/// Reset a user password
/// </summary>

View File

@ -37,6 +37,7 @@ using System.Web;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenMetaverse.Packets;
using log4net;
using Nini.Config;
@ -94,6 +95,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
private string httpsCN = "";
private bool httpSSL = false;
private uint httpsslport = 0;
private bool GridMode = false;
#region IRegionModule Members
@ -102,6 +104,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
bool enabled = false;
IConfig cfg = null;
IConfig httpcfg = null;
IConfig startupcfg = null;
try
{
cfg = config.Configs["OpenGridProtocol"];
@ -118,6 +121,19 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
{
}
try
{
startupcfg = config.Configs["Startup"];
}
catch (NullReferenceException)
{
}
if (startupcfg != null)
{
GridMode = enabled = cfg.GetBoolean("gridmode", false);
}
if (cfg != null)
{
@ -182,17 +198,18 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
// Of interest to this module potentially
//scene.EventManager.OnNewClient += OnNewClient;
//scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
//scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
// scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
//scene.EventManager.OnMakeChildAgent += MakeChildAgent;
//scene.EventManager.OnClientClosed += ClientLoggedOut;
}
public void PostInitialise()
{
}
public void Close()
{
//scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
}
public string Name
@ -516,8 +533,21 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
userProfile.WebLoginKey = UUID.Random();
// Do caps registration
// get seed cap
// get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
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);
UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
if (userProfile2 != null)
{
userProfile = userProfile2;
userProfile.AboutText = "OGP USER";
userProfile.FirstLifeAboutText = "OGP USER";
homeScene.CommsManager.UserService.UpdateUserProfile(userProfile);
}
}
// Stick our data in the cache so the region will know something about us
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile);
@ -576,6 +606,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
CapsLoginID.Add(rezAvatarPath, agentData);
}
}
//System.Console.WriteLine("Response:" + responseMap.ToString());
return responseMap;
}
@ -733,6 +764,8 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["connect"] = LLSD.FromBoolean(true);
m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString());
}
}
@ -1162,6 +1195,18 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
}
}
private string CreateRandomStr(int len)
{
Random rnd = new Random(System.Environment.TickCount);
string returnstring = "";
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
for (int i = 0; i < len; i++)
{
returnstring += chars.Substring(rnd.Next(chars.Length), 1);
}
return returnstring;
}
// Temporary hack to allow teleporting to and from Vaak
private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
@ -1206,8 +1251,9 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
}
}
}
}
public class MonoCert : ICertificatePolicy
{
#region ICertificatePolicy Members