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