aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs500
1 files changed, 252 insertions, 248 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 87eae1e..9f6414b 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41using OpenSim; 41using OpenSim;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Communications; 43using OpenSim.Framework.Communications;
44using OpenSim.Framework.Communications.Cache; 44
45using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
46using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
47using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
@@ -49,6 +49,8 @@ using OpenSim.Region.CoreModules.World.Terrain;
49using OpenSim.Region.Framework.Interfaces; 49using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.Framework.Scenes; 50using OpenSim.Region.Framework.Scenes;
51using OpenSim.Services.Interfaces; 51using OpenSim.Services.Interfaces;
52using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
53using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 54
53namespace OpenSim.ApplicationPlugins.RemoteController 55namespace OpenSim.ApplicationPlugins.RemoteController
54{ 56{
@@ -700,39 +702,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
700 { 702 {
701 // ok, client wants us to use an explicit UUID 703 // ok, client wants us to use an explicit UUID
702 // regardless of what the avatar name provided 704 // regardless of what the avatar name provided
703 userID = new UUID((string) requestData["region_master_uuid"]); 705 userID = new UUID((string) requestData["estate_owner_uuid"]);
704 } 706 }
705 else
706 {
707 if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar
708 {
709 // no client supplied UUID: look it up...
710 CachedUserInfo userInfo
711 = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(
712 masterFirst, masterLast);
713
714 if (null == userInfo)
715 {
716 m_log.InfoFormat("master avatar does not exist, creating it");
717 // ...or create new user
718 userID = m_app.CommunicationsManager.UserAdminService.AddUser(
719 masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
720
721 if (userID == UUID.Zero)
722 throw new Exception(String.Format("failed to create new user {0} {1}",
723 masterFirst, masterLast));
724 }
725 else
726 {
727 userID = userInfo.UserProfile.ID;
728 }
729 }
730 }
731
732 region.MasterAvatarFirstName = masterFirst;
733 region.MasterAvatarLastName = masterLast;
734 region.MasterAvatarSandboxPassword = masterPassword;
735 region.MasterAvatarAssignedUUID = userID;
736 707
737 bool persist = Convert.ToBoolean((string) requestData["persist"]); 708 bool persist = Convert.ToBoolean((string) requestData["persist"]);
738 if (persist) 709 if (persist)
@@ -777,6 +748,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
777 // If an access specification was provided, use it. 748 // If an access specification was provided, use it.
778 // Otherwise accept the default. 749 // Otherwise accept the default.
779 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); 750 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess);
751 newscene.RegionInfo.EstateSettings.EstateOwner = userID;
780 if (persist) 752 if (persist)
781 newscene.RegionInfo.EstateSettings.Save(); 753 newscene.RegionInfo.EstateSettings.Save();
782 754
@@ -1150,30 +1122,39 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1150 if (requestData.Contains("user_email")) 1122 if (requestData.Contains("user_email"))
1151 email = (string)requestData["user_email"]; 1123 email = (string)requestData["user_email"];
1152 1124
1153 CachedUserInfo userInfo = 1125 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1154 m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1155 1126
1156 if (null != userInfo) 1127 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
1157 throw new Exception(String.Format("Avatar {0} {1} already exists", firstname, lastname));
1158 1128
1159 UUID userID = 1129 if (null != account)
1160 m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname, 1130 throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname));
1161 passwd, email, regX, regY);
1162 1131
1163 if (userID == UUID.Zero) 1132 account = new UserAccount(scopeID, firstname, lastname, email);
1133
1134 bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
1135
1136 if (!success)
1164 throw new Exception(String.Format("failed to create new user {0} {1}", 1137 throw new Exception(String.Format("failed to create new user {0} {1}",
1165 firstname, lastname)); 1138 firstname, lastname));
1166 1139
1140 // Store the password
1141 m_app.SceneManager.CurrentOrFirstScene.AuthenticationService.SetPassword(account.PrincipalID, passwd);
1142
1143 GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
1144 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
1145 if (home == null)
1146 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname);
1147
1167 // Establish the avatar's initial appearance 1148 // Establish the avatar's initial appearance
1168 1149
1169 updateUserAppearance(responseData, requestData, userID); 1150 updateUserAppearance(responseData, requestData, account.PrincipalID);
1170 1151
1171 responseData["success"] = true; 1152 responseData["success"] = true;
1172 responseData["avatar_uuid"] = userID.ToString(); 1153 responseData["avatar_uuid"] = account.PrincipalID.ToString();
1173 1154
1174 response.Value = responseData; 1155 response.Value = responseData;
1175 1156
1176 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); 1157 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID);
1177 } 1158 }
1178 catch (Exception e) 1159 catch (Exception e)
1179 { 1160 {
@@ -1242,21 +1223,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1242 string firstname = (string) requestData["user_firstname"]; 1223 string firstname = (string) requestData["user_firstname"];
1243 string lastname = (string) requestData["user_lastname"]; 1224 string lastname = (string) requestData["user_lastname"];
1244 1225
1245 CachedUserInfo userInfo
1246 = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1247
1248 responseData["user_firstname"] = firstname; 1226 responseData["user_firstname"] = firstname;
1249 responseData["user_lastname"] = lastname; 1227 responseData["user_lastname"] = lastname;
1250 1228
1251 if (null == userInfo) 1229 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1230
1231 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
1232
1233 if (null == account)
1252 { 1234 {
1253 responseData["success"] = false; 1235 responseData["success"] = false;
1254 responseData["lastlogin"] = 0; 1236 responseData["lastlogin"] = 0;
1255 } 1237 }
1256 else 1238 else
1257 { 1239 {
1240 PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() });
1241 if (pinfos != null && pinfos.Length >= 1)
1242 responseData["lastlogin"] = pinfos[0].Login;
1243 else
1244 responseData["lastlogin"] = 0;
1245
1258 responseData["success"] = true; 1246 responseData["success"] = true;
1259 responseData["lastlogin"] = userInfo.UserProfile.LastLogin;
1260 } 1247 }
1261 1248
1262 response.Value = responseData; 1249 response.Value = responseData;
@@ -1318,117 +1305,118 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1318 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) 1305 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient)
1319 { 1306 {
1320 m_log.Info("[RADMIN]: UpdateUserAccount: new request"); 1307 m_log.Info("[RADMIN]: UpdateUserAccount: new request");
1308 m_log.Warn("[RADMIN]: This method needs update for 0.7");
1321 XmlRpcResponse response = new XmlRpcResponse(); 1309 XmlRpcResponse response = new XmlRpcResponse();
1322 Hashtable responseData = new Hashtable(); 1310 Hashtable responseData = new Hashtable();
1323 1311
1324 lock (rslock) 1312 //lock (rslock)
1325 { 1313 //{
1326 try 1314 // try
1327 { 1315 // {
1328 Hashtable requestData = (Hashtable) request.Params[0]; 1316 // Hashtable requestData = (Hashtable) request.Params[0];
1329 1317
1330 // check completeness 1318 // // check completeness
1331 checkStringParameters(request, new string[] { 1319 // checkStringParameters(request, new string[] {
1332 "password", "user_firstname", 1320 // "password", "user_firstname",
1333 "user_lastname"}); 1321 // "user_lastname"});
1334 1322
1335 // check password 1323 // // check password
1336 if (!String.IsNullOrEmpty(m_requiredPassword) && 1324 // if (!String.IsNullOrEmpty(m_requiredPassword) &&
1337 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); 1325 // (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
1338 1326
1339 // do the job 1327 // // do the job
1340 string firstname = (string) requestData["user_firstname"]; 1328 // string firstname = (string) requestData["user_firstname"];
1341 string lastname = (string) requestData["user_lastname"]; 1329 // string lastname = (string) requestData["user_lastname"];
1342 1330
1343 string passwd = String.Empty; 1331 // string passwd = String.Empty;
1344 uint? regX = null; 1332 // uint? regX = null;
1345 uint? regY = null; 1333 // uint? regY = null;
1346 uint? ulaX = null; 1334 // uint? ulaX = null;
1347 uint? ulaY = null; 1335 // uint? ulaY = null;
1348 uint? ulaZ = null; 1336 // uint? ulaZ = null;
1349 uint? usaX = null; 1337 // uint? usaX = null;
1350 uint? usaY = null; 1338 // uint? usaY = null;
1351 uint? usaZ = null; 1339 // uint? usaZ = null;
1352 string aboutFirstLive = String.Empty; 1340 // string aboutFirstLive = String.Empty;
1353 string aboutAvatar = String.Empty; 1341 // string aboutAvatar = String.Empty;
1354 1342
1355 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; 1343 // if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
1356 if (requestData.ContainsKey("start_region_x")) 1344 // if (requestData.ContainsKey("start_region_x"))
1357 regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); 1345 // regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
1358 if (requestData.ContainsKey("start_region_y")) 1346 // if (requestData.ContainsKey("start_region_y"))
1359 regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); 1347 // regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
1360 1348
1361 if (requestData.ContainsKey("start_lookat_x")) 1349 // if (requestData.ContainsKey("start_lookat_x"))
1362 ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); 1350 // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
1363 if (requestData.ContainsKey("start_lookat_y")) 1351 // if (requestData.ContainsKey("start_lookat_y"))
1364 ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); 1352 // ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
1365 if (requestData.ContainsKey("start_lookat_z")) 1353 // if (requestData.ContainsKey("start_lookat_z"))
1366 ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); 1354 // ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
1367 1355
1368 if (requestData.ContainsKey("start_standat_x")) 1356 // if (requestData.ContainsKey("start_standat_x"))
1369 usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); 1357 // usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
1370 if (requestData.ContainsKey("start_standat_y")) 1358 // if (requestData.ContainsKey("start_standat_y"))
1371 usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); 1359 // usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
1372 if (requestData.ContainsKey("start_standat_z")) 1360 // if (requestData.ContainsKey("start_standat_z"))
1373 usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); 1361 // usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
1374 if (requestData.ContainsKey("about_real_world")) 1362 // if (requestData.ContainsKey("about_real_world"))
1375 aboutFirstLive = (string)requestData["about_real_world"]; 1363 // aboutFirstLive = (string)requestData["about_real_world"];
1376 if (requestData.ContainsKey("about_virtual_world")) 1364 // if (requestData.ContainsKey("about_virtual_world"))
1377 aboutAvatar = (string)requestData["about_virtual_world"]; 1365 // aboutAvatar = (string)requestData["about_virtual_world"];
1378 1366
1379 UserProfileData userProfile 1367 // UserProfileData userProfile
1380 = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 1368 // = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
1381 1369
1382 if (null == userProfile) 1370 // if (null == userProfile)
1383 throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); 1371 // throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
1384 1372
1385 if (!String.IsNullOrEmpty(passwd)) 1373 // if (!String.IsNullOrEmpty(passwd))
1386 { 1374 // {
1387 m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); 1375 // m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname);
1388 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); 1376 // string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
1389 userProfile.PasswordHash = md5PasswdHash; 1377 // userProfile.PasswordHash = md5PasswdHash;
1390 } 1378 // }
1391 1379
1392 if (null != regX) userProfile.HomeRegionX = (uint) regX; 1380 // if (null != regX) userProfile.HomeRegionX = (uint) regX;
1393 if (null != regY) userProfile.HomeRegionY = (uint) regY; 1381 // if (null != regY) userProfile.HomeRegionY = (uint) regY;
1394 1382
1395 if (null != usaX) userProfile.HomeLocationX = (uint) usaX; 1383 // if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
1396 if (null != usaY) userProfile.HomeLocationY = (uint) usaY; 1384 // if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
1397 if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; 1385 // if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
1398 1386
1399 if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; 1387 // if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
1400 if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; 1388 // if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
1401 if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; 1389 // if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
1402 1390
1403 if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; 1391 // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
1404 if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; 1392 // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
1405 1393
1406 // User has been created. Now establish gender and appearance. 1394 // // User has been created. Now establish gender and appearance.
1407 1395
1408 updateUserAppearance(responseData, requestData, userProfile.ID); 1396 // updateUserAppearance(responseData, requestData, userProfile.ID);
1409 1397
1410 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) 1398 // if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
1411 throw new Exception("did not manage to update user profile"); 1399 // throw new Exception("did not manage to update user profile");
1412 1400
1413 responseData["success"] = true; 1401 // responseData["success"] = true;
1414 1402
1415 response.Value = responseData; 1403 // response.Value = responseData;
1416 1404
1417 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", 1405 // m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
1418 firstname, lastname, 1406 // firstname, lastname,
1419 userProfile.ID); 1407 // userProfile.ID);
1420 } 1408 // }
1421 catch (Exception e) 1409 // catch (Exception e)
1422 { 1410 // {
1423 m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); 1411 // m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
1424 m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); 1412 // m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
1425 1413
1426 responseData["success"] = false; 1414 // responseData["success"] = false;
1427 responseData["error"] = e.Message; 1415 // responseData["error"] = e.Message;
1428 1416
1429 response.Value = responseData; 1417 // response.Value = responseData;
1430 } 1418 // }
1431 } 1419 //}
1432 1420
1433 m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); 1421 m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
1434 return response; 1422 return response;
@@ -1445,72 +1433,73 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1445 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) 1433 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
1446 { 1434 {
1447 m_log.DebugFormat("[RADMIN] updateUserAppearance"); 1435 m_log.DebugFormat("[RADMIN] updateUserAppearance");
1436 m_log.Warn("[RADMIN]: This method needs update for 0.7");
1448 1437
1449 string dmale = m_config.GetString("default_male", "Default Male"); 1438 //string dmale = m_config.GetString("default_male", "Default Male");
1450 string dfemale = m_config.GetString("default_female", "Default Female"); 1439 //string dfemale = m_config.GetString("default_female", "Default Female");
1451 string dneut = m_config.GetString("default_female", "Default Default"); 1440 //string dneut = m_config.GetString("default_female", "Default Default");
1452 string model = String.Empty; 1441 string model = String.Empty;
1453 1442
1454 // Has a gender preference been supplied? 1443 //// Has a gender preference been supplied?
1455 1444
1456 if (requestData.Contains("gender")) 1445 //if (requestData.Contains("gender"))
1457 { 1446 //{
1458 switch ((string)requestData["gender"]) 1447 // switch ((string)requestData["gender"])
1459 { 1448 // {
1460 case "m" : 1449 // case "m" :
1461 model = dmale; 1450 // model = dmale;
1462 break; 1451 // break;
1463 case "f" : 1452 // case "f" :
1464 model = dfemale; 1453 // model = dfemale;
1465 break; 1454 // break;
1466 case "n" : 1455 // case "n" :
1467 default : 1456 // default :
1468 model = dneut; 1457 // model = dneut;
1469 break; 1458 // break;
1470 } 1459 // }
1471 } 1460 //}
1472 1461
1473 // Has an explicit model been specified? 1462 //// Has an explicit model been specified?
1474 1463
1475 if (requestData.Contains("model")) 1464 //if (requestData.Contains("model"))
1476 { 1465 //{
1477 model = (string)requestData["model"]; 1466 // model = (string)requestData["model"];
1478 } 1467 //}
1479 1468
1480 // No appearance attributes were set 1469 //// No appearance attributes were set
1481 1470
1482 if (model == String.Empty) 1471 //if (model == String.Empty)
1483 { 1472 //{
1484 m_log.DebugFormat("[RADMIN] Appearance update not requested"); 1473 // m_log.DebugFormat("[RADMIN] Appearance update not requested");
1485 return; 1474 // return;
1486 } 1475 //}
1487 1476
1488 m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); 1477 //m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model);
1489 1478
1490 string[] nomens = model.Split(); 1479 //string[] nomens = model.Split();
1491 if (nomens.Length != 2) 1480 //if (nomens.Length != 2)
1492 { 1481 //{
1493 m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); 1482 // m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
1494 // nomens = dmodel.Split(); 1483 // // nomens = dmodel.Split();
1495 return; 1484 // return;
1496 } 1485 //}
1497 1486
1498 UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); 1487 //UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]);
1499 1488
1500 // Is this the first time one of the default models has been used? Create it if that is the case 1489 //// Is this the first time one of the default models has been used? Create it if that is the case
1501 // otherwise default to male. 1490 //// otherwise default to male.
1502 1491
1503 if (mprof == null) 1492 //if (mprof == null)
1504 { 1493 //{
1505 m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); 1494 // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
1506 return; 1495 // return;
1507 } 1496 //}
1508 1497
1509 // Set current user's appearance. This bit is easy. The appearance structure is populated with 1498 //// Set current user's appearance. This bit is easy. The appearance structure is populated with
1510 // actual asset ids, however to complete the magic we need to populate the inventory with the 1499 //// actual asset ids, however to complete the magic we need to populate the inventory with the
1511 // assets in question. 1500 //// assets in question.
1512 1501
1513 establishAppearance(userid, mprof.ID); 1502 //establishAppearance(userid, mprof.ID);
1514 1503
1515 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", 1504 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
1516 userid, model); 1505 userid, model);
@@ -1525,8 +1514,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1525 private void establishAppearance(UUID dest, UUID srca) 1514 private void establishAppearance(UUID dest, UUID srca)
1526 { 1515 {
1527 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); 1516 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca);
1528 1517 AvatarAppearance ava = null;
1529 AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(srca); 1518 AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca);
1519 if (avatar != null)
1520 ava = avatar.ToAvatarAppearance(srca);
1530 1521
1531 // If the model has no associated appearance we're done. 1522 // If the model has no associated appearance we're done.
1532 1523
@@ -1619,7 +1610,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1619 throw new Exception("Unable to load both inventories"); 1610 throw new Exception("Unable to load both inventories");
1620 } 1611 }
1621 1612
1622 m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava); 1613 AvatarData adata = new AvatarData(ava);
1614 m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(dest, adata);
1623 } 1615 }
1624 catch (Exception e) 1616 catch (Exception e)
1625 { 1617 {
@@ -1674,7 +1666,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1674 uint regX = 1000; 1666 uint regX = 1000;
1675 uint regY = 1000; 1667 uint regY = 1000;
1676 string passwd = UUID.Random().ToString(); // No requirement to sign-in. 1668 string passwd = UUID.Random().ToString(); // No requirement to sign-in.
1677 CachedUserInfo UI;
1678 UUID ID = UUID.Zero; 1669 UUID ID = UUID.Zero;
1679 AvatarAppearance mava; 1670 AvatarAppearance mava;
1680 XmlNodeList avatars; 1671 XmlNodeList avatars;
@@ -1693,7 +1684,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1693 assets = doc.GetElementsByTagName("RequiredAsset"); 1684 assets = doc.GetElementsByTagName("RequiredAsset");
1694 foreach (XmlNode asset in assets) 1685 foreach (XmlNode asset in assets)
1695 { 1686 {
1696 AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type",""))); 1687 AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset, "name", ""), SByte.Parse(GetStringAttribute(asset, "type", "")), UUID.Zero.ToString());
1697 rass.Description = GetStringAttribute(asset,"desc",""); 1688 rass.Description = GetStringAttribute(asset,"desc","");
1698 rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); 1689 rass.Local = Boolean.Parse(GetStringAttribute(asset,"local",""));
1699 rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); 1690 rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary",""));
@@ -1722,20 +1713,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1722 passwd = GetStringAttribute(avatar,"password",passwd); 1713 passwd = GetStringAttribute(avatar,"password",passwd);
1723 1714
1724 string[] nomens = name.Split(); 1715 string[] nomens = name.Split();
1725 UI = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(nomens[0], nomens[1]); 1716 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1726 if (null == UI) 1717 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]);
1718 if (null == account)
1727 { 1719 {
1728 ID = m_app.CommunicationsManager.UserAdminService.AddUser(nomens[0], nomens[1], 1720 account = new UserAccount(scopeID, nomens[0], nomens[1], email);
1729 passwd, email, regX, regY); 1721 bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
1730 if (ID == UUID.Zero) 1722 if (!success)
1731 { 1723 {
1732 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); 1724 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]);
1733 return false; 1725 return false;
1734 } 1726 }
1727 // !!! REFACTORING PROBLEM: need to set the password
1728
1729 GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
1730 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
1731 if (home != null)
1732 m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1735 } 1733 }
1736 else 1734 else
1737 { 1735 {
1738 ID = UI.UserProfile.ID; 1736 ID = account.PrincipalID;
1739 } 1737 }
1740 1738
1741 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); 1739 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
@@ -1759,10 +1757,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1759 iserv.GetUserInventory(ID, uic.callback); 1757 iserv.GetUserInventory(ID, uic.callback);
1760 1758
1761 // While the inventory is being fetched, setup for appearance processing 1759 // While the inventory is being fetched, setup for appearance processing
1762 if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null) 1760 AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID);
1763 { 1761 if (adata != null)
1762 mava = adata.ToAvatarAppearance(ID);
1763 else
1764 mava = new AvatarAppearance(); 1764 mava = new AvatarAppearance();
1765 }
1766 1765
1767 { 1766 {
1768 AvatarWearable[] wearables = mava.Wearables; 1767 AvatarWearable[] wearables = mava.Wearables;
@@ -1897,7 +1896,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1897 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); 1896 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname);
1898 } // foreach outfit 1897 } // foreach outfit
1899 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); 1898 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name);
1900 m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(ID, mava); 1899 AvatarData adata2 = new AvatarData(mava);
1900 m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(ID, adata2);
1901 } 1901 }
1902 catch (Exception e) 1902 catch (Exception e)
1903 { 1903 {
@@ -2509,17 +2509,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2509 2509
2510 if (requestData.Contains("users")) 2510 if (requestData.Contains("users"))
2511 { 2511 {
2512 UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2512 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2513 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
2513 Scene s = m_app.SceneManager.CurrentScene; 2514 Scene s = m_app.SceneManager.CurrentScene;
2514 Hashtable users = (Hashtable) requestData["users"]; 2515 Hashtable users = (Hashtable) requestData["users"];
2515 List<UUID> uuids = new List<UUID>(); 2516 List<UUID> uuids = new List<UUID>();
2516 foreach (string name in users.Values) 2517 foreach (string name in users.Values)
2517 { 2518 {
2518 string[] parts = name.Split(); 2519 string[] parts = name.Split();
2519 CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); 2520 UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
2520 if (udata != null) 2521 if (account != null)
2521 { 2522 {
2522 uuids.Add(udata.UserProfile.ID); 2523 uuids.Add(account.PrincipalID);
2523 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); 2524 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName);
2524 } 2525 }
2525 } 2526 }
@@ -2595,21 +2596,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2595 2596
2596 if (requestData.Contains("users")) 2597 if (requestData.Contains("users"))
2597 { 2598 {
2598 UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2599 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2600 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
2601 //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
2599 Scene s = m_app.SceneManager.CurrentScene; 2602 Scene s = m_app.SceneManager.CurrentScene;
2600 Hashtable users = (Hashtable) requestData["users"]; 2603 Hashtable users = (Hashtable) requestData["users"];
2601 List<UUID> uuids = new List<UUID>(); 2604 List<UUID> uuids = new List<UUID>();
2602 foreach (string name in users.Values) 2605 foreach (string name in users.Values)
2603 { 2606 {
2604 string[] parts = name.Split(); 2607 string[] parts = name.Split();
2605 CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); 2608 UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
2606 if (udata != null) 2609 if (account != null)
2607 { 2610 {
2608 uuids.Add(udata.UserProfile.ID); 2611 uuids.Add(account.PrincipalID);
2609 } 2612 }
2610 } 2613 }
2611 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); 2614 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess);
2612 foreach (UUID uuid in uuids) 2615 foreach (UUID uuid in uuids)
2613 { 2616 {
2614 if (acl.Contains(uuid)) 2617 if (acl.Contains(uuid))
2615 { 2618 {
@@ -2682,10 +2685,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2682 2685
2683 foreach (UUID user in acl) 2686 foreach (UUID user in acl)
2684 { 2687 {
2685 CachedUserInfo udata = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user); 2688 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2686 if (udata != null) 2689 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user);
2690 if (account != null)
2687 { 2691 {
2688 users[user.ToString()] = udata.UserProfile.Name; 2692 users[user.ToString()] = account.FirstName + " " + account.LastName;
2689 } 2693 }
2690 } 2694 }
2691 2695