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