Less refs to UserProfileCacheService. Compiles but likely doesn't run.
parent
6b60f3cce5
commit
25fdbd6cbc
|
@ -135,69 +135,6 @@ namespace OpenSim.Framework.Communications
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
|
|
||||||
{
|
|
||||||
if (uuid == m_userProfileCacheService.LibraryRoot.Owner)
|
|
||||||
{
|
|
||||||
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string[] names = doUUIDNameRequest(uuid);
|
|
||||||
if (names.Length == 2)
|
|
||||||
{
|
|
||||||
remote_client.SendNameReply(uuid, names[0], names[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string[] doUUIDNameRequest(UUID uuid)
|
|
||||||
{
|
|
||||||
lock (m_nameRequestCache)
|
|
||||||
{
|
|
||||||
if (m_nameRequestCache.ContainsKey(uuid))
|
|
||||||
return m_nameRequestCache[uuid];
|
|
||||||
}
|
|
||||||
|
|
||||||
string[] returnstring = new string[0];
|
|
||||||
CachedUserInfo uinfo = UserProfileCacheService.GetUserDetails(uuid);
|
|
||||||
|
|
||||||
if ((uinfo != null) && (uinfo.UserProfile != null))
|
|
||||||
{
|
|
||||||
returnstring = new string[2];
|
|
||||||
returnstring[0] = uinfo.UserProfile.FirstName;
|
|
||||||
returnstring[1] = uinfo.UserProfile.SurName;
|
|
||||||
lock (m_nameRequestCache)
|
|
||||||
{
|
|
||||||
if (!m_nameRequestCache.ContainsKey(uuid))
|
|
||||||
m_nameRequestCache.Add(uuid, returnstring);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnstring;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool UUIDNameCachedTest(UUID uuid)
|
|
||||||
{
|
|
||||||
lock (m_nameRequestCache)
|
|
||||||
return m_nameRequestCache.ContainsKey(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string UUIDNameRequestString(UUID uuid)
|
|
||||||
{
|
|
||||||
string[] names = doUUIDNameRequest(uuid);
|
|
||||||
if (names.Length == 2)
|
|
||||||
{
|
|
||||||
string firstname = names[0];
|
|
||||||
string lastname = names[1];
|
|
||||||
|
|
||||||
return firstname + " " + lastname;
|
|
||||||
|
|
||||||
}
|
|
||||||
return "(hippos)";
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
|
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
|
||||||
{
|
{
|
||||||
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
|
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Osp
|
namespace OpenSim.Framework.Communications.Osp
|
||||||
{
|
{
|
||||||
|
@ -37,12 +38,13 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
public class OspInventoryWrapperPlugin : IInventoryDataPlugin
|
public class OspInventoryWrapperPlugin : IInventoryDataPlugin
|
||||||
{
|
{
|
||||||
protected IInventoryDataPlugin m_wrappedPlugin;
|
protected IInventoryDataPlugin m_wrappedPlugin;
|
||||||
protected CommunicationsManager m_commsManager;
|
//protected CommunicationsManager m_commsManager;
|
||||||
|
protected IUserAccountService m_userAccountService;
|
||||||
|
|
||||||
public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager)
|
public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, IUserAccountService userService)
|
||||||
{
|
{
|
||||||
m_wrappedPlugin = wrappedPlugin;
|
m_wrappedPlugin = wrappedPlugin;
|
||||||
m_commsManager = commsManager;
|
m_userAccountService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get { return "OspInventoryWrapperPlugin"; } }
|
public string Name { get { return "OspInventoryWrapperPlugin"; } }
|
||||||
|
@ -81,7 +83,7 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
|
|
||||||
protected InventoryItemBase PostProcessItem(InventoryItemBase item)
|
protected InventoryItemBase PostProcessItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
|
item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_userAccountService);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Osp
|
namespace OpenSim.Framework.Communications.Osp
|
||||||
{
|
{
|
||||||
|
@ -55,11 +56,11 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
/// <param name="userId"></param>
|
/// <param name="userId"></param>
|
||||||
/// <param name="commsManager"></param>
|
/// <param name="commsManager"></param>
|
||||||
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
|
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
|
||||||
public static string MakeOspa(UUID userId, CommunicationsManager commsManager)
|
public static string MakeOspa(UUID userId, IUserAccountService userService)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
|
||||||
if (userInfo != null)
|
if (account != null)
|
||||||
return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName);
|
return MakeOspa(account.FirstName, account.LastName);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,7 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
/// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero
|
/// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero
|
||||||
/// is returned.
|
/// is returned.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager)
|
public static UUID ResolveOspa(string ospa, IUserAccountService userService)
|
||||||
{
|
{
|
||||||
if (!ospa.StartsWith(OSPA_PREFIX))
|
if (!ospa.StartsWith(OSPA_PREFIX))
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
@ -112,7 +113,7 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
|
string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
|
||||||
|
|
||||||
if (OSPA_NAME_KEY == key)
|
if (OSPA_NAME_KEY == key)
|
||||||
return ResolveOspaName(value, commsManager);
|
return ResolveOspaName(value, userService);
|
||||||
}
|
}
|
||||||
|
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
|
@ -137,7 +138,7 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid
|
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid
|
||||||
/// </returns>
|
/// </returns>
|
||||||
protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager)
|
protected static UUID ResolveOspaName(string name, IUserAccountService userService)
|
||||||
{
|
{
|
||||||
int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
|
int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
|
||||||
|
|
||||||
|
@ -150,9 +151,9 @@ namespace OpenSim.Framework.Communications.Osp
|
||||||
string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
|
string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
|
||||||
string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
|
string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
|
||||||
|
|
||||||
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName);
|
||||||
if (userInfo != null)
|
if (account != null)
|
||||||
return userInfo.UserProfile.ID;
|
return account.PrincipalID;
|
||||||
|
|
||||||
// XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
|
// XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string killer = DeadAvatar.Scene.CommsManager.UUIDNameRequestString(part.OwnerID);
|
string killer = DeadAvatar.Scene.GetUserName(part.OwnerID);
|
||||||
DeadAvatar.ControllingClient.SendAgentAlertMessage("You impaled yourself on " + part.Name + " owned by " + killer +"!", true);
|
DeadAvatar.ControllingClient.SendAgentAlertMessage("You impaled yourself on " + part.Name + " owned by " + killer +"!", true);
|
||||||
}
|
}
|
||||||
//DeadAvatar.Scene. part.ObjectOwner
|
//DeadAvatar.Scene. part.ObjectOwner
|
||||||
|
|
|
@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// Don't use the item ID that's in the file
|
// Don't use the item ID that's in the file
|
||||||
item.ID = UUID.Random();
|
item.ID = UUID.Random();
|
||||||
|
|
||||||
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
|
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
|
||||||
if (UUID.Zero != ospResolvedId)
|
if (UUID.Zero != ospResolvedId)
|
||||||
{
|
{
|
||||||
item.CreatorIdAsUuid = ospResolvedId;
|
item.CreatorIdAsUuid = ospResolvedId;
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
|
||||||
|
|
||||||
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
|
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
|
||||||
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.CommsManager);
|
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.UserAccountService);
|
||||||
|
|
||||||
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
|
string serialization = UserInventoryItemSerializer.Serialize(saveItem);
|
||||||
m_archiveWriter.WriteFile(filename, serialization);
|
m_archiveWriter.WriteFile(filename, serialization);
|
||||||
|
|
|
@ -649,16 +649,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
lsri.TaskID = sog.UUID;
|
lsri.TaskID = sog.UUID;
|
||||||
lsri.TaskLocalID = sog.LocalId;
|
lsri.TaskLocalID = sog.LocalId;
|
||||||
lsri.TaskName = sog.GetPartName(obj);
|
lsri.TaskName = sog.GetPartName(obj);
|
||||||
if (m_scene.CommsManager.UUIDNameCachedTest(sog.OwnerID))
|
lsri.OwnerName = "waiting";
|
||||||
{
|
lock (uuidNameLookupList)
|
||||||
lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
|
uuidNameLookupList.Add(sog.OwnerID);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lsri.OwnerName = "waiting";
|
|
||||||
lock (uuidNameLookupList)
|
|
||||||
uuidNameLookupList.Add(sog.OwnerID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.Length != 0)
|
if (filter.Length != 0)
|
||||||
{
|
{
|
||||||
|
@ -709,7 +702,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
for (int i = 0; i < uuidarr.Length; i++)
|
for (int i = 0; i < uuidarr.Length; i++)
|
||||||
{
|
{
|
||||||
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
|
// string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
|
||||||
m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
|
m_scene.GetUserName(uuidarr[i]);
|
||||||
// we drop it. It gets cached though... so we're ready for the next request.
|
// we drop it. It gets cached though... so we're ready for the next request.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ using OpenMetaverse.Packets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
@ -415,7 +416,24 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
|
||||||
|
{
|
||||||
|
if (uuid == CommsManager.UserProfileCacheService.LibraryRoot.Owner)
|
||||||
|
{
|
||||||
|
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string[] names = GetUserNames(uuid);
|
||||||
|
if (names.Length == 2)
|
||||||
|
{
|
||||||
|
remote_client.SendNameReply(uuid, names[0], names[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle a fetch inventory request from the client
|
/// Handle a fetch inventory request from the client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -841,6 +841,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return m_simulatorVersion;
|
return m_simulatorVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] GetUserNames(UUID uuid)
|
||||||
|
{
|
||||||
|
string[] returnstring = new string[0];
|
||||||
|
|
||||||
|
UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid);
|
||||||
|
|
||||||
|
if (account != null)
|
||||||
|
{
|
||||||
|
returnstring = new string[2];
|
||||||
|
returnstring[0] = account.FirstName;
|
||||||
|
returnstring[1] = account.LastName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnstring;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetUserName(UUID uuid)
|
||||||
|
{
|
||||||
|
string[] names = GetUserNames(uuid);
|
||||||
|
if (names.Length == 2)
|
||||||
|
{
|
||||||
|
string firstname = names[0];
|
||||||
|
string lastname = names[1];
|
||||||
|
|
||||||
|
return firstname + " " + lastname;
|
||||||
|
|
||||||
|
}
|
||||||
|
return "(hippos)";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Another region is up.
|
/// Another region is up.
|
||||||
///
|
///
|
||||||
|
@ -2804,7 +2834,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual void SubscribeToClientGridEvents(IClientAPI client)
|
public virtual void SubscribeToClientGridEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
|
client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
|
||||||
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
|
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
|
||||||
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
|
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
|
||||||
client.OnSetStartLocationRequest += SetHomeRezPoint;
|
client.OnSetStartLocationRequest += SetHomeRezPoint;
|
||||||
|
@ -2959,7 +2989,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
|
public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
|
||||||
{
|
{
|
||||||
client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest;
|
client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
|
||||||
client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
|
client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
|
||||||
client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
|
client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
|
||||||
client.OnSetStartLocationRequest -= SetHomeRezPoint;
|
client.OnSetStartLocationRequest -= SetHomeRezPoint;
|
||||||
|
|
|
@ -29,6 +29,7 @@ using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -37,10 +38,17 @@ namespace OpenSim.Services.UserAccountService
|
||||||
{
|
{
|
||||||
public class UserAccountService : UserAccountServiceBase, IUserAccountService
|
public class UserAccountService : UserAccountServiceBase, IUserAccountService
|
||||||
{
|
{
|
||||||
public UserAccountService(IConfigSource config) : base(config)
|
public UserAccountService(IConfigSource config)
|
||||||
|
: base(config)
|
||||||
{
|
{
|
||||||
|
MainConsole.Instance.Commands.AddCommand("UserService", false,
|
||||||
|
"create user",
|
||||||
|
"create user [<first> [<last> [<pass> [<x> <y> [<email>]]]]]",
|
||||||
|
"Create a new user", HandleCreateUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IUserAccountService
|
||||||
|
|
||||||
public UserAccount GetUserAccount(UUID scopeID, string firstName,
|
public UserAccount GetUserAccount(UUID scopeID, string firstName,
|
||||||
string lastName)
|
string lastName)
|
||||||
{
|
{
|
||||||
|
@ -49,14 +57,14 @@ namespace OpenSim.Services.UserAccountService
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
{
|
{
|
||||||
d = m_Database.Get(
|
d = m_Database.Get(
|
||||||
new string[] {"ScopeID", "FirstName", "LastName"},
|
new string[] { "ScopeID", "FirstName", "LastName" },
|
||||||
new string[] {scopeID.ToString(), firstName, lastName});
|
new string[] { scopeID.ToString(), firstName, lastName });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d = m_Database.Get(
|
d = m_Database.Get(
|
||||||
new string[] {"FirstName", "LastName"},
|
new string[] { "FirstName", "LastName" },
|
||||||
new string[] {firstName, lastName});
|
new string[] { firstName, lastName });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.Length < 1)
|
if (d.Length < 1)
|
||||||
|
@ -75,12 +83,12 @@ namespace OpenSim.Services.UserAccountService
|
||||||
u.Email = d.Data["Email"].ToString();
|
u.Email = d.Data["Email"].ToString();
|
||||||
u.Created = Convert.ToInt32(d.Data["Created"].ToString());
|
u.Created = Convert.ToInt32(d.Data["Created"].ToString());
|
||||||
|
|
||||||
string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] {' '});
|
string[] URLs = d.Data["ServiceURLs"].ToString().Split(new char[] { ' ' });
|
||||||
u.ServiceURLs = new Dictionary<string, object>();
|
u.ServiceURLs = new Dictionary<string, object>();
|
||||||
|
|
||||||
foreach(string url in URLs)
|
foreach (string url in URLs)
|
||||||
{
|
{
|
||||||
string[] parts = url.Split(new char[] {'='});
|
string[] parts = url.Split(new char[] { '=' });
|
||||||
|
|
||||||
if (parts.Length != 2)
|
if (parts.Length != 2)
|
||||||
continue;
|
continue;
|
||||||
|
@ -101,14 +109,14 @@ namespace OpenSim.Services.UserAccountService
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
{
|
{
|
||||||
d = m_Database.Get(
|
d = m_Database.Get(
|
||||||
new string[] {"ScopeID", "Email"},
|
new string[] { "ScopeID", "Email" },
|
||||||
new string[] {scopeID.ToString(), email});
|
new string[] { scopeID.ToString(), email });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d = m_Database.Get(
|
d = m_Database.Get(
|
||||||
new string[] {"Email"},
|
new string[] { "Email" },
|
||||||
new string[] {email});
|
new string[] { email });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.Length < 1)
|
if (d.Length < 1)
|
||||||
|
@ -116,7 +124,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
|
|
||||||
return MakeUserAccount(d[0]);
|
return MakeUserAccount(d[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserAccount GetUserAccount(UUID scopeID, UUID principalID)
|
public UserAccount GetUserAccount(UUID scopeID, UUID principalID)
|
||||||
{
|
{
|
||||||
UserAccountData[] d;
|
UserAccountData[] d;
|
||||||
|
@ -124,14 +132,14 @@ namespace OpenSim.Services.UserAccountService
|
||||||
if (scopeID != UUID.Zero)
|
if (scopeID != UUID.Zero)
|
||||||
{
|
{
|
||||||
d = m_Database.Get(
|
d = m_Database.Get(
|
||||||
new string[] {"ScopeID", "PrincipalID"},
|
new string[] { "ScopeID", "PrincipalID" },
|
||||||
new string[] {scopeID.ToString(), principalID.ToString()});
|
new string[] { scopeID.ToString(), principalID.ToString() });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d = m_Database.Get(
|
d = m_Database.Get(
|
||||||
new string[] {"PrincipalID"},
|
new string[] { "PrincipalID" },
|
||||||
new string[] {principalID.ToString()});
|
new string[] { principalID.ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.Length < 1)
|
if (d.Length < 1)
|
||||||
|
@ -148,13 +156,13 @@ namespace OpenSim.Services.UserAccountService
|
||||||
d.LastName = data.LastName;
|
d.LastName = data.LastName;
|
||||||
d.PrincipalID = data.PrincipalID;
|
d.PrincipalID = data.PrincipalID;
|
||||||
d.ScopeID = data.ScopeID;
|
d.ScopeID = data.ScopeID;
|
||||||
d.Data = new Dictionary<string,string>();
|
d.Data = new Dictionary<string, string>();
|
||||||
d.Data["Email"] = data.Email;
|
d.Data["Email"] = data.Email;
|
||||||
d.Data["Created"] = data.Created.ToString();
|
d.Data["Created"] = data.Created.ToString();
|
||||||
|
|
||||||
List<string> parts = new List<string>();
|
List<string> parts = new List<string>();
|
||||||
|
|
||||||
foreach (KeyValuePair<string,object> kvp in data.ServiceURLs)
|
foreach (KeyValuePair<string, object> kvp in data.ServiceURLs)
|
||||||
{
|
{
|
||||||
string key = System.Web.HttpUtility.UrlEncode(kvp.Key);
|
string key = System.Web.HttpUtility.UrlEncode(kvp.Key);
|
||||||
string val = System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
|
string val = System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
|
||||||
|
@ -180,5 +188,66 @@ namespace OpenSim.Services.UserAccountService
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Console commands
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
|
||||||
|
protected void HandleCreateUser(string module, string[] cmdparams)
|
||||||
|
{
|
||||||
|
string firstName;
|
||||||
|
string lastName;
|
||||||
|
string password;
|
||||||
|
string email;
|
||||||
|
uint regX = 1000;
|
||||||
|
uint regY = 1000;
|
||||||
|
|
||||||
|
// IConfig standalone;
|
||||||
|
// if ((standalone = m_config.Source.Configs["StandAlone"]) != null)
|
||||||
|
// {
|
||||||
|
// regX = (uint)standalone.GetInt("default_location_x", (int)regX);
|
||||||
|
// regY = (uint)standalone.GetInt("default_location_y", (int)regY);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// if (cmdparams.Length < 3)
|
||||||
|
// firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
||||||
|
// else firstName = cmdparams[2];
|
||||||
|
|
||||||
|
// if (cmdparams.Length < 4)
|
||||||
|
// lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
||||||
|
// else lastName = cmdparams[3];
|
||||||
|
|
||||||
|
// if (cmdparams.Length < 5)
|
||||||
|
// password = MainConsole.Instance.PasswdPrompt("Password");
|
||||||
|
// else password = cmdparams[4];
|
||||||
|
|
||||||
|
// if (cmdparams.Length < 6)
|
||||||
|
// regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", regX.ToString()));
|
||||||
|
// else regX = Convert.ToUInt32(cmdparams[5]);
|
||||||
|
|
||||||
|
// if (cmdparams.Length < 7)
|
||||||
|
// regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", regY.ToString()));
|
||||||
|
// else regY = Convert.ToUInt32(cmdparams[6]);
|
||||||
|
|
||||||
|
// if (cmdparams.Length < 8)
|
||||||
|
// email = MainConsole.Instance.CmdPrompt("Email", "");
|
||||||
|
// else email = cmdparams[7];
|
||||||
|
|
||||||
|
// if (null == m_commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName))
|
||||||
|
// {
|
||||||
|
// m_commsManager.UserAdminService.AddUser(firstName, lastName, password, email, regX, regY);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// m_log.ErrorFormat("[CONSOLE]: A user with the name {0} {1} already exists!", firstName, lastName);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue