Inching ahead... This compiles, but very likely does not run.
parent
f11a97f12d
commit
b63405c1a7
|
@ -85,10 +85,6 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
||||||
MainServer.Instance = m_httpServer;
|
MainServer.Instance = m_httpServer;
|
||||||
|
|
||||||
InitialiseCommsManager(openSim);
|
InitialiseCommsManager(openSim);
|
||||||
if (m_commsManager != null)
|
|
||||||
{
|
|
||||||
m_openSim.ApplicationRegistry.RegisterInterface<IUserService>(m_commsManager.UserService);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -107,10 +103,6 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
||||||
|
|
||||||
private void RegionCreated(IScene scene)
|
private void RegionCreated(IScene scene)
|
||||||
{
|
{
|
||||||
if (m_commsManager != null)
|
|
||||||
{
|
|
||||||
scene.RegisterModuleInterface<IUserService>(m_commsManager.UserService);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void InitialiseCommsManager(OpenSimBase openSim)
|
protected void InitialiseCommsManager(OpenSimBase openSim)
|
||||||
|
|
|
@ -49,6 +49,8 @@ using OpenSim.Region.CoreModules.World.Terrain;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.ApplicationPlugins.RemoteController
|
namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
|
@ -1032,30 +1034,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
if (requestData.Contains("user_email"))
|
if (requestData.Contains("user_email"))
|
||||||
email = (string)requestData["user_email"];
|
email = (string)requestData["user_email"];
|
||||||
|
|
||||||
CachedUserInfo userInfo =
|
UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||||
m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
|
|
||||||
|
|
||||||
if (null != userInfo)
|
UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
|
||||||
throw new Exception(String.Format("Avatar {0} {1} already exists", firstname, lastname));
|
|
||||||
|
|
||||||
UUID userID =
|
if (null != account)
|
||||||
m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname,
|
throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname));
|
||||||
passwd, email, regX, regY);
|
|
||||||
|
|
||||||
if (userID == UUID.Zero)
|
account = new UserAccount(scopeID, firstname, lastname, email);
|
||||||
|
// REFACTORING PROBLEM: no method to set the password!
|
||||||
|
|
||||||
|
bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
|
||||||
|
|
||||||
|
if (!success)
|
||||||
throw new Exception(String.Format("failed to create new user {0} {1}",
|
throw new Exception(String.Format("failed to create new user {0} {1}",
|
||||||
firstname, lastname));
|
firstname, lastname));
|
||||||
|
|
||||||
|
GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
|
||||||
|
(int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
|
||||||
|
if (home == null)
|
||||||
|
m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname);
|
||||||
|
|
||||||
// Establish the avatar's initial appearance
|
// Establish the avatar's initial appearance
|
||||||
|
|
||||||
updateUserAppearance(responseData, requestData, userID);
|
updateUserAppearance(responseData, requestData, account.PrincipalID);
|
||||||
|
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
responseData["avatar_uuid"] = userID.ToString();
|
responseData["avatar_uuid"] = account.PrincipalID.ToString();
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
|
||||||
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
|
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1124,21 +1133,27 @@ 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"];
|
||||||
|
|
||||||
CachedUserInfo userInfo
|
|
||||||
= m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
|
|
||||||
|
|
||||||
responseData["user_firstname"] = firstname;
|
responseData["user_firstname"] = firstname;
|
||||||
responseData["user_lastname"] = lastname;
|
responseData["user_lastname"] = lastname;
|
||||||
|
|
||||||
if (null == userInfo)
|
UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||||
|
|
||||||
|
UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
|
||||||
|
|
||||||
|
if (null == account)
|
||||||
{
|
{
|
||||||
responseData["success"] = false;
|
responseData["success"] = false;
|
||||||
responseData["lastlogin"] = 0;
|
responseData["lastlogin"] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() });
|
||||||
|
if (pinfos != null && pinfos.Length >= 1)
|
||||||
|
responseData["lastlogin"] = pinfos[0].Login;
|
||||||
|
else
|
||||||
|
responseData["lastlogin"] = 0;
|
||||||
|
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
responseData["lastlogin"] = userInfo.UserProfile.LastLogin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
@ -1200,117 +1215,118 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
m_log.Info("[RADMIN]: UpdateUserAccount: new request");
|
m_log.Info("[RADMIN]: UpdateUserAccount: new request");
|
||||||
|
m_log.Warn("[RADMIN]: This method needs update for 0.7");
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
Hashtable responseData = new Hashtable();
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
lock (rslock)
|
//lock (rslock)
|
||||||
{
|
//{
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
Hashtable requestData = (Hashtable) request.Params[0];
|
// Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
// check completeness
|
// // check completeness
|
||||||
checkStringParameters(request, new string[] {
|
// checkStringParameters(request, new string[] {
|
||||||
"password", "user_firstname",
|
// "password", "user_firstname",
|
||||||
"user_lastname"});
|
// "user_lastname"});
|
||||||
|
|
||||||
// check password
|
// // check password
|
||||||
if (!String.IsNullOrEmpty(m_requiredPassword) &&
|
// if (!String.IsNullOrEmpty(m_requiredPassword) &&
|
||||||
(string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
|
// (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
|
||||||
|
|
||||||
// do the job
|
// // do the job
|
||||||
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.Empty;
|
// string passwd = String.Empty;
|
||||||
uint? regX = null;
|
// uint? regX = null;
|
||||||
uint? regY = null;
|
// uint? regY = null;
|
||||||
uint? ulaX = null;
|
// uint? ulaX = null;
|
||||||
uint? ulaY = null;
|
// uint? ulaY = null;
|
||||||
uint? ulaZ = null;
|
// uint? ulaZ = null;
|
||||||
uint? usaX = null;
|
// uint? usaX = null;
|
||||||
uint? usaY = null;
|
// uint? usaY = null;
|
||||||
uint? usaZ = null;
|
// uint? usaZ = null;
|
||||||
string aboutFirstLive = String.Empty;
|
// string aboutFirstLive = String.Empty;
|
||||||
string aboutAvatar = String.Empty;
|
// string aboutAvatar = String.Empty;
|
||||||
|
|
||||||
if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
|
// if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
|
||||||
if (requestData.ContainsKey("start_region_x"))
|
// if (requestData.ContainsKey("start_region_x"))
|
||||||
regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
|
// regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
|
||||||
if (requestData.ContainsKey("start_region_y"))
|
// if (requestData.ContainsKey("start_region_y"))
|
||||||
regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
|
// regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
|
||||||
|
|
||||||
if (requestData.ContainsKey("start_lookat_x"))
|
// if (requestData.ContainsKey("start_lookat_x"))
|
||||||
ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
|
// ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
|
||||||
if (requestData.ContainsKey("start_lookat_y"))
|
// if (requestData.ContainsKey("start_lookat_y"))
|
||||||
ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
|
// ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
|
||||||
if (requestData.ContainsKey("start_lookat_z"))
|
// if (requestData.ContainsKey("start_lookat_z"))
|
||||||
ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
|
// ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
|
||||||
|
|
||||||
if (requestData.ContainsKey("start_standat_x"))
|
// if (requestData.ContainsKey("start_standat_x"))
|
||||||
usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
|
// usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
|
||||||
if (requestData.ContainsKey("start_standat_y"))
|
// if (requestData.ContainsKey("start_standat_y"))
|
||||||
usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
|
// usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
|
||||||
if (requestData.ContainsKey("start_standat_z"))
|
// if (requestData.ContainsKey("start_standat_z"))
|
||||||
usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
|
// usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
|
||||||
if (requestData.ContainsKey("about_real_world"))
|
// if (requestData.ContainsKey("about_real_world"))
|
||||||
aboutFirstLive = (string)requestData["about_real_world"];
|
// aboutFirstLive = (string)requestData["about_real_world"];
|
||||||
if (requestData.ContainsKey("about_virtual_world"))
|
// if (requestData.ContainsKey("about_virtual_world"))
|
||||||
aboutAvatar = (string)requestData["about_virtual_world"];
|
// aboutAvatar = (string)requestData["about_virtual_world"];
|
||||||
|
|
||||||
UserProfileData userProfile
|
// UserProfileData userProfile
|
||||||
= m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
// = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
||||||
|
|
||||||
if (null == userProfile)
|
// if (null == userProfile)
|
||||||
throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
|
// throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(passwd))
|
// if (!String.IsNullOrEmpty(passwd))
|
||||||
{
|
// {
|
||||||
m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname);
|
// m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname);
|
||||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
|
// string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
|
||||||
userProfile.PasswordHash = md5PasswdHash;
|
// userProfile.PasswordHash = md5PasswdHash;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (null != regX) userProfile.HomeRegionX = (uint) regX;
|
// if (null != regX) userProfile.HomeRegionX = (uint) regX;
|
||||||
if (null != regY) userProfile.HomeRegionY = (uint) regY;
|
// if (null != regY) userProfile.HomeRegionY = (uint) regY;
|
||||||
|
|
||||||
if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
|
// if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
|
||||||
if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
|
// if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
|
||||||
if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
|
// if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
|
||||||
|
|
||||||
if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
|
// if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
|
||||||
if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
|
// if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
|
||||||
if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
|
// if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
|
||||||
|
|
||||||
if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
|
// if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
|
||||||
if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
|
// if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
|
||||||
|
|
||||||
// User has been created. Now establish gender and appearance.
|
// // User has been created. Now establish gender and appearance.
|
||||||
|
|
||||||
updateUserAppearance(responseData, requestData, userProfile.ID);
|
// updateUserAppearance(responseData, requestData, userProfile.ID);
|
||||||
|
|
||||||
if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
|
// if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
|
||||||
throw new Exception("did not manage to update user profile");
|
// throw new Exception("did not manage to update user profile");
|
||||||
|
|
||||||
responseData["success"] = true;
|
// responseData["success"] = true;
|
||||||
|
|
||||||
response.Value = responseData;
|
// response.Value = responseData;
|
||||||
|
|
||||||
m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
|
// m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
|
||||||
firstname, lastname,
|
// firstname, lastname,
|
||||||
userProfile.ID);
|
// userProfile.ID);
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
|
// m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
|
// m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
|
||||||
|
|
||||||
responseData["success"] = false;
|
// responseData["success"] = false;
|
||||||
responseData["error"] = e.Message;
|
// responseData["error"] = e.Message;
|
||||||
|
|
||||||
response.Value = responseData;
|
// response.Value = responseData;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
|
m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
|
||||||
return response;
|
return response;
|
||||||
|
@ -1327,72 +1343,73 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
|
private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[RADMIN] updateUserAppearance");
|
m_log.DebugFormat("[RADMIN] updateUserAppearance");
|
||||||
|
m_log.Warn("[RADMIN]: This method needs update for 0.7");
|
||||||
|
|
||||||
string dmale = m_config.GetString("default_male", "Default Male");
|
//string dmale = m_config.GetString("default_male", "Default Male");
|
||||||
string dfemale = m_config.GetString("default_female", "Default Female");
|
//string dfemale = m_config.GetString("default_female", "Default Female");
|
||||||
string dneut = m_config.GetString("default_female", "Default Default");
|
//string dneut = m_config.GetString("default_female", "Default Default");
|
||||||
string model = String.Empty;
|
string model = String.Empty;
|
||||||
|
|
||||||
// Has a gender preference been supplied?
|
//// Has a gender preference been supplied?
|
||||||
|
|
||||||
if (requestData.Contains("gender"))
|
//if (requestData.Contains("gender"))
|
||||||
{
|
//{
|
||||||
switch ((string)requestData["gender"])
|
// switch ((string)requestData["gender"])
|
||||||
{
|
// {
|
||||||
case "m" :
|
// case "m" :
|
||||||
model = dmale;
|
// model = dmale;
|
||||||
break;
|
// break;
|
||||||
case "f" :
|
// case "f" :
|
||||||
model = dfemale;
|
// model = dfemale;
|
||||||
break;
|
// break;
|
||||||
case "n" :
|
// case "n" :
|
||||||
default :
|
// default :
|
||||||
model = dneut;
|
// model = dneut;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Has an explicit model been specified?
|
//// Has an explicit model been specified?
|
||||||
|
|
||||||
if (requestData.Contains("model"))
|
//if (requestData.Contains("model"))
|
||||||
{
|
//{
|
||||||
model = (string)requestData["model"];
|
// model = (string)requestData["model"];
|
||||||
}
|
//}
|
||||||
|
|
||||||
// No appearance attributes were set
|
//// No appearance attributes were set
|
||||||
|
|
||||||
if (model == String.Empty)
|
//if (model == String.Empty)
|
||||||
{
|
//{
|
||||||
m_log.DebugFormat("[RADMIN] Appearance update not requested");
|
// m_log.DebugFormat("[RADMIN] Appearance update not requested");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model);
|
//m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model);
|
||||||
|
|
||||||
string[] nomens = model.Split();
|
//string[] nomens = model.Split();
|
||||||
if (nomens.Length != 2)
|
//if (nomens.Length != 2)
|
||||||
{
|
//{
|
||||||
m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
|
// m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
|
||||||
// nomens = dmodel.Split();
|
// // nomens = dmodel.Split();
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]);
|
//UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]);
|
||||||
|
|
||||||
// Is this the first time one of the default models has been used? Create it if that is the case
|
//// Is this the first time one of the default models has been used? Create it if that is the case
|
||||||
// otherwise default to male.
|
//// otherwise default to male.
|
||||||
|
|
||||||
if (mprof == null)
|
//if (mprof == null)
|
||||||
{
|
//{
|
||||||
m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
|
// m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Set current user's appearance. This bit is easy. The appearance structure is populated with
|
//// Set current user's appearance. This bit is easy. The appearance structure is populated with
|
||||||
// actual asset ids, however to complete the magic we need to populate the inventory with the
|
//// actual asset ids, however to complete the magic we need to populate the inventory with the
|
||||||
// assets in question.
|
//// assets in question.
|
||||||
|
|
||||||
establishAppearance(userid, mprof.ID);
|
//establishAppearance(userid, mprof.ID);
|
||||||
|
|
||||||
m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
|
m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
|
||||||
userid, model);
|
userid, model);
|
||||||
|
@ -1604,20 +1621,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
passwd = GetStringAttribute(avatar,"password",passwd);
|
passwd = GetStringAttribute(avatar,"password",passwd);
|
||||||
|
|
||||||
string[] nomens = name.Split();
|
string[] nomens = name.Split();
|
||||||
UI = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(nomens[0], nomens[1]);
|
UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||||
if (null == UI)
|
UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]);
|
||||||
|
if (null == account)
|
||||||
{
|
{
|
||||||
ID = m_app.CommunicationsManager.UserAdminService.AddUser(nomens[0], nomens[1],
|
account = new UserAccount(scopeID, nomens[0], nomens[1], email);
|
||||||
passwd, email, regX, regY);
|
bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
|
||||||
if (ID == UUID.Zero)
|
if (!success)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]);
|
m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// !!! REFACTORING PROBLEM: need to set the password
|
||||||
|
|
||||||
|
GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
|
||||||
|
(int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
|
||||||
|
if (home != null)
|
||||||
|
m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ID = UI.UserProfile.ID;
|
ID = account.PrincipalID;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
|
m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
|
||||||
|
@ -2391,17 +2415,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
if (requestData.Contains("users"))
|
if (requestData.Contains("users"))
|
||||||
{
|
{
|
||||||
UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
|
UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||||
|
IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
|
||||||
Scene s = m_app.SceneManager.CurrentScene;
|
Scene s = m_app.SceneManager.CurrentScene;
|
||||||
Hashtable users = (Hashtable) requestData["users"];
|
Hashtable users = (Hashtable) requestData["users"];
|
||||||
List<UUID> uuids = new List<UUID>();
|
List<UUID> uuids = new List<UUID>();
|
||||||
foreach (string name in users.Values)
|
foreach (string name in users.Values)
|
||||||
{
|
{
|
||||||
string[] parts = name.Split();
|
string[] parts = name.Split();
|
||||||
CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]);
|
UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
|
||||||
if (udata != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
uuids.Add(udata.UserProfile.ID);
|
uuids.Add(account.PrincipalID);
|
||||||
m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName);
|
m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2477,17 +2502,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
if (requestData.Contains("users"))
|
if (requestData.Contains("users"))
|
||||||
{
|
{
|
||||||
UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
|
UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
|
||||||
|
IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
|
||||||
|
//UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
|
||||||
Scene s = m_app.SceneManager.CurrentScene;
|
Scene s = m_app.SceneManager.CurrentScene;
|
||||||
Hashtable users = (Hashtable) requestData["users"];
|
Hashtable users = (Hashtable) requestData["users"];
|
||||||
List<UUID> uuids = new List<UUID>();
|
List<UUID> uuids = new List<UUID>();
|
||||||
foreach (string name in users.Values)
|
foreach (string name in users.Values)
|
||||||
{
|
{
|
||||||
string[] parts = name.Split();
|
string[] parts = name.Split();
|
||||||
CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]);
|
UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
|
||||||
if (udata != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
uuids.Add(udata.UserProfile.ID);
|
uuids.Add(account.PrincipalID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess);
|
List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess);
|
||||||
|
|
|
@ -35,6 +35,9 @@ using System.Xml;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
|
@ -658,7 +661,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
{
|
{
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
string HA1;
|
|
||||||
string first;
|
string first;
|
||||||
string last;
|
string last;
|
||||||
|
|
||||||
|
@ -675,17 +677,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
last = String.Empty;
|
last = String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserProfileData udata = Rest.UserServices.GetUserProfile(first, last);
|
UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
|
||||||
|
|
||||||
// If we don't recognize the user id, perhaps it is god?
|
// If we don't recognize the user id, perhaps it is god?
|
||||||
|
if (account == null)
|
||||||
if (udata == null)
|
|
||||||
return pass == Rest.GodKey;
|
return pass == Rest.GodKey;
|
||||||
|
|
||||||
HA1 = HashToString(pass);
|
return (Rest.AuthServices.Authenticate(account.PrincipalID, pass, 1) != string.Empty);
|
||||||
HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
|
|
||||||
|
|
||||||
return (0 == sc.Compare(HA1, udata.PasswordHash));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,11 +895,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
last = String.Empty;
|
last = String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserProfileData udata = Rest.UserServices.GetUserProfile(first, last);
|
UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
|
||||||
|
|
||||||
// If we don;t recognize the user id, perhaps it is god?
|
// If we don;t recognize the user id, perhaps it is god?
|
||||||
|
|
||||||
if (udata == null)
|
if (account == null)
|
||||||
{
|
{
|
||||||
Rest.Log.DebugFormat("{0} Administrator", MsgId);
|
Rest.Log.DebugFormat("{0} Administrator", MsgId);
|
||||||
return Rest.GodKey;
|
return Rest.GodKey;
|
||||||
|
@ -909,7 +906,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
|
Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
|
||||||
return udata.PasswordHash;
|
|
||||||
|
// !!! REFACTORING PROBLEM
|
||||||
|
// This is what it was. It doesn't work in 0.7
|
||||||
|
// Nothing retrieves the password from the authentication service, there's only authentication.
|
||||||
|
//return udata.PasswordHash;
|
||||||
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,9 +103,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
|
get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IUserService UserServices
|
internal static IUserAccountService UserServices
|
||||||
{
|
{
|
||||||
get { return Comms.UserService; }
|
get { return main.SceneManager.CurrentOrFirstScene.UserAccountService; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static IAuthenticationService AuthServices
|
||||||
|
{
|
||||||
|
get { return main.SceneManager.CurrentOrFirstScene.AuthenticationService; }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IAvatarService AvatarServices
|
internal static IAvatarService AvatarServices
|
||||||
|
|
|
@ -135,152 +135,153 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
private void DoAppearance(RequestData hdata)
|
private void DoAppearance(RequestData hdata)
|
||||||
{
|
{
|
||||||
|
// !!! REFACTORIMG PROBLEM. This needs rewriting for 0.7
|
||||||
|
|
||||||
AppearanceRequestData rdata = (AppearanceRequestData) hdata;
|
//AppearanceRequestData rdata = (AppearanceRequestData) hdata;
|
||||||
|
|
||||||
Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId);
|
//Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId);
|
||||||
|
|
||||||
// If we're disabled, do nothing.
|
//// If we're disabled, do nothing.
|
||||||
|
|
||||||
if (!enabled)
|
//if (!enabled)
|
||||||
{
|
//{
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Now that we know this is a serious attempt to
|
//// Now that we know this is a serious attempt to
|
||||||
// access inventory data, we should find out who
|
//// access inventory data, we should find out who
|
||||||
// is asking, and make sure they are authorized
|
//// is asking, and make sure they are authorized
|
||||||
// to do so. We need to validate the caller's
|
//// to do so. We need to validate the caller's
|
||||||
// identity before revealing anything about the
|
//// identity before revealing anything about the
|
||||||
// status quo. Authenticate throws an exception
|
//// status quo. Authenticate throws an exception
|
||||||
// via Fail if no identity information is present.
|
//// via Fail if no identity information is present.
|
||||||
//
|
////
|
||||||
// With the present HTTP server we can't use the
|
//// With the present HTTP server we can't use the
|
||||||
// builtin authentication mechanisms because they
|
//// builtin authentication mechanisms because they
|
||||||
// would be enforced for all in-bound requests.
|
//// would be enforced for all in-bound requests.
|
||||||
// Instead we look at the headers ourselves and
|
//// Instead we look at the headers ourselves and
|
||||||
// handle authentication directly.
|
//// handle authentication directly.
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
if (!rdata.IsAuthenticated)
|
// if (!rdata.IsAuthenticated)
|
||||||
{
|
// {
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
// rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
catch (RestException e)
|
//catch (RestException e)
|
||||||
{
|
//{
|
||||||
if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
|
// if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
|
||||||
{
|
// {
|
||||||
Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
|
// Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
|
||||||
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
// Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
|
// Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
|
||||||
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
// Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||||
}
|
// }
|
||||||
throw (e);
|
// throw (e);
|
||||||
}
|
//}
|
||||||
|
|
||||||
Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
|
//Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
|
||||||
|
|
||||||
// We can only get here if we are authorized
|
//// We can only get here if we are authorized
|
||||||
//
|
////
|
||||||
// The requestor may have specified an UUID or
|
//// The requestor may have specified an UUID or
|
||||||
// a conjoined FirstName LastName string. We'll
|
//// a conjoined FirstName LastName string. We'll
|
||||||
// try both. If we fail with the first, UUID,
|
//// try both. If we fail with the first, UUID,
|
||||||
// attempt, we try the other. As an example, the
|
//// attempt, we try the other. As an example, the
|
||||||
// URI for a valid inventory request might be:
|
//// URI for a valid inventory request might be:
|
||||||
//
|
////
|
||||||
// http://<host>:<port>/admin/inventory/Arthur Dent
|
//// http://<host>:<port>/admin/inventory/Arthur Dent
|
||||||
//
|
////
|
||||||
// Indicating that this is an inventory request for
|
//// Indicating that this is an inventory request for
|
||||||
// an avatar named Arthur Dent. This is ALL that is
|
//// an avatar named Arthur Dent. This is ALL that is
|
||||||
// required to designate a GET for an entire
|
//// required to designate a GET for an entire
|
||||||
// inventory.
|
//// inventory.
|
||||||
//
|
////
|
||||||
|
|
||||||
// Do we have at least a user agent name?
|
//// Do we have at least a user agent name?
|
||||||
|
|
||||||
if (rdata.Parameters.Length < 1)
|
//if (rdata.Parameters.Length < 1)
|
||||||
{
|
//{
|
||||||
Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId);
|
// Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId);
|
||||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
|
// rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
|
||||||
}
|
//}
|
||||||
|
|
||||||
// The first parameter MUST be the agent identification, either an UUID
|
//// The first parameter MUST be the agent identification, either an UUID
|
||||||
// or a space-separated First-name Last-Name specification. We check for
|
//// or a space-separated First-name Last-Name specification. We check for
|
||||||
// an UUID first, if anyone names their character using a valid UUID
|
//// an UUID first, if anyone names their character using a valid UUID
|
||||||
// that identifies another existing avatar will cause this a problem...
|
//// that identifies another existing avatar will cause this a problem...
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
|
// rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
|
||||||
Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
|
// Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
|
||||||
rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
|
// rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
|
||||||
}
|
//}
|
||||||
catch
|
//catch
|
||||||
{
|
//{
|
||||||
string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
|
// string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
|
||||||
if (names.Length == 2)
|
// if (names.Length == 2)
|
||||||
{
|
// {
|
||||||
Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
|
// Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
|
||||||
rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
|
// rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
|
// Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
|
||||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
|
// rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// If the user profile is null then either the server is broken, or the
|
//// If the user profile is null then either the server is broken, or the
|
||||||
// user is not known. We always assume the latter case.
|
//// user is not known. We always assume the latter case.
|
||||||
|
|
||||||
if (rdata.userProfile != null)
|
//if (rdata.userProfile != null)
|
||||||
{
|
//{
|
||||||
Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}",
|
// Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path);
|
// Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path);
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
|
// rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
|
||||||
}
|
//}
|
||||||
|
|
||||||
// If we get to here, then we have effectively validated the user's
|
//// If we get to here, then we have effectively validated the user's
|
||||||
|
|
||||||
switch (rdata.method)
|
//switch (rdata.method)
|
||||||
{
|
//{
|
||||||
case Rest.HEAD : // Do the processing, set the status code, suppress entity
|
// case Rest.HEAD : // Do the processing, set the status code, suppress entity
|
||||||
DoGet(rdata);
|
// DoGet(rdata);
|
||||||
rdata.buffer = null;
|
// rdata.buffer = null;
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.GET : // Do the processing, set the status code, return entity
|
// case Rest.GET : // Do the processing, set the status code, return entity
|
||||||
DoGet(rdata);
|
// DoGet(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.PUT : // Update named element
|
// case Rest.PUT : // Update named element
|
||||||
DoUpdate(rdata);
|
// DoUpdate(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.POST : // Add new information to identified context.
|
// case Rest.POST : // Add new information to identified context.
|
||||||
DoExtend(rdata);
|
// DoExtend(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.DELETE : // Delete information
|
// case Rest.DELETE : // Delete information
|
||||||
DoDelete(rdata);
|
// DoDelete(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default :
|
// default :
|
||||||
Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
|
// Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
|
||||||
MsgId, rdata.method, rdata.path);
|
// MsgId, rdata.method, rdata.path);
|
||||||
rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
|
// rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
|
||||||
String.Format("{0} not supported", rdata.method));
|
// String.Format("{0} not supported", rdata.method));
|
||||||
break;
|
// break;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Interface
|
#endregion Interface
|
||||||
|
@ -391,37 +392,39 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
private void DoUpdate(AppearanceRequestData rdata)
|
private void DoUpdate(AppearanceRequestData rdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool created = false;
|
// REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
|
||||||
bool modified = false;
|
|
||||||
|
//bool created = false;
|
||||||
|
//bool modified = false;
|
||||||
|
|
||||||
|
|
||||||
rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
//rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
|
||||||
|
|
||||||
// If the user exists then this is considered a modification regardless
|
//// If the user exists then this is considered a modification regardless
|
||||||
// of what may, or may not be, specified in the payload.
|
//// of what may, or may not be, specified in the payload.
|
||||||
|
|
||||||
if (rdata.userAppearance != null)
|
//if (rdata.userAppearance != null)
|
||||||
{
|
//{
|
||||||
modified = true;
|
// modified = true;
|
||||||
Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
// Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
|
||||||
Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
// Rest.UserServices.UpdateUserProfile(rdata.userProfile);
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (created)
|
//if (created)
|
||||||
{
|
//{
|
||||||
rdata.Complete(Rest.HttpStatusCodeCreated);
|
// rdata.Complete(Rest.HttpStatusCodeCreated);
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
if (modified)
|
// if (modified)
|
||||||
{
|
// {
|
||||||
rdata.Complete(Rest.HttpStatusCodeOK);
|
// rdata.Complete(Rest.HttpStatusCodeOK);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
rdata.Complete(Rest.HttpStatusCodeNoContent);
|
// rdata.Complete(Rest.HttpStatusCodeNoContent);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
|
||||||
|
|
||||||
|
|
|
@ -143,203 +143,205 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||||
|
|
||||||
Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId);
|
Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId);
|
||||||
|
|
||||||
// If we're disabled, do nothing.
|
// !!! REFACTORING PROBLEM
|
||||||
|
|
||||||
if (!enabled)
|
//// If we're disabled, do nothing.
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now that we know this is a serious attempt to
|
//if (!enabled)
|
||||||
// access inventory data, we should find out who
|
//{
|
||||||
// is asking, and make sure they are authorized
|
// return;
|
||||||
// to do so. We need to validate the caller's
|
//}
|
||||||
// identity before revealing anything about the
|
|
||||||
// status quo. Authenticate throws an exception
|
|
||||||
// via Fail if no identity information is present.
|
|
||||||
//
|
|
||||||
// With the present HTTP server we can't use the
|
|
||||||
// builtin authentication mechanisms because they
|
|
||||||
// would be enforced for all in-bound requests.
|
|
||||||
// Instead we look at the headers ourselves and
|
|
||||||
// handle authentication directly.
|
|
||||||
|
|
||||||
try
|
//// Now that we know this is a serious attempt to
|
||||||
{
|
//// access inventory data, we should find out who
|
||||||
if (!rdata.IsAuthenticated)
|
//// is asking, and make sure they are authorized
|
||||||
{
|
//// to do so. We need to validate the caller's
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
//// identity before revealing anything about the
|
||||||
}
|
//// status quo. Authenticate throws an exception
|
||||||
}
|
//// via Fail if no identity information is present.
|
||||||
catch (RestException e)
|
////
|
||||||
{
|
//// With the present HTTP server we can't use the
|
||||||
if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
|
//// builtin authentication mechanisms because they
|
||||||
{
|
//// would be enforced for all in-bound requests.
|
||||||
Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
|
//// Instead we look at the headers ourselves and
|
||||||
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
//// handle authentication directly.
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
|
|
||||||
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
|
||||||
}
|
|
||||||
throw (e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
|
//try
|
||||||
|
//{
|
||||||
|
// if (!rdata.IsAuthenticated)
|
||||||
|
// {
|
||||||
|
// rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//catch (RestException e)
|
||||||
|
//{
|
||||||
|
// if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
|
||||||
|
// {
|
||||||
|
// Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
|
||||||
|
// Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
|
||||||
|
// Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
|
||||||
|
// }
|
||||||
|
// throw (e);
|
||||||
|
//}
|
||||||
|
|
||||||
// We can only get here if we are authorized
|
//Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
|
||||||
//
|
|
||||||
// The requestor may have specified an UUID or
|
//// We can only get here if we are authorized
|
||||||
// a conjoined FirstName LastName string. We'll
|
////
|
||||||
// try both. If we fail with the first, UUID,
|
//// The requestor may have specified an UUID or
|
||||||
// attempt, we try the other. As an example, the
|
//// a conjoined FirstName LastName string. We'll
|
||||||
// URI for a valid inventory request might be:
|
//// try both. If we fail with the first, UUID,
|
||||||
//
|
//// attempt, we try the other. As an example, the
|
||||||
// http://<host>:<port>/admin/inventory/Arthur Dent
|
//// URI for a valid inventory request might be:
|
||||||
//
|
////
|
||||||
// Indicating that this is an inventory request for
|
//// http://<host>:<port>/admin/inventory/Arthur Dent
|
||||||
// an avatar named Arthur Dent. This is ALL that is
|
////
|
||||||
// required to designate a GET for an entire
|
//// Indicating that this is an inventory request for
|
||||||
// inventory.
|
//// an avatar named Arthur Dent. This is ALL that is
|
||||||
//
|
//// required to designate a GET for an entire
|
||||||
|
//// inventory.
|
||||||
|
////
|
||||||
|
|
||||||
|
|
||||||
// Do we have at least a user agent name?
|
//// Do we have at least a user agent name?
|
||||||
|
|
||||||
if (rdata.Parameters.Length < 1)
|
//if (rdata.Parameters.Length < 1)
|
||||||
{
|
//{
|
||||||
Rest.Log.WarnFormat("{0} Inventory: No user agent identifier specified", MsgId);
|
// Rest.Log.WarnFormat("{0} Inventory: No user agent identifier specified", MsgId);
|
||||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
|
// rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
|
||||||
}
|
//}
|
||||||
|
|
||||||
// The first parameter MUST be the agent identification, either an UUID
|
//// The first parameter MUST be the agent identification, either an UUID
|
||||||
// or a space-separated First-name Last-Name specification. We check for
|
//// or a space-separated First-name Last-Name specification. We check for
|
||||||
// an UUID first, if anyone names their character using a valid UUID
|
//// an UUID first, if anyone names their character using a valid UUID
|
||||||
// that identifies another existing avatar will cause this a problem...
|
//// that identifies another existing avatar will cause this a problem...
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
|
// rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
|
||||||
Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
|
// Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
|
||||||
rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
|
// rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
|
||||||
}
|
//}
|
||||||
catch
|
//catch
|
||||||
{
|
//{
|
||||||
string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
|
// string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
|
||||||
if (names.Length == 2)
|
// if (names.Length == 2)
|
||||||
{
|
// {
|
||||||
Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
|
// Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
|
||||||
rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
|
// rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
|
// Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
|
||||||
rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
|
// rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// If the user profile is null then either the server is broken, or the
|
//// If the user profile is null then either the server is broken, or the
|
||||||
// user is not known. We always assume the latter case.
|
//// user is not known. We always assume the latter case.
|
||||||
|
|
||||||
if (rdata.userProfile != null)
|
//if (rdata.userProfile != null)
|
||||||
{
|
//{
|
||||||
Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}",
|
// Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
Rest.Log.WarnFormat("{0} No profile for {1}", MsgId, rdata.path);
|
// Rest.Log.WarnFormat("{0} No profile for {1}", MsgId, rdata.path);
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
|
// rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
|
||||||
}
|
//}
|
||||||
|
|
||||||
// If we get to here, then we have effectively validated the user's
|
//// If we get to here, then we have effectively validated the user's
|
||||||
// identity. Now we need to get the inventory. If the server does not
|
//// identity. Now we need to get the inventory. If the server does not
|
||||||
// have the inventory, we reject the request with an appropriate explanation.
|
//// have the inventory, we reject the request with an appropriate explanation.
|
||||||
//
|
////
|
||||||
// Note that inventory retrieval is an asynchronous event, we use the rdata
|
//// Note that inventory retrieval is an asynchronous event, we use the rdata
|
||||||
// class instance as the basis for our synchronization.
|
//// class instance as the basis for our synchronization.
|
||||||
//
|
////
|
||||||
|
|
||||||
rdata.uuid = rdata.userProfile.ID;
|
//rdata.uuid = rdata.userProfile.ID;
|
||||||
|
|
||||||
if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
|
//if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
|
||||||
{
|
//{
|
||||||
rdata.root = Rest.InventoryServices.GetRootFolder(rdata.uuid);
|
// rdata.root = Rest.InventoryServices.GetRootFolder(rdata.uuid);
|
||||||
|
|
||||||
Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
|
// Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
|
|
||||||
Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory);
|
// Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory);
|
||||||
|
|
||||||
Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}",
|
// Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
|
|
||||||
lock (rdata)
|
// lock (rdata)
|
||||||
{
|
// {
|
||||||
if (!rdata.HaveInventory)
|
// if (!rdata.HaveInventory)
|
||||||
{
|
// {
|
||||||
rdata.startWD(1000);
|
// rdata.startWD(1000);
|
||||||
rdata.timeout = false;
|
// rdata.timeout = false;
|
||||||
Monitor.Wait(rdata);
|
// Monitor.Wait(rdata);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (rdata.timeout)
|
// if (rdata.timeout)
|
||||||
{
|
// {
|
||||||
Rest.Log.WarnFormat("{0} Inventory not available for {1} {2}. No response from service.",
|
// Rest.Log.WarnFormat("{0} Inventory not available for {1} {2}. No response from service.",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
rdata.Fail(Rest.HttpStatusCodeServerError, "inventory server not responding");
|
// rdata.Fail(Rest.HttpStatusCodeServerError, "inventory server not responding");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (rdata.root == null)
|
// if (rdata.root == null)
|
||||||
{
|
// {
|
||||||
Rest.Log.WarnFormat("{0} Inventory is not available [1] for agent {1} {2}",
|
// Rest.Log.WarnFormat("{0} Inventory is not available [1] for agent {1} {2}",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
rdata.Fail(Rest.HttpStatusCodeServerError, "inventory retrieval failed");
|
// rdata.Fail(Rest.HttpStatusCodeServerError, "inventory retrieval failed");
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
Rest.Log.WarnFormat("{0} Inventory is not locally available for agent {1} {2}",
|
// Rest.Log.WarnFormat("{0} Inventory is not locally available for agent {1} {2}",
|
||||||
MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
// MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
|
||||||
rdata.Fail(Rest.HttpStatusCodeNotFound, "no local inventory for user");
|
// rdata.Fail(Rest.HttpStatusCodeNotFound, "no local inventory for user");
|
||||||
}
|
//}
|
||||||
|
|
||||||
// If we get here, then we have successfully retrieved the user's information
|
//// If we get here, then we have successfully retrieved the user's information
|
||||||
// and inventory information is now available locally.
|
//// and inventory information is now available locally.
|
||||||
|
|
||||||
switch (rdata.method)
|
//switch (rdata.method)
|
||||||
{
|
//{
|
||||||
case Rest.HEAD : // Do the processing, set the status code, suppress entity
|
// case Rest.HEAD : // Do the processing, set the status code, suppress entity
|
||||||
DoGet(rdata);
|
// DoGet(rdata);
|
||||||
rdata.buffer = null;
|
// rdata.buffer = null;
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.GET : // Do the processing, set the status code, return entity
|
// case Rest.GET : // Do the processing, set the status code, return entity
|
||||||
DoGet(rdata);
|
// DoGet(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.PUT : // Update named element
|
// case Rest.PUT : // Update named element
|
||||||
DoUpdate(rdata);
|
// DoUpdate(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.POST : // Add new information to identified context.
|
// case Rest.POST : // Add new information to identified context.
|
||||||
DoExtend(rdata);
|
// DoExtend(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case Rest.DELETE : // Delete information
|
// case Rest.DELETE : // Delete information
|
||||||
DoDelete(rdata);
|
// DoDelete(rdata);
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default :
|
// default :
|
||||||
Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
|
// Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
|
||||||
MsgId, rdata.method, rdata.path);
|
// MsgId, rdata.method, rdata.path);
|
||||||
rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
|
// rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
|
||||||
String.Format("{0} not supported", rdata.method));
|
// String.Format("{0} not supported", rdata.method));
|
||||||
break;
|
// break;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Interface
|
#endregion Interface
|
||||||
|
|
|
@ -41,6 +41,7 @@ using OpenSim.Client.MXP.ClientStack;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP.PacketHandler
|
namespace OpenSim.Client.MXP.PacketHandler
|
||||||
|
@ -295,13 +296,11 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
regionExists = false;
|
regionExists = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserProfileData user = null;
|
|
||||||
UUID userId = UUID.Zero;
|
UUID userId = UUID.Zero;
|
||||||
string firstName = null;
|
UserAccount account = null;
|
||||||
string lastName = null;
|
|
||||||
bool authorized = regionExists ? AuthoriseUser(joinRequestMessage.ParticipantName,
|
bool authorized = regionExists ? AuthoriseUser(joinRequestMessage.ParticipantName,
|
||||||
joinRequestMessage.ParticipantPassphrase,
|
joinRequestMessage.ParticipantPassphrase,
|
||||||
new UUID(joinRequestMessage.BubbleId), out userId, out firstName, out lastName, out user)
|
new UUID(joinRequestMessage.BubbleId), out account)
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
if (authorized)
|
if (authorized)
|
||||||
|
@ -316,10 +315,11 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
session.RemoteEndPoint.Port + ")");
|
session.RemoteEndPoint.Port + ")");
|
||||||
|
|
||||||
m_log.Debug("[MXP ClientStack]: Attaching UserAgent to UserProfile...");
|
m_log.Debug("[MXP ClientStack]: Attaching UserAgent to UserProfile...");
|
||||||
AttachUserAgentToUserProfile(session, mxpSessionID, sceneId, user);
|
UUID secureSession = UUID.Zero;
|
||||||
|
AttachUserAgentToUserProfile(account, session, mxpSessionID, sceneId, out secureSession);
|
||||||
m_log.Debug("[MXP ClientStack]: Attached UserAgent to UserProfile.");
|
m_log.Debug("[MXP ClientStack]: Attached UserAgent to UserProfile.");
|
||||||
m_log.Debug("[MXP ClientStack]: Preparing Scene to Connection...");
|
m_log.Debug("[MXP ClientStack]: Preparing Scene to Connection...");
|
||||||
if (!PrepareSceneForConnection(mxpSessionID, sceneId, user, out reason))
|
if (!PrepareSceneForConnection(mxpSessionID, secureSession, sceneId, account, out reason))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[MXP ClientStack]: Scene refused connection: {0}", reason);
|
m_log.DebugFormat("[MXP ClientStack]: Scene refused connection: {0}", reason);
|
||||||
DeclineConnection(session, joinRequestMessage);
|
DeclineConnection(session, joinRequestMessage);
|
||||||
|
@ -332,7 +332,7 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
m_log.Info("[MXP ClientStack]: Accepted connection.");
|
m_log.Info("[MXP ClientStack]: Accepted connection.");
|
||||||
|
|
||||||
m_log.Debug("[MXP ClientStack]: Creating ClientView....");
|
m_log.Debug("[MXP ClientStack]: Creating ClientView....");
|
||||||
MXPClientView client = new MXPClientView(session, mxpSessionID, userId, scene, firstName, lastName);
|
MXPClientView client = new MXPClientView(session, mxpSessionID, userId, scene, account.FirstName, account.LastName);
|
||||||
m_clients.Add(client);
|
m_clients.Add(client);
|
||||||
m_log.Debug("[MXP ClientStack]: Created ClientView.");
|
m_log.Debug("[MXP ClientStack]: Created ClientView.");
|
||||||
|
|
||||||
|
@ -489,12 +489,12 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
session.SetStateDisconnected();
|
session.SetStateDisconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UUID userId, out string firstName, out string lastName, out UserProfileData userProfile)
|
public bool AuthoriseUser(string participantName, string password, UUID sceneId, out UserAccount account)
|
||||||
{
|
{
|
||||||
userId = UUID.Zero;
|
UUID userId = UUID.Zero;
|
||||||
firstName = "";
|
string firstName = "";
|
||||||
lastName = "";
|
string lastName = "";
|
||||||
userProfile = null;
|
account = null;
|
||||||
|
|
||||||
string[] nameParts = participantName.Split(' ');
|
string[] nameParts = participantName.Split(' ');
|
||||||
if (nameParts.Length != 2)
|
if (nameParts.Length != 2)
|
||||||
|
@ -505,103 +505,38 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
firstName = nameParts[0];
|
firstName = nameParts[0];
|
||||||
lastName = nameParts[1];
|
lastName = nameParts[1];
|
||||||
|
|
||||||
userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
|
account = m_scenes[sceneId].UserAccountService.GetUserAccount(m_scenes[sceneId].RegionInfo.ScopeID, firstName, lastName);
|
||||||
|
if (account != null)
|
||||||
|
return (m_scenes[sceneId].AuthenticationService.Authenticate(account.PrincipalID, password, 1) != string.Empty);
|
||||||
|
|
||||||
if (userProfile == null && !m_accountsAuthenticate)
|
|
||||||
{
|
|
||||||
userId = ((UserManagerBase)m_scenes[sceneId].CommsManager.UserService).AddUser(firstName, lastName, "test", "", 1000, 1000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (userProfile == null)
|
|
||||||
{
|
|
||||||
m_log.Error("[MXP ClientStack]: Login failed as user was not found: " + participantName);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
userId = userProfile.ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_accountsAuthenticate)
|
private void AttachUserAgentToUserProfile(UserAccount account, Session session, UUID sessionId, UUID sceneId, out UUID secureSessionId)
|
||||||
{
|
{
|
||||||
if (!password.StartsWith("$1$"))
|
secureSessionId = UUID.Random();
|
||||||
{
|
Scene scene = m_scenes[sceneId];
|
||||||
password = "$1$" + Util.Md5Hash(password);
|
scene.PresenceService.LoginAgent(account.PrincipalID.ToString(), sessionId, secureSessionId);
|
||||||
}
|
|
||||||
password = password.Remove(0, 3); //remove $1$
|
|
||||||
string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt);
|
|
||||||
return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
|
||||||
|| userProfile.PasswordHash.Equals(password, StringComparison.InvariantCulture));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AttachUserAgentToUserProfile(Session session, UUID sessionId, UUID sceneId, UserProfileData userProfile)
|
private bool PrepareSceneForConnection(UUID sessionId, UUID secureSessionId, UUID sceneId, UserAccount account, out string reason)
|
||||||
{
|
|
||||||
//Scene scene = m_scenes[sceneId];
|
|
||||||
CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
|
|
||||||
IUserService userService = (IUserService)commsManager.UserService;
|
|
||||||
|
|
||||||
UserAgentData agent = new UserAgentData();
|
|
||||||
|
|
||||||
// User connection
|
|
||||||
agent.AgentOnline = true;
|
|
||||||
agent.AgentIP = session.RemoteEndPoint.Address.ToString();
|
|
||||||
agent.AgentPort = (uint)session.RemoteEndPoint.Port;
|
|
||||||
|
|
||||||
agent.SecureSessionID = UUID.Random();
|
|
||||||
agent.SessionID = sessionId;
|
|
||||||
|
|
||||||
// Profile UUID
|
|
||||||
agent.ProfileID = userProfile.ID;
|
|
||||||
|
|
||||||
// Current location/position/alignment
|
|
||||||
if (userProfile.CurrentAgent != null)
|
|
||||||
{
|
|
||||||
agent.Region = userProfile.CurrentAgent.Region;
|
|
||||||
agent.Handle = userProfile.CurrentAgent.Handle;
|
|
||||||
agent.Position = userProfile.CurrentAgent.Position;
|
|
||||||
agent.LookAt = userProfile.CurrentAgent.LookAt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
agent.Region = userProfile.HomeRegionID;
|
|
||||||
agent.Handle = userProfile.HomeRegion;
|
|
||||||
agent.Position = userProfile.HomeLocation;
|
|
||||||
agent.LookAt = userProfile.HomeLookAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
// What time did the user login?
|
|
||||||
agent.LoginTime = Util.UnixTimeSinceEpoch();
|
|
||||||
agent.LogoutTime = 0;
|
|
||||||
|
|
||||||
userProfile.CurrentAgent = agent;
|
|
||||||
|
|
||||||
|
|
||||||
userService.UpdateUserProfile(userProfile);
|
|
||||||
//userService.CommitAgent(ref userProfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool PrepareSceneForConnection(UUID sessionId, UUID sceneId, UserProfileData userProfile, out string reason)
|
|
||||||
{
|
{
|
||||||
Scene scene = m_scenes[sceneId];
|
Scene scene = m_scenes[sceneId];
|
||||||
CommunicationsManager commsManager = m_scenes[sceneId].CommsManager;
|
|
||||||
UserManagerBase userService = (UserManagerBase)commsManager.UserService;
|
|
||||||
|
|
||||||
AgentCircuitData agent = new AgentCircuitData();
|
AgentCircuitData agent = new AgentCircuitData();
|
||||||
agent.AgentID = userProfile.ID;
|
agent.AgentID = account.PrincipalID;
|
||||||
agent.firstname = userProfile.FirstName;
|
agent.firstname = account.FirstName;
|
||||||
agent.lastname = userProfile.SurName;
|
agent.lastname = account.LastName;
|
||||||
agent.SessionID = sessionId;
|
agent.SessionID = sessionId;
|
||||||
agent.SecureSessionID = userProfile.CurrentAgent.SecureSessionID;
|
agent.SecureSessionID = secureSessionId;
|
||||||
agent.circuitcode = sessionId.CRC();
|
agent.circuitcode = sessionId.CRC();
|
||||||
agent.BaseFolder = UUID.Zero;
|
agent.BaseFolder = UUID.Zero;
|
||||||
agent.InventoryFolder = UUID.Zero;
|
agent.InventoryFolder = UUID.Zero;
|
||||||
agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position
|
agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position
|
||||||
agent.CapsPath = "http://localhost/";
|
agent.CapsPath = "http://localhost/";
|
||||||
agent.Appearance = userService.GetUserAppearance(userProfile.ID);
|
AvatarData avatar = scene.AvatarService.GetAvatar(account.PrincipalID);
|
||||||
|
if (avatar != null)
|
||||||
|
agent.Appearance = avatar.ToAvatarAppearance(); //userService.GetUserAppearance(userProfile.ID);
|
||||||
|
|
||||||
if (agent.Appearance == null)
|
if (agent.Appearance == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,345 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* * Neither the name of the OpenSimulator Project nor the
|
|
||||||
* names of its contributors may be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NUnit.Framework.SyntaxHelpers;
|
|
||||||
using System.Threading;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Data;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Communications.Cache;
|
|
||||||
using OpenSim.Region.Framework.Scenes;
|
|
||||||
using OpenSim.Region.Communications.Local;
|
|
||||||
using OpenSim.Tests.Common.Mock;
|
|
||||||
using OpenSim.Tests.Common.Setup;
|
|
||||||
using OpenSim.Tests.Common;
|
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Tests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class UserProfileCacheServiceTests
|
|
||||||
{
|
|
||||||
/// <value>Used by tests to indicate whether an async operation timed out</value>
|
|
||||||
private bool timedOut;
|
|
||||||
|
|
||||||
private void InventoryReceived(UUID userId)
|
|
||||||
{
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
timedOut = false;
|
|
||||||
Monitor.PulseAll(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestGetUserDetails()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
|
|
||||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000002");
|
|
||||||
string firstName = "Bill";
|
|
||||||
string lastName = "Bailey";
|
|
||||||
CachedUserInfo nonExistingUserInfo;
|
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
|
||||||
// Scene myScene = SceneSetupHelpers.SetupScene(commsManager, "");
|
|
||||||
|
|
||||||
// Check we can't retrieve info before it exists by uuid
|
|
||||||
nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
|
||||||
Assert.That(nonExistingUserInfo, Is.Null, "User info found by uuid before user creation");
|
|
||||||
|
|
||||||
// Check we can't retrieve info before it exists by name
|
|
||||||
nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
|
||||||
Assert.That(nonExistingUserInfo, Is.Null, "User info found by name before user creation");
|
|
||||||
|
|
||||||
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
|
||||||
lus.AddUser(firstName, lastName, "troll", "bill@bailey.com", 1000, 1000, userId);
|
|
||||||
|
|
||||||
CachedUserInfo existingUserInfo;
|
|
||||||
|
|
||||||
// Check we can retrieve info by uuid
|
|
||||||
existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
|
||||||
Assert.That(existingUserInfo, Is.Not.Null, "User info not found by uuid");
|
|
||||||
|
|
||||||
// Check we can retrieve info by name
|
|
||||||
existingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
|
||||||
Assert.That(existingUserInfo, Is.Not.Null, "User info not found by name");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disabled as not fully implemented
|
|
||||||
[Test]
|
|
||||||
public void TestUpdateProfile()
|
|
||||||
{
|
|
||||||
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000292");
|
|
||||||
string firstName = "Inspector";
|
|
||||||
string originalLastName = "Morse";
|
|
||||||
string newLastName = "Gadget";
|
|
||||||
|
|
||||||
UserProfileData newProfile = new UserProfileData();
|
|
||||||
newProfile.ID = userId;
|
|
||||||
newProfile.FirstName = firstName;
|
|
||||||
newProfile.SurName = newLastName;
|
|
||||||
|
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
|
||||||
UserProfileCacheService userCacheService = commsManager.UserProfileCacheService;
|
|
||||||
IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin;
|
|
||||||
|
|
||||||
// Check that we can't update info before it exists
|
|
||||||
Assert.That(userCacheService.StoreProfile(newProfile), Is.False);
|
|
||||||
Assert.That(userDataPlugin.GetUserByUUID(userId), Is.Null);
|
|
||||||
|
|
||||||
// Check that we can update a profile once it exists
|
|
||||||
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
|
|
||||||
lus.AddUser(firstName, originalLastName, "pingu", "ted@excellentadventure.com", 1000, 1000, userId);
|
|
||||||
|
|
||||||
Assert.That(userCacheService.StoreProfile(newProfile), Is.True);
|
|
||||||
UserProfileData retrievedProfile = userCacheService.GetUserDetails(userId).UserProfile;
|
|
||||||
Assert.That(retrievedProfile.SurName, Is.EqualTo(newLastName));
|
|
||||||
Assert.That(userDataPlugin.GetUserByUUID(userId).SurName, Is.EqualTo(newLastName));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestFetchInventory()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
|
|
||||||
Scene myScene = SceneSetupHelpers.SetupScene("inventory");
|
|
||||||
|
|
||||||
timedOut = true;
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
|
||||||
Monitor.Wait(this, 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
Assert.That(timedOut, Is.False, "Timed out");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestGetChildFolder()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
|
|
||||||
Scene myScene = SceneSetupHelpers.SetupScene("inventory");
|
|
||||||
CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
|
||||||
Monitor.Wait(this, 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
|
|
||||||
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
|
|
||||||
userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
|
|
||||||
|
|
||||||
Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestCreateFolder()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
|
|
||||||
Scene myScene = SceneSetupHelpers.SetupScene("inventory");
|
|
||||||
CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
|
||||||
Monitor.Wait(this, 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
|
|
||||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
|
|
||||||
|
|
||||||
// 1: Try a folder create that should fail because the parent id given does not exist
|
|
||||||
UUID missingFolderId = UUID.Random();
|
|
||||||
InventoryFolderBase myFolder = new InventoryFolderBase();
|
|
||||||
myFolder.ID = folderId;
|
|
||||||
|
|
||||||
Assert.That(
|
|
||||||
userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
|
|
||||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null);
|
|
||||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
|
|
||||||
Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
|
|
||||||
|
|
||||||
// 2: Try a folder create that should work
|
|
||||||
Assert.That(
|
|
||||||
userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
|
|
||||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Not.Null);
|
|
||||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
|
|
||||||
}
|
|
||||||
|
|
||||||
//[Test]
|
|
||||||
public void TestUpdateFolder()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
|
|
||||||
Scene myScene = SceneSetupHelpers.SetupScene("inventory");
|
|
||||||
CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
|
||||||
Monitor.Wait(this, 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
|
|
||||||
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
|
||||||
InventoryFolderBase myFolder = new InventoryFolderBase();
|
|
||||||
myFolder.ID = folder1Id;
|
|
||||||
|
|
||||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
|
||||||
|
|
||||||
// 1: Test updates that don't involve moving the folder
|
|
||||||
{
|
|
||||||
string newFolderName1 = "newFolderName1";
|
|
||||||
ushort folderType1 = (ushort)AssetType.Texture;
|
|
||||||
userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
|
|
||||||
|
|
||||||
InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
|
|
||||||
Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
|
|
||||||
Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
|
|
||||||
|
|
||||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.GetFolder(myFolder);
|
|
||||||
Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
|
|
||||||
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2: Test an update that also involves moving the folder
|
|
||||||
{
|
|
||||||
UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061");
|
|
||||||
userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
|
|
||||||
InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
|
|
||||||
|
|
||||||
InventoryFolderBase myFolder2 = new InventoryFolderBase();
|
|
||||||
myFolder2.ID = folder2Id;
|
|
||||||
|
|
||||||
string newFolderName2 = "newFolderName2";
|
|
||||||
ushort folderType2 = (ushort)AssetType.Bodypart;
|
|
||||||
userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
|
|
||||||
|
|
||||||
InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id);
|
|
||||||
Assert.That(newFolderName2, Is.EqualTo(folder1.Name));
|
|
||||||
Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type));
|
|
||||||
Assert.That(folder2Id, Is.EqualTo(folder1.ParentID));
|
|
||||||
|
|
||||||
Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
|
|
||||||
Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
|
|
||||||
|
|
||||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.GetFolder(myFolder2);
|
|
||||||
Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
|
|
||||||
Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
|
|
||||||
Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestMoveFolder()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
|
|
||||||
Scene myScene = SceneSetupHelpers.SetupScene("inventory");
|
|
||||||
CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
|
||||||
Monitor.Wait(this, 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
|
|
||||||
UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
|
|
||||||
UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030");
|
|
||||||
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
|
||||||
|
|
||||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
|
||||||
InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
|
|
||||||
userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
|
|
||||||
InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
|
|
||||||
|
|
||||||
// Check folder is currently in folder1
|
|
||||||
userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id);
|
|
||||||
Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True);
|
|
||||||
|
|
||||||
userInfo.MoveFolder(folderToMoveId, folder2Id);
|
|
||||||
|
|
||||||
// Check folder is now in folder2 and no trace remains in folder1
|
|
||||||
InventoryFolderBase myFolder = new InventoryFolderBase();
|
|
||||||
myFolder.ID = folderToMoveId;
|
|
||||||
Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
|
|
||||||
Assert.That(myScene.InventoryService.GetFolder(myFolder).ParentID, Is.EqualTo(folder2Id));
|
|
||||||
|
|
||||||
Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestPurgeFolder()
|
|
||||||
{
|
|
||||||
TestHelper.InMethod();
|
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
|
||||||
|
|
||||||
Scene myScene = SceneSetupHelpers.SetupScene("inventory");
|
|
||||||
CachedUserInfo userInfo;
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
|
||||||
Monitor.Wait(this, 60000);
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070");
|
|
||||||
InventoryFolderImpl rootFolder = userInfo.RootFolder;
|
|
||||||
InventoryFolderBase myFolder = new InventoryFolderBase();
|
|
||||||
myFolder.ID = folder1Id;
|
|
||||||
|
|
||||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
|
||||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Not.Null);
|
|
||||||
|
|
||||||
// Test purge
|
|
||||||
userInfo.PurgeFolder(rootFolder.ID);
|
|
||||||
|
|
||||||
Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
|
|
||||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null);
|
|
||||||
}
|
|
||||||
|
|
||||||
[TearDown]
|
|
||||||
public void TearDown()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (MainServer.Instance != null) MainServer.Instance.Stop();
|
|
||||||
}
|
|
||||||
catch (System.NullReferenceException)
|
|
||||||
{ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -534,26 +534,28 @@ namespace OpenSim.Region.CoreModules.InterGrid
|
||||||
userProfile.WantDoMask = 0;
|
userProfile.WantDoMask = 0;
|
||||||
userProfile.WebLoginKey = UUID.Random();
|
userProfile.WebLoginKey = UUID.Random();
|
||||||
|
|
||||||
// Do caps registration
|
// !!! REFACTORING PROBLEM. This needs to be changed for 0.7
|
||||||
// get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
|
//
|
||||||
if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
|
//// Do caps registration
|
||||||
{
|
//// get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
|
||||||
homeScene.CommsManager.UserAdminService.AddUser(
|
//if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
|
||||||
agentData.firstname, agentData.lastname, CreateRandomStr(7), "",
|
//{
|
||||||
homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
|
// homeScene.CommsManager.UserAdminService.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)
|
||||||
{
|
// {
|
||||||
userProfile = userProfile2;
|
// userProfile = userProfile2;
|
||||||
userProfile.AboutText = "OGP USER";
|
// userProfile.AboutText = "OGP USER";
|
||||||
userProfile.FirstLifeAboutText = "OGP USER";
|
// userProfile.FirstLifeAboutText = "OGP USER";
|
||||||
homeScene.CommsManager.UserService.UpdateUserProfile(userProfile);
|
// homeScene.CommsManager.UserService.UpdateUserProfile(userProfile);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Stick our data in the cache so the region will know something about us
|
//// Stick our data in the cache so the region will know something about us
|
||||||
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile);
|
//homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile);
|
||||||
|
|
||||||
// Call 'new user' event handler
|
// Call 'new user' event handler
|
||||||
string reason;
|
string reason;
|
||||||
|
|
|
@ -161,7 +161,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
|
m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
|
||||||
// ugh!
|
// ugh!
|
||||||
m_UserProfileService.SetInventoryService(this);
|
m_UserProfileService.SetInventoryService(this);
|
||||||
scene.CommsManager.UserService.SetInventoryService(this);
|
|
||||||
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
// ugh!
|
// ugh!
|
||||||
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
|
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
|
||||||
scene.CommsManager.UserService.SetInventoryService(this);
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
{
|
{
|
||||||
// ugh!
|
// ugh!
|
||||||
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
|
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
|
||||||
scene.CommsManager.UserService.SetInventoryService(this);
|
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,6 +296,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService;
|
||||||
|
public OpenSim.Services.Interfaces.IAvatarService AvatarService
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_AvatarService == null)
|
||||||
|
m_AvatarService = RequestModuleInterface<OpenSim.Services.Interfaces.IAvatarService>();
|
||||||
|
return m_AvatarService;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected IXMLRPC m_xmlrpcModule;
|
protected IXMLRPC m_xmlrpcModule;
|
||||||
protected IWorldComm m_worldCommModule;
|
protected IWorldComm m_worldCommModule;
|
||||||
protected IAvatarFactory m_AvatarFactory;
|
protected IAvatarFactory m_AvatarFactory;
|
||||||
|
@ -2975,21 +2986,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="client">The IClientAPI for the client</param>
|
/// <param name="client">The IClientAPI for the client</param>
|
||||||
public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
|
public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
|
||||||
{
|
{
|
||||||
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
|
OpenSim.Services.Interfaces.PresenceInfo pinfo = PresenceService.GetAgent(client.SessionId);
|
||||||
if (UserProfile != null)
|
|
||||||
|
if (pinfo != null)
|
||||||
{
|
{
|
||||||
GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID);
|
GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID);
|
||||||
if (regionInfo == null)
|
|
||||||
{
|
|
||||||
uint x = 0, y = 0;
|
|
||||||
Utils.LongToUInts(UserProfile.HomeRegion, out x, out y);
|
|
||||||
regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
|
||||||
if (regionInfo != null) // home region can be away temporarily, too
|
|
||||||
{
|
|
||||||
UserProfile.HomeRegionID = regionInfo.RegionID;
|
|
||||||
CommsManager.UserService.UpdateUserProfile(UserProfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (regionInfo == null)
|
if (regionInfo == null)
|
||||||
{
|
{
|
||||||
// can't find the Home region: Tell viewer and abort
|
// can't find the Home region: Tell viewer and abort
|
||||||
|
@ -2997,7 +2998,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RequestTeleportLocation(
|
RequestTeleportLocation(
|
||||||
client, regionInfo.RegionHandle, UserProfile.HomeLocation, UserProfile.HomeLookAt,
|
client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt,
|
||||||
(uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
|
(uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3089,7 +3090,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the Home Point. The GridService uses this to know where to put a user when they log-in
|
/// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="regionHandle"></param>
|
/// <param name="regionHandle"></param>
|
||||||
|
@ -3098,28 +3099,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="flags"></param>
|
/// <param name="flags"></param>
|
||||||
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
|
public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
|
||||||
{
|
{
|
||||||
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId);
|
if (PresenceService.SetHomeLocation(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
|
||||||
if (UserProfile != null)
|
|
||||||
{
|
|
||||||
// I know I'm ignoring the regionHandle provided by the teleport location request.
|
|
||||||
// reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
|
|
||||||
UserProfile.HomeRegionID = RegionInfo.RegionID;
|
|
||||||
// TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around.
|
|
||||||
// TODO: The HomeRegion property can be removed then, too
|
|
||||||
UserProfile.HomeRegion = RegionInfo.RegionHandle;
|
|
||||||
|
|
||||||
UserProfile.HomeLocation = position;
|
|
||||||
UserProfile.HomeLookAt = lookAt;
|
|
||||||
CommsManager.UserService.UpdateUserProfile(UserProfile);
|
|
||||||
|
|
||||||
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
|
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
|
||||||
m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
|
m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a child agent scene presence and add it to this scene.
|
/// Create a child agent scene presence and add it to this scene.
|
||||||
|
@ -3254,12 +3239,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
|
m_log.Error("[SCENE] Scene.cs:RemoveClient exception: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove client agent from profile, so new logins will work
|
|
||||||
if (!childagentYN)
|
|
||||||
{
|
|
||||||
m_sceneGridService.ClearUserAgent(agentID);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
|
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
|
||||||
|
|
||||||
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
|
||||||
|
|
|
@ -1455,11 +1455,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
m_commsProvider.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearUserAgent(UUID avatarID)
|
|
||||||
{
|
|
||||||
m_commsProvider.UserService.ClearUserAgent(avatarID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
|
public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
|
||||||
{
|
{
|
||||||
m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms);
|
m_commsProvider.AddNewUserFriend(friendlistowner, friend, perms);
|
||||||
|
|
|
@ -43,6 +43,8 @@ using OpenSim.Region.CoreModules.Framework.EventQueue;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
|
using DirFindFlags = OpenMetaverse.DirectoryManager.DirFindFlags;
|
||||||
|
|
||||||
|
@ -507,10 +509,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
{
|
{
|
||||||
UserProfileData targetUserProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(member.AgentID);
|
UserAccount targetUser = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, member.AgentID);
|
||||||
if (targetUserProfile != null)
|
if (targetUser != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUserProfile.Name, member.AcceptNotices);
|
m_log.DebugFormat("[GROUPS]: Prepping group notice {0} for agent: {1} who Accepts Notices ({2})", NoticeID, targetUser.FirstName + " " + targetUser.LastName, member.AcceptNotices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -990,9 +992,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, groupID, true);
|
remoteClient.SendEjectGroupMemberReply(remoteClient.AgentId, groupID, true);
|
||||||
|
|
||||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, groupID, null);
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(grID, groupID, null);
|
||||||
UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(ejecteeID);
|
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, ejecteeID);
|
||||||
|
if ((groupInfo == null) || (account == null))
|
||||||
if ((groupInfo == null) || (userProfile == null))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1032,9 +1033,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
msg.toAgentID = remoteClient.AgentId.Guid;
|
msg.toAgentID = remoteClient.AgentId.Guid;
|
||||||
msg.timestamp = 0;
|
msg.timestamp = 0;
|
||||||
msg.fromAgentName = remoteClient.Name;
|
msg.fromAgentName = remoteClient.Name;
|
||||||
if (userProfile != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, userProfile.Name);
|
msg.message = string.Format("{2} has been ejected from '{1}' by {0}.", remoteClient.Name, groupInfo.GroupName, account.FirstName + " " + account.LastName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1147,8 +1148,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
info.RequestID.AgentID = client.AgentId;
|
info.RequestID.AgentID = client.AgentId;
|
||||||
info.RequestID.SessionID = client.SessionId;
|
info.RequestID.SessionID = client.SessionId;
|
||||||
|
|
||||||
UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(client.AgentId);
|
//UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(client.AgentId);
|
||||||
if (userProfile == null)
|
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, client.AgentId);
|
||||||
|
if (account == null)
|
||||||
{
|
{
|
||||||
// This should be impossible. If I've been passed a reference to a client
|
// This should be impossible. If I've been passed a reference to a client
|
||||||
// that client should be registered with the UserService. So something
|
// that client should be registered with the UserService. So something
|
||||||
|
@ -1160,16 +1162,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
info.RequestID.UserServiceURL = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL;
|
info.RequestID.UserServiceURL = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (userProfile is ForeignUserProfileData)
|
|
||||||
{
|
|
||||||
// They aren't from around here
|
|
||||||
ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile;
|
|
||||||
info.RequestID.UserServiceURL = fupd.UserServerURI;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
string domain = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL;
|
||||||
|
if (account.ServiceURLs["HomeURI"] != null)
|
||||||
|
domain = account.ServiceURLs["HomeURI"].ToString();
|
||||||
// They're a local user, use this:
|
// They're a local user, use this:
|
||||||
info.RequestID.UserServiceURL = m_sceneList[0].CommsManager.NetworkServersInfo.UserURL;
|
info.RequestID.UserServiceURL = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_clientRequestIDInfo.Add(client.AgentId, info);
|
m_clientRequestIDInfo.Add(client.AgentId, info);
|
||||||
|
@ -1342,12 +1341,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
// TODO: All the client update functions need to be reexamined because most do too much and send too much stuff
|
||||||
UserProfileData userProfile = m_sceneList[0].CommsManager.UserService.GetUserProfile(dataForAgentID);
|
UserAccount account = m_sceneList[0].UserAccountService.GetUserAccount(remoteClient.Scene.RegionInfo.ScopeID, dataForAgentID);
|
||||||
string firstname, lastname;
|
string firstname, lastname;
|
||||||
if (userProfile != null)
|
if (account != null)
|
||||||
{
|
{
|
||||||
firstname = userProfile.FirstName;
|
firstname = account.FirstName;
|
||||||
lastname = userProfile.SurName;
|
lastname = account.LastName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,8 +52,9 @@ using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||||
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
|
||||||
|
|
||||||
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
||||||
|
|
||||||
|
@ -3842,13 +3843,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
UUID uuid = (UUID)id;
|
UUID uuid = (UUID)id;
|
||||||
|
|
||||||
UserProfileData userProfile =
|
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid);
|
||||||
World.CommsManager.UserService.GetUserProfile(uuid);
|
|
||||||
|
|
||||||
UserAgentData userAgent =
|
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
|
||||||
World.CommsManager.UserService.GetAgentByUUID(uuid);
|
PresenceInfo pinfo = PresenceInfo.GetOnlinePresence(pinfos);
|
||||||
|
|
||||||
if (userProfile == null || userAgent == null)
|
if (pinfo == null)
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
|
|
||||||
string reply = String.Empty;
|
string reply = String.Empty;
|
||||||
|
@ -3857,17 +3857,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
case 1: // DATA_ONLINE (0|1)
|
case 1: // DATA_ONLINE (0|1)
|
||||||
// TODO: implement fetching of this information
|
// TODO: implement fetching of this information
|
||||||
if (userProfile.CurrentAgent!=null && userProfile.CurrentAgent.AgentOnline)
|
if (pinfo != null)
|
||||||
reply = "1";
|
reply = "1";
|
||||||
else
|
else
|
||||||
reply = "0";
|
reply = "0";
|
||||||
break;
|
break;
|
||||||
case 2: // DATA_NAME (First Last)
|
case 2: // DATA_NAME (First Last)
|
||||||
reply = userProfile.FirstName + " " + userProfile.SurName;
|
reply = account.FirstName + " " + account.LastName;
|
||||||
break;
|
break;
|
||||||
case 3: // DATA_BORN (YYYY-MM-DD)
|
case 3: // DATA_BORN (YYYY-MM-DD)
|
||||||
DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
DateTime born = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||||
born = born.AddSeconds(userProfile.Created);
|
born = born.AddSeconds(account.Created);
|
||||||
reply = born.ToString("yyyy-MM-dd");
|
reply = born.ToString("yyyy-MM-dd");
|
||||||
break;
|
break;
|
||||||
case 4: // DATA_RATING (0,0,0,0,0,0)
|
case 4: // DATA_RATING (0,0,0,0,0,0)
|
||||||
|
|
|
@ -90,6 +90,26 @@ namespace OpenSim.Services.Interfaces
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PresenceInfo[] GetOnlinePresences(PresenceInfo[] pinfos)
|
||||||
|
{
|
||||||
|
if (pinfos == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<PresenceInfo> lst = new List<PresenceInfo>(pinfos);
|
||||||
|
lst = lst.FindAll(delegate(PresenceInfo each) { return each.Online; });
|
||||||
|
|
||||||
|
return lst.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PresenceInfo GetOnlinePresence(PresenceInfo[] pinfos)
|
||||||
|
{
|
||||||
|
pinfos = GetOnlinePresences(pinfos);
|
||||||
|
if (pinfos != null && pinfos.Length >= 1)
|
||||||
|
return pinfos[0];
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IPresenceService
|
public interface IPresenceService
|
||||||
|
|
|
@ -42,6 +42,17 @@ namespace OpenSim.Services.Interfaces
|
||||||
PrincipalID = principalID;
|
PrincipalID = principalID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserAccount(UUID scopeID, string firstName, string lastName, string email)
|
||||||
|
{
|
||||||
|
PrincipalID = UUID.Random();
|
||||||
|
ScopeID = scopeID;
|
||||||
|
FirstName = firstName;
|
||||||
|
LastName = lastName;
|
||||||
|
Email = email;
|
||||||
|
ServiceURLs = new Dictionary<string, object>();
|
||||||
|
// Created = ???
|
||||||
|
}
|
||||||
|
|
||||||
public string FirstName;
|
public string FirstName;
|
||||||
public string LastName;
|
public string LastName;
|
||||||
public string Email;
|
public string Email;
|
||||||
|
|
|
@ -194,8 +194,6 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
m_inventoryService.PostInitialise();
|
m_inventoryService.PostInitialise();
|
||||||
m_assetService.PostInitialise();
|
m_assetService.PostInitialise();
|
||||||
|
|
||||||
testScene.CommsManager.UserService.SetInventoryService(testScene.InventoryService);
|
|
||||||
|
|
||||||
testScene.SetModuleInterfaces();
|
testScene.SetModuleInterfaces();
|
||||||
|
|
||||||
testScene.LandChannel = new TestLandChannel(testScene);
|
testScene.LandChannel = new TestLandChannel(testScene);
|
||||||
|
|
|
@ -2365,6 +2365,7 @@
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Region.Framework"/>
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
<Reference name="Nini.dll" />
|
<Reference name="Nini.dll" />
|
||||||
<Reference name="log4net.dll"/>
|
<Reference name="log4net.dll"/>
|
||||||
<Reference name="protobuf-net"/>
|
<Reference name="protobuf-net"/>
|
||||||
|
|
Loading…
Reference in New Issue