diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 496 |
1 files changed, 249 insertions, 247 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9400788..457177d 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 | { |
@@ -582,39 +584,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
582 | { | 584 | { |
583 | // ok, client wants us to use an explicit UUID | 585 | // ok, client wants us to use an explicit UUID |
584 | // regardless of what the avatar name provided | 586 | // regardless of what the avatar name provided |
585 | userID = new UUID((string) requestData["region_master_uuid"]); | 587 | userID = new UUID((string) requestData["estate_owner_uuid"]); |
586 | } | 588 | } |
587 | else | ||
588 | { | ||
589 | if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar | ||
590 | { | ||
591 | // no client supplied UUID: look it up... | ||
592 | CachedUserInfo userInfo | ||
593 | = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails( | ||
594 | masterFirst, masterLast); | ||
595 | |||
596 | if (null == userInfo) | ||
597 | { | ||
598 | m_log.InfoFormat("master avatar does not exist, creating it"); | ||
599 | // ...or create new user | ||
600 | userID = m_app.CommunicationsManager.UserAdminService.AddUser( | ||
601 | masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY); | ||
602 | |||
603 | if (userID == UUID.Zero) | ||
604 | throw new Exception(String.Format("failed to create new user {0} {1}", | ||
605 | masterFirst, masterLast)); | ||
606 | } | ||
607 | else | ||
608 | { | ||
609 | userID = userInfo.UserProfile.ID; | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | |||
614 | region.MasterAvatarFirstName = masterFirst; | ||
615 | region.MasterAvatarLastName = masterLast; | ||
616 | region.MasterAvatarSandboxPassword = masterPassword; | ||
617 | region.MasterAvatarAssignedUUID = userID; | ||
618 | 589 | ||
619 | bool persist = Convert.ToBoolean((string) requestData["persist"]); | 590 | bool persist = Convert.ToBoolean((string) requestData["persist"]); |
620 | if (persist) | 591 | if (persist) |
@@ -659,6 +630,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
659 | // If an access specification was provided, use it. | 630 | // If an access specification was provided, use it. |
660 | // Otherwise accept the default. | 631 | // Otherwise accept the default. |
661 | newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); | 632 | newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); |
633 | newscene.RegionInfo.EstateSettings.EstateOwner = userID; | ||
662 | if (persist) | 634 | if (persist) |
663 | newscene.RegionInfo.EstateSettings.Save(); | 635 | newscene.RegionInfo.EstateSettings.Save(); |
664 | 636 | ||
@@ -1032,30 +1004,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1032 | if (requestData.Contains("user_email")) | 1004 | if (requestData.Contains("user_email")) |
1033 | email = (string)requestData["user_email"]; | 1005 | email = (string)requestData["user_email"]; |
1034 | 1006 | ||
1035 | CachedUserInfo userInfo = | 1007 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1036 | m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); | ||
1037 | 1008 | ||
1038 | if (null != userInfo) | 1009 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); |
1039 | throw new Exception(String.Format("Avatar {0} {1} already exists", firstname, lastname)); | ||
1040 | 1010 | ||
1041 | UUID userID = | 1011 | if (null != account) |
1042 | m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname, | 1012 | throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname)); |
1043 | passwd, email, regX, regY); | ||
1044 | 1013 | ||
1045 | if (userID == UUID.Zero) | 1014 | account = new UserAccount(scopeID, firstname, lastname, email); |
1015 | // REFACTORING PROBLEM: no method to set the password! | ||
1016 | |||
1017 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); | ||
1018 | |||
1019 | if (!success) | ||
1046 | throw new Exception(String.Format("failed to create new user {0} {1}", | 1020 | throw new Exception(String.Format("failed to create new user {0} {1}", |
1047 | firstname, lastname)); | 1021 | firstname, lastname)); |
1048 | 1022 | ||
1023 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | ||
1024 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1025 | if (home == null) | ||
1026 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); | ||
1027 | |||
1049 | // Establish the avatar's initial appearance | 1028 | // Establish the avatar's initial appearance |
1050 | 1029 | ||
1051 | updateUserAppearance(responseData, requestData, userID); | 1030 | updateUserAppearance(responseData, requestData, account.PrincipalID); |
1052 | 1031 | ||
1053 | responseData["success"] = true; | 1032 | responseData["success"] = true; |
1054 | responseData["avatar_uuid"] = userID.ToString(); | 1033 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); |
1055 | 1034 | ||
1056 | response.Value = responseData; | 1035 | response.Value = responseData; |
1057 | 1036 | ||
1058 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); | 1037 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID); |
1059 | } | 1038 | } |
1060 | catch (Exception e) | 1039 | catch (Exception e) |
1061 | { | 1040 | { |
@@ -1124,21 +1103,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1124 | string firstname = (string) requestData["user_firstname"]; | 1103 | string firstname = (string) requestData["user_firstname"]; |
1125 | string lastname = (string) requestData["user_lastname"]; | 1104 | string lastname = (string) requestData["user_lastname"]; |
1126 | 1105 | ||
1127 | CachedUserInfo userInfo | ||
1128 | = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); | ||
1129 | |||
1130 | responseData["user_firstname"] = firstname; | 1106 | responseData["user_firstname"] = firstname; |
1131 | responseData["user_lastname"] = lastname; | 1107 | responseData["user_lastname"] = lastname; |
1132 | 1108 | ||
1133 | if (null == userInfo) | 1109 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1110 | |||
1111 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | ||
1112 | |||
1113 | if (null == account) | ||
1134 | { | 1114 | { |
1135 | responseData["success"] = false; | 1115 | responseData["success"] = false; |
1136 | responseData["lastlogin"] = 0; | 1116 | responseData["lastlogin"] = 0; |
1137 | } | 1117 | } |
1138 | else | 1118 | else |
1139 | { | 1119 | { |
1120 | PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() }); | ||
1121 | if (pinfos != null && pinfos.Length >= 1) | ||
1122 | responseData["lastlogin"] = pinfos[0].Login; | ||
1123 | else | ||
1124 | responseData["lastlogin"] = 0; | ||
1125 | |||
1140 | responseData["success"] = true; | 1126 | responseData["success"] = true; |
1141 | responseData["lastlogin"] = userInfo.UserProfile.LastLogin; | ||
1142 | } | 1127 | } |
1143 | 1128 | ||
1144 | response.Value = responseData; | 1129 | response.Value = responseData; |
@@ -1200,117 +1185,118 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1200 | public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 1185 | public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
1201 | { | 1186 | { |
1202 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); | 1187 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); |
1188 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); | ||
1203 | XmlRpcResponse response = new XmlRpcResponse(); | 1189 | XmlRpcResponse response = new XmlRpcResponse(); |
1204 | Hashtable responseData = new Hashtable(); | 1190 | Hashtable responseData = new Hashtable(); |
1205 | 1191 | ||
1206 | lock (rslock) | 1192 | //lock (rslock) |
1207 | { | 1193 | //{ |
1208 | try | 1194 | // try |
1209 | { | 1195 | // { |
1210 | Hashtable requestData = (Hashtable) request.Params[0]; | 1196 | // Hashtable requestData = (Hashtable) request.Params[0]; |
1211 | 1197 | ||
1212 | // check completeness | 1198 | // // check completeness |
1213 | checkStringParameters(request, new string[] { | 1199 | // checkStringParameters(request, new string[] { |
1214 | "password", "user_firstname", | 1200 | // "password", "user_firstname", |
1215 | "user_lastname"}); | 1201 | // "user_lastname"}); |
1216 | 1202 | ||
1217 | // check password | 1203 | // // check password |
1218 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 1204 | // if (!String.IsNullOrEmpty(m_requiredPassword) && |
1219 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 1205 | // (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
1220 | 1206 | ||
1221 | // do the job | 1207 | // // do the job |
1222 | string firstname = (string) requestData["user_firstname"]; | 1208 | // string firstname = (string) requestData["user_firstname"]; |
1223 | string lastname = (string) requestData["user_lastname"]; | 1209 | // string lastname = (string) requestData["user_lastname"]; |
1224 | 1210 | ||
1225 | string passwd = String.Empty; | 1211 | // string passwd = String.Empty; |
1226 | uint? regX = null; | 1212 | // uint? regX = null; |
1227 | uint? regY = null; | 1213 | // uint? regY = null; |
1228 | uint? ulaX = null; | 1214 | // uint? ulaX = null; |
1229 | uint? ulaY = null; | 1215 | // uint? ulaY = null; |
1230 | uint? ulaZ = null; | 1216 | // uint? ulaZ = null; |
1231 | uint? usaX = null; | 1217 | // uint? usaX = null; |
1232 | uint? usaY = null; | 1218 | // uint? usaY = null; |
1233 | uint? usaZ = null; | 1219 | // uint? usaZ = null; |
1234 | string aboutFirstLive = String.Empty; | 1220 | // string aboutFirstLive = String.Empty; |
1235 | string aboutAvatar = String.Empty; | 1221 | // string aboutAvatar = String.Empty; |
1236 | 1222 | ||
1237 | if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; | 1223 | // if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; |
1238 | if (requestData.ContainsKey("start_region_x")) | 1224 | // if (requestData.ContainsKey("start_region_x")) |
1239 | regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1225 | // regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1240 | if (requestData.ContainsKey("start_region_y")) | 1226 | // if (requestData.ContainsKey("start_region_y")) |
1241 | regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1227 | // regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1242 | 1228 | ||
1243 | if (requestData.ContainsKey("start_lookat_x")) | 1229 | // if (requestData.ContainsKey("start_lookat_x")) |
1244 | ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); | 1230 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); |
1245 | if (requestData.ContainsKey("start_lookat_y")) | 1231 | // if (requestData.ContainsKey("start_lookat_y")) |
1246 | ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); | 1232 | // ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); |
1247 | if (requestData.ContainsKey("start_lookat_z")) | 1233 | // if (requestData.ContainsKey("start_lookat_z")) |
1248 | ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); | 1234 | // ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); |
1249 | 1235 | ||
1250 | if (requestData.ContainsKey("start_standat_x")) | 1236 | // if (requestData.ContainsKey("start_standat_x")) |
1251 | usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); | 1237 | // usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); |
1252 | if (requestData.ContainsKey("start_standat_y")) | 1238 | // if (requestData.ContainsKey("start_standat_y")) |
1253 | usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); | 1239 | // usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); |
1254 | if (requestData.ContainsKey("start_standat_z")) | 1240 | // if (requestData.ContainsKey("start_standat_z")) |
1255 | usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); | 1241 | // usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); |
1256 | if (requestData.ContainsKey("about_real_world")) | 1242 | // if (requestData.ContainsKey("about_real_world")) |
1257 | aboutFirstLive = (string)requestData["about_real_world"]; | 1243 | // aboutFirstLive = (string)requestData["about_real_world"]; |
1258 | if (requestData.ContainsKey("about_virtual_world")) | 1244 | // if (requestData.ContainsKey("about_virtual_world")) |
1259 | aboutAvatar = (string)requestData["about_virtual_world"]; | 1245 | // aboutAvatar = (string)requestData["about_virtual_world"]; |
1260 | 1246 | ||
1261 | UserProfileData userProfile | 1247 | // UserProfileData userProfile |
1262 | = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); | 1248 | // = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); |
1263 | 1249 | ||
1264 | if (null == userProfile) | 1250 | // if (null == userProfile) |
1265 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); | 1251 | // throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); |
1266 | 1252 | ||
1267 | if (!String.IsNullOrEmpty(passwd)) | 1253 | // if (!String.IsNullOrEmpty(passwd)) |
1268 | { | 1254 | // { |
1269 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); | 1255 | // m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); |
1270 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); | 1256 | // string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); |
1271 | userProfile.PasswordHash = md5PasswdHash; | 1257 | // userProfile.PasswordHash = md5PasswdHash; |
1272 | } | 1258 | // } |
1273 | 1259 | ||
1274 | if (null != regX) userProfile.HomeRegionX = (uint) regX; | 1260 | // if (null != regX) userProfile.HomeRegionX = (uint) regX; |
1275 | if (null != regY) userProfile.HomeRegionY = (uint) regY; | 1261 | // if (null != regY) userProfile.HomeRegionY = (uint) regY; |
1276 | 1262 | ||
1277 | if (null != usaX) userProfile.HomeLocationX = (uint) usaX; | 1263 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; |
1278 | if (null != usaY) userProfile.HomeLocationY = (uint) usaY; | 1264 | // if (null != usaY) userProfile.HomeLocationY = (uint) usaY; |
1279 | if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; | 1265 | // if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; |
1280 | 1266 | ||
1281 | if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; | 1267 | // if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; |
1282 | if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; | 1268 | // if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; |
1283 | if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; | 1269 | // if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; |
1284 | 1270 | ||
1285 | if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; | 1271 | // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; |
1286 | if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; | 1272 | // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; |
1287 | 1273 | ||
1288 | // User has been created. Now establish gender and appearance. | 1274 | // // User has been created. Now establish gender and appearance. |
1289 | 1275 | ||
1290 | updateUserAppearance(responseData, requestData, userProfile.ID); | 1276 | // updateUserAppearance(responseData, requestData, userProfile.ID); |
1291 | 1277 | ||
1292 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) | 1278 | // if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) |
1293 | throw new Exception("did not manage to update user profile"); | 1279 | // throw new Exception("did not manage to update user profile"); |
1294 | 1280 | ||
1295 | responseData["success"] = true; | 1281 | // responseData["success"] = true; |
1296 | 1282 | ||
1297 | response.Value = responseData; | 1283 | // response.Value = responseData; |
1298 | 1284 | ||
1299 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", | 1285 | // m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", |
1300 | firstname, lastname, | 1286 | // firstname, lastname, |
1301 | userProfile.ID); | 1287 | // userProfile.ID); |
1302 | } | 1288 | // } |
1303 | catch (Exception e) | 1289 | // catch (Exception e) |
1304 | { | 1290 | // { |
1305 | m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); | 1291 | // m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); |
1306 | m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); | 1292 | // m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); |
1307 | 1293 | ||
1308 | responseData["success"] = false; | 1294 | // responseData["success"] = false; |
1309 | responseData["error"] = e.Message; | 1295 | // responseData["error"] = e.Message; |
1310 | 1296 | ||
1311 | response.Value = responseData; | 1297 | // response.Value = responseData; |
1312 | } | 1298 | // } |
1313 | } | 1299 | //} |
1314 | 1300 | ||
1315 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); | 1301 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); |
1316 | return response; | 1302 | return response; |
@@ -1327,72 +1313,73 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1327 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) | 1313 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) |
1328 | { | 1314 | { |
1329 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); | 1315 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); |
1316 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); | ||
1330 | 1317 | ||
1331 | string dmale = m_config.GetString("default_male", "Default Male"); | 1318 | //string dmale = m_config.GetString("default_male", "Default Male"); |
1332 | string dfemale = m_config.GetString("default_female", "Default Female"); | 1319 | //string dfemale = m_config.GetString("default_female", "Default Female"); |
1333 | string dneut = m_config.GetString("default_female", "Default Default"); | 1320 | //string dneut = m_config.GetString("default_female", "Default Default"); |
1334 | string model = String.Empty; | 1321 | string model = String.Empty; |
1335 | 1322 | ||
1336 | // Has a gender preference been supplied? | 1323 | //// Has a gender preference been supplied? |
1337 | 1324 | ||
1338 | if (requestData.Contains("gender")) | 1325 | //if (requestData.Contains("gender")) |
1339 | { | 1326 | //{ |
1340 | switch ((string)requestData["gender"]) | 1327 | // switch ((string)requestData["gender"]) |
1341 | { | 1328 | // { |
1342 | case "m" : | 1329 | // case "m" : |
1343 | model = dmale; | 1330 | // model = dmale; |
1344 | break; | 1331 | // break; |
1345 | case "f" : | 1332 | // case "f" : |
1346 | model = dfemale; | 1333 | // model = dfemale; |
1347 | break; | 1334 | // break; |
1348 | case "n" : | 1335 | // case "n" : |
1349 | default : | 1336 | // default : |
1350 | model = dneut; | 1337 | // model = dneut; |
1351 | break; | 1338 | // break; |
1352 | } | 1339 | // } |
1353 | } | 1340 | //} |
1354 | 1341 | ||
1355 | // Has an explicit model been specified? | 1342 | //// Has an explicit model been specified? |
1356 | 1343 | ||
1357 | if (requestData.Contains("model")) | 1344 | //if (requestData.Contains("model")) |
1358 | { | 1345 | //{ |
1359 | model = (string)requestData["model"]; | 1346 | // model = (string)requestData["model"]; |
1360 | } | 1347 | //} |
1361 | 1348 | ||
1362 | // No appearance attributes were set | 1349 | //// No appearance attributes were set |
1363 | 1350 | ||
1364 | if (model == String.Empty) | 1351 | //if (model == String.Empty) |
1365 | { | 1352 | //{ |
1366 | m_log.DebugFormat("[RADMIN] Appearance update not requested"); | 1353 | // m_log.DebugFormat("[RADMIN] Appearance update not requested"); |
1367 | return; | 1354 | // return; |
1368 | } | 1355 | //} |
1369 | 1356 | ||
1370 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); | 1357 | //m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); |
1371 | 1358 | ||
1372 | string[] nomens = model.Split(); | 1359 | //string[] nomens = model.Split(); |
1373 | if (nomens.Length != 2) | 1360 | //if (nomens.Length != 2) |
1374 | { | 1361 | //{ |
1375 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); | 1362 | // m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); |
1376 | // nomens = dmodel.Split(); | 1363 | // // nomens = dmodel.Split(); |
1377 | return; | 1364 | // return; |
1378 | } | 1365 | //} |
1379 | 1366 | ||
1380 | UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); | 1367 | //UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); |
1381 | 1368 | ||
1382 | // Is this the first time one of the default models has been used? Create it if that is the case | 1369 | //// Is this the first time one of the default models has been used? Create it if that is the case |
1383 | // otherwise default to male. | 1370 | //// otherwise default to male. |
1384 | 1371 | ||
1385 | if (mprof == null) | 1372 | //if (mprof == null) |
1386 | { | 1373 | //{ |
1387 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); | 1374 | // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); |
1388 | return; | 1375 | // return; |
1389 | } | 1376 | //} |
1390 | 1377 | ||
1391 | // Set current user's appearance. This bit is easy. The appearance structure is populated with | 1378 | //// Set current user's appearance. This bit is easy. The appearance structure is populated with |
1392 | // actual asset ids, however to complete the magic we need to populate the inventory with the | 1379 | //// actual asset ids, however to complete the magic we need to populate the inventory with the |
1393 | // assets in question. | 1380 | //// assets in question. |
1394 | 1381 | ||
1395 | establishAppearance(userid, mprof.ID); | 1382 | //establishAppearance(userid, mprof.ID); |
1396 | 1383 | ||
1397 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", | 1384 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", |
1398 | userid, model); | 1385 | userid, model); |
@@ -1407,8 +1394,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1407 | private void establishAppearance(UUID dest, UUID srca) | 1394 | private void establishAppearance(UUID dest, UUID srca) |
1408 | { | 1395 | { |
1409 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); | 1396 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); |
1410 | 1397 | AvatarAppearance ava = null; | |
1411 | AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(srca); | 1398 | AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca); |
1399 | if (avatar != null) | ||
1400 | ava = avatar.ToAvatarAppearance(srca); | ||
1412 | 1401 | ||
1413 | // If the model has no associated appearance we're done. | 1402 | // If the model has no associated appearance we're done. |
1414 | 1403 | ||
@@ -1501,7 +1490,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1501 | throw new Exception("Unable to load both inventories"); | 1490 | throw new Exception("Unable to load both inventories"); |
1502 | } | 1491 | } |
1503 | 1492 | ||
1504 | m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava); | 1493 | AvatarData adata = new AvatarData(ava); |
1494 | m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(dest, adata); | ||
1505 | } | 1495 | } |
1506 | catch (Exception e) | 1496 | catch (Exception e) |
1507 | { | 1497 | { |
@@ -1556,7 +1546,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1556 | uint regX = 1000; | 1546 | uint regX = 1000; |
1557 | uint regY = 1000; | 1547 | uint regY = 1000; |
1558 | string passwd = UUID.Random().ToString(); // No requirement to sign-in. | 1548 | string passwd = UUID.Random().ToString(); // No requirement to sign-in. |
1559 | CachedUserInfo UI; | ||
1560 | UUID ID = UUID.Zero; | 1549 | UUID ID = UUID.Zero; |
1561 | AvatarAppearance mava; | 1550 | AvatarAppearance mava; |
1562 | XmlNodeList avatars; | 1551 | XmlNodeList avatars; |
@@ -1604,20 +1593,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1604 | passwd = GetStringAttribute(avatar,"password",passwd); | 1593 | passwd = GetStringAttribute(avatar,"password",passwd); |
1605 | 1594 | ||
1606 | string[] nomens = name.Split(); | 1595 | string[] nomens = name.Split(); |
1607 | UI = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(nomens[0], nomens[1]); | 1596 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1608 | if (null == UI) | 1597 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); |
1598 | if (null == account) | ||
1609 | { | 1599 | { |
1610 | ID = m_app.CommunicationsManager.UserAdminService.AddUser(nomens[0], nomens[1], | 1600 | account = new UserAccount(scopeID, nomens[0], nomens[1], email); |
1611 | passwd, email, regX, regY); | 1601 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); |
1612 | if (ID == UUID.Zero) | 1602 | if (!success) |
1613 | { | 1603 | { |
1614 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); | 1604 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); |
1615 | return false; | 1605 | return false; |
1616 | } | 1606 | } |
1607 | // !!! REFACTORING PROBLEM: need to set the password | ||
1608 | |||
1609 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | ||
1610 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1611 | if (home != null) | ||
1612 | m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1617 | } | 1613 | } |
1618 | else | 1614 | else |
1619 | { | 1615 | { |
1620 | ID = UI.UserProfile.ID; | 1616 | ID = account.PrincipalID; |
1621 | } | 1617 | } |
1622 | 1618 | ||
1623 | m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); | 1619 | m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); |
@@ -1641,10 +1637,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1641 | iserv.GetUserInventory(ID, uic.callback); | 1637 | iserv.GetUserInventory(ID, uic.callback); |
1642 | 1638 | ||
1643 | // While the inventory is being fetched, setup for appearance processing | 1639 | // While the inventory is being fetched, setup for appearance processing |
1644 | if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null) | 1640 | AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID); |
1645 | { | 1641 | if (adata != null) |
1642 | mava = adata.ToAvatarAppearance(ID); | ||
1643 | else | ||
1646 | mava = new AvatarAppearance(); | 1644 | mava = new AvatarAppearance(); |
1647 | } | ||
1648 | 1645 | ||
1649 | { | 1646 | { |
1650 | AvatarWearable[] wearables = mava.Wearables; | 1647 | AvatarWearable[] wearables = mava.Wearables; |
@@ -1779,7 +1776,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1779 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); | 1776 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); |
1780 | } // foreach outfit | 1777 | } // foreach outfit |
1781 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); | 1778 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); |
1782 | m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(ID, mava); | 1779 | AvatarData adata2 = new AvatarData(mava); |
1780 | m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(ID, adata2); | ||
1783 | } | 1781 | } |
1784 | catch (Exception e) | 1782 | catch (Exception e) |
1785 | { | 1783 | { |
@@ -2391,17 +2389,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2391 | 2389 | ||
2392 | if (requestData.Contains("users")) | 2390 | if (requestData.Contains("users")) |
2393 | { | 2391 | { |
2394 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 2392 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2393 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | ||
2395 | Scene s = m_app.SceneManager.CurrentScene; | 2394 | Scene s = m_app.SceneManager.CurrentScene; |
2396 | Hashtable users = (Hashtable) requestData["users"]; | 2395 | Hashtable users = (Hashtable) requestData["users"]; |
2397 | List<UUID> uuids = new List<UUID>(); | 2396 | List<UUID> uuids = new List<UUID>(); |
2398 | foreach (string name in users.Values) | 2397 | foreach (string name in users.Values) |
2399 | { | 2398 | { |
2400 | string[] parts = name.Split(); | 2399 | string[] parts = name.Split(); |
2401 | CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); | 2400 | UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]); |
2402 | if (udata != null) | 2401 | if (account != null) |
2403 | { | 2402 | { |
2404 | uuids.Add(udata.UserProfile.ID); | 2403 | uuids.Add(account.PrincipalID); |
2405 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); | 2404 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); |
2406 | } | 2405 | } |
2407 | } | 2406 | } |
@@ -2477,21 +2476,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2477 | 2476 | ||
2478 | if (requestData.Contains("users")) | 2477 | if (requestData.Contains("users")) |
2479 | { | 2478 | { |
2480 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 2479 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2480 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | ||
2481 | //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | ||
2481 | Scene s = m_app.SceneManager.CurrentScene; | 2482 | Scene s = m_app.SceneManager.CurrentScene; |
2482 | Hashtable users = (Hashtable) requestData["users"]; | 2483 | Hashtable users = (Hashtable) requestData["users"]; |
2483 | List<UUID> uuids = new List<UUID>(); | 2484 | List<UUID> uuids = new List<UUID>(); |
2484 | foreach (string name in users.Values) | 2485 | foreach (string name in users.Values) |
2485 | { | 2486 | { |
2486 | string[] parts = name.Split(); | 2487 | string[] parts = name.Split(); |
2487 | CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); | 2488 | UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]); |
2488 | if (udata != null) | 2489 | if (account != null) |
2489 | { | 2490 | { |
2490 | uuids.Add(udata.UserProfile.ID); | 2491 | uuids.Add(account.PrincipalID); |
2491 | } | 2492 | } |
2492 | } | 2493 | } |
2493 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 2494 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); |
2494 | foreach (UUID uuid in uuids) | 2495 | foreach (UUID uuid in uuids) |
2495 | { | 2496 | { |
2496 | if (acl.Contains(uuid)) | 2497 | if (acl.Contains(uuid)) |
2497 | { | 2498 | { |
@@ -2564,10 +2565,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2564 | 2565 | ||
2565 | foreach (UUID user in acl) | 2566 | foreach (UUID user in acl) |
2566 | { | 2567 | { |
2567 | CachedUserInfo udata = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user); | 2568 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2568 | if (udata != null) | 2569 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); |
2570 | if (account != null) | ||
2569 | { | 2571 | { |
2570 | users[user.ToString()] = udata.UserProfile.Name; | 2572 | users[user.ToString()] = account.FirstName + " " + account.LastName; |
2571 | } | 2573 | } |
2572 | } | 2574 | } |
2573 | 2575 | ||