diff options
author | Diva Canto | 2010-01-08 10:43:34 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-08 10:43:34 -0800 |
commit | b63405c1a796b44b58081857d01f726372467628 (patch) | |
tree | 564d03059ed55f7b0740fd00e6dd7d1e34edea5d /OpenSim/ApplicationPlugins/RemoteController | |
parent | * Finished SimulationServiceConnector (diff) | |
download | opensim-SC_OLD-b63405c1a796b44b58081857d01f726372467628.zip opensim-SC_OLD-b63405c1a796b44b58081857d01f726372467628.tar.gz opensim-SC_OLD-b63405c1a796b44b58081857d01f726372467628.tar.bz2 opensim-SC_OLD-b63405c1a796b44b58081857d01f726372467628.tar.xz |
Inching ahead... This compiles, but very likely does not run.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 433 |
1 files changed, 230 insertions, 203 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9400788..d6d5700 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -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 | { |
@@ -1032,30 +1034,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1032 | if (requestData.Contains("user_email")) | 1034 | if (requestData.Contains("user_email")) |
1033 | email = (string)requestData["user_email"]; | 1035 | email = (string)requestData["user_email"]; |
1034 | 1036 | ||
1035 | CachedUserInfo userInfo = | 1037 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1036 | m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); | ||
1037 | 1038 | ||
1038 | if (null != userInfo) | 1039 | 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 | 1040 | ||
1041 | UUID userID = | 1041 | if (null != account) |
1042 | m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname, | 1042 | throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname)); |
1043 | passwd, email, regX, regY); | ||
1044 | 1043 | ||
1045 | if (userID == UUID.Zero) | 1044 | account = new UserAccount(scopeID, firstname, lastname, email); |
1045 | // REFACTORING PROBLEM: no method to set the password! | ||
1046 | |||
1047 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); | ||
1048 | |||
1049 | if (!success) | ||
1046 | throw new Exception(String.Format("failed to create new user {0} {1}", | 1050 | throw new Exception(String.Format("failed to create new user {0} {1}", |
1047 | firstname, lastname)); | 1051 | firstname, lastname)); |
1048 | 1052 | ||
1053 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | ||
1054 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1055 | if (home == null) | ||
1056 | m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname); | ||
1057 | |||
1049 | // Establish the avatar's initial appearance | 1058 | // Establish the avatar's initial appearance |
1050 | 1059 | ||
1051 | updateUserAppearance(responseData, requestData, userID); | 1060 | updateUserAppearance(responseData, requestData, account.PrincipalID); |
1052 | 1061 | ||
1053 | responseData["success"] = true; | 1062 | responseData["success"] = true; |
1054 | responseData["avatar_uuid"] = userID.ToString(); | 1063 | responseData["avatar_uuid"] = account.PrincipalID.ToString(); |
1055 | 1064 | ||
1056 | response.Value = responseData; | 1065 | response.Value = responseData; |
1057 | 1066 | ||
1058 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); | 1067 | m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID); |
1059 | } | 1068 | } |
1060 | catch (Exception e) | 1069 | catch (Exception e) |
1061 | { | 1070 | { |
@@ -1124,21 +1133,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1124 | string firstname = (string) requestData["user_firstname"]; | 1133 | string firstname = (string) requestData["user_firstname"]; |
1125 | string lastname = (string) requestData["user_lastname"]; | 1134 | string lastname = (string) requestData["user_lastname"]; |
1126 | 1135 | ||
1127 | CachedUserInfo userInfo | ||
1128 | = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname); | ||
1129 | |||
1130 | responseData["user_firstname"] = firstname; | 1136 | responseData["user_firstname"] = firstname; |
1131 | responseData["user_lastname"] = lastname; | 1137 | responseData["user_lastname"] = lastname; |
1132 | 1138 | ||
1133 | if (null == userInfo) | 1139 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1140 | |||
1141 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname); | ||
1142 | |||
1143 | if (null == account) | ||
1134 | { | 1144 | { |
1135 | responseData["success"] = false; | 1145 | responseData["success"] = false; |
1136 | responseData["lastlogin"] = 0; | 1146 | responseData["lastlogin"] = 0; |
1137 | } | 1147 | } |
1138 | else | 1148 | else |
1139 | { | 1149 | { |
1150 | PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() }); | ||
1151 | if (pinfos != null && pinfos.Length >= 1) | ||
1152 | responseData["lastlogin"] = pinfos[0].Login; | ||
1153 | else | ||
1154 | responseData["lastlogin"] = 0; | ||
1155 | |||
1140 | responseData["success"] = true; | 1156 | responseData["success"] = true; |
1141 | responseData["lastlogin"] = userInfo.UserProfile.LastLogin; | ||
1142 | } | 1157 | } |
1143 | 1158 | ||
1144 | response.Value = responseData; | 1159 | response.Value = responseData; |
@@ -1200,117 +1215,118 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1200 | public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 1215 | public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
1201 | { | 1216 | { |
1202 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); | 1217 | m_log.Info("[RADMIN]: UpdateUserAccount: new request"); |
1218 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); | ||
1203 | XmlRpcResponse response = new XmlRpcResponse(); | 1219 | XmlRpcResponse response = new XmlRpcResponse(); |
1204 | Hashtable responseData = new Hashtable(); | 1220 | Hashtable responseData = new Hashtable(); |
1205 | 1221 | ||
1206 | lock (rslock) | 1222 | //lock (rslock) |
1207 | { | 1223 | //{ |
1208 | try | 1224 | // try |
1209 | { | 1225 | // { |
1210 | Hashtable requestData = (Hashtable) request.Params[0]; | 1226 | // Hashtable requestData = (Hashtable) request.Params[0]; |
1211 | 1227 | ||
1212 | // check completeness | 1228 | // // check completeness |
1213 | checkStringParameters(request, new string[] { | 1229 | // checkStringParameters(request, new string[] { |
1214 | "password", "user_firstname", | 1230 | // "password", "user_firstname", |
1215 | "user_lastname"}); | 1231 | // "user_lastname"}); |
1216 | 1232 | ||
1217 | // check password | 1233 | // // check password |
1218 | if (!String.IsNullOrEmpty(m_requiredPassword) && | 1234 | // if (!String.IsNullOrEmpty(m_requiredPassword) && |
1219 | (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); | 1235 | // (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); |
1220 | 1236 | ||
1221 | // do the job | 1237 | // // do the job |
1222 | string firstname = (string) requestData["user_firstname"]; | 1238 | // string firstname = (string) requestData["user_firstname"]; |
1223 | string lastname = (string) requestData["user_lastname"]; | 1239 | // string lastname = (string) requestData["user_lastname"]; |
1224 | 1240 | ||
1225 | string passwd = String.Empty; | 1241 | // string passwd = String.Empty; |
1226 | uint? regX = null; | 1242 | // uint? regX = null; |
1227 | uint? regY = null; | 1243 | // uint? regY = null; |
1228 | uint? ulaX = null; | 1244 | // uint? ulaX = null; |
1229 | uint? ulaY = null; | 1245 | // uint? ulaY = null; |
1230 | uint? ulaZ = null; | 1246 | // uint? ulaZ = null; |
1231 | uint? usaX = null; | 1247 | // uint? usaX = null; |
1232 | uint? usaY = null; | 1248 | // uint? usaY = null; |
1233 | uint? usaZ = null; | 1249 | // uint? usaZ = null; |
1234 | string aboutFirstLive = String.Empty; | 1250 | // string aboutFirstLive = String.Empty; |
1235 | string aboutAvatar = String.Empty; | 1251 | // string aboutAvatar = String.Empty; |
1236 | 1252 | ||
1237 | if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; | 1253 | // if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; |
1238 | if (requestData.ContainsKey("start_region_x")) | 1254 | // if (requestData.ContainsKey("start_region_x")) |
1239 | regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); | 1255 | // regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); |
1240 | if (requestData.ContainsKey("start_region_y")) | 1256 | // if (requestData.ContainsKey("start_region_y")) |
1241 | regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); | 1257 | // regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); |
1242 | 1258 | ||
1243 | if (requestData.ContainsKey("start_lookat_x")) | 1259 | // if (requestData.ContainsKey("start_lookat_x")) |
1244 | ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); | 1260 | // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); |
1245 | if (requestData.ContainsKey("start_lookat_y")) | 1261 | // if (requestData.ContainsKey("start_lookat_y")) |
1246 | ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); | 1262 | // ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); |
1247 | if (requestData.ContainsKey("start_lookat_z")) | 1263 | // if (requestData.ContainsKey("start_lookat_z")) |
1248 | ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); | 1264 | // ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); |
1249 | 1265 | ||
1250 | if (requestData.ContainsKey("start_standat_x")) | 1266 | // if (requestData.ContainsKey("start_standat_x")) |
1251 | usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); | 1267 | // usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); |
1252 | if (requestData.ContainsKey("start_standat_y")) | 1268 | // if (requestData.ContainsKey("start_standat_y")) |
1253 | usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); | 1269 | // usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); |
1254 | if (requestData.ContainsKey("start_standat_z")) | 1270 | // if (requestData.ContainsKey("start_standat_z")) |
1255 | usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); | 1271 | // usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); |
1256 | if (requestData.ContainsKey("about_real_world")) | 1272 | // if (requestData.ContainsKey("about_real_world")) |
1257 | aboutFirstLive = (string)requestData["about_real_world"]; | 1273 | // aboutFirstLive = (string)requestData["about_real_world"]; |
1258 | if (requestData.ContainsKey("about_virtual_world")) | 1274 | // if (requestData.ContainsKey("about_virtual_world")) |
1259 | aboutAvatar = (string)requestData["about_virtual_world"]; | 1275 | // aboutAvatar = (string)requestData["about_virtual_world"]; |
1260 | 1276 | ||
1261 | UserProfileData userProfile | 1277 | // UserProfileData userProfile |
1262 | = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); | 1278 | // = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); |
1263 | 1279 | ||
1264 | if (null == userProfile) | 1280 | // if (null == userProfile) |
1265 | throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); | 1281 | // throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); |
1266 | 1282 | ||
1267 | if (!String.IsNullOrEmpty(passwd)) | 1283 | // if (!String.IsNullOrEmpty(passwd)) |
1268 | { | 1284 | // { |
1269 | m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); | 1285 | // m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); |
1270 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); | 1286 | // string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); |
1271 | userProfile.PasswordHash = md5PasswdHash; | 1287 | // userProfile.PasswordHash = md5PasswdHash; |
1272 | } | 1288 | // } |
1273 | 1289 | ||
1274 | if (null != regX) userProfile.HomeRegionX = (uint) regX; | 1290 | // if (null != regX) userProfile.HomeRegionX = (uint) regX; |
1275 | if (null != regY) userProfile.HomeRegionY = (uint) regY; | 1291 | // if (null != regY) userProfile.HomeRegionY = (uint) regY; |
1276 | 1292 | ||
1277 | if (null != usaX) userProfile.HomeLocationX = (uint) usaX; | 1293 | // if (null != usaX) userProfile.HomeLocationX = (uint) usaX; |
1278 | if (null != usaY) userProfile.HomeLocationY = (uint) usaY; | 1294 | // if (null != usaY) userProfile.HomeLocationY = (uint) usaY; |
1279 | if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; | 1295 | // if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; |
1280 | 1296 | ||
1281 | if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; | 1297 | // if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; |
1282 | if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; | 1298 | // if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; |
1283 | if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; | 1299 | // if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; |
1284 | 1300 | ||
1285 | if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; | 1301 | // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; |
1286 | if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; | 1302 | // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; |
1287 | 1303 | ||
1288 | // User has been created. Now establish gender and appearance. | 1304 | // // User has been created. Now establish gender and appearance. |
1289 | 1305 | ||
1290 | updateUserAppearance(responseData, requestData, userProfile.ID); | 1306 | // updateUserAppearance(responseData, requestData, userProfile.ID); |
1291 | 1307 | ||
1292 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) | 1308 | // if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) |
1293 | throw new Exception("did not manage to update user profile"); | 1309 | // throw new Exception("did not manage to update user profile"); |
1294 | 1310 | ||
1295 | responseData["success"] = true; | 1311 | // responseData["success"] = true; |
1296 | 1312 | ||
1297 | response.Value = responseData; | 1313 | // response.Value = responseData; |
1298 | 1314 | ||
1299 | m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", | 1315 | // m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", |
1300 | firstname, lastname, | 1316 | // firstname, lastname, |
1301 | userProfile.ID); | 1317 | // userProfile.ID); |
1302 | } | 1318 | // } |
1303 | catch (Exception e) | 1319 | // catch (Exception e) |
1304 | { | 1320 | // { |
1305 | m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); | 1321 | // m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); |
1306 | m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); | 1322 | // m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); |
1307 | 1323 | ||
1308 | responseData["success"] = false; | 1324 | // responseData["success"] = false; |
1309 | responseData["error"] = e.Message; | 1325 | // responseData["error"] = e.Message; |
1310 | 1326 | ||
1311 | response.Value = responseData; | 1327 | // response.Value = responseData; |
1312 | } | 1328 | // } |
1313 | } | 1329 | //} |
1314 | 1330 | ||
1315 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); | 1331 | m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); |
1316 | return response; | 1332 | return response; |
@@ -1327,72 +1343,73 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1327 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) | 1343 | private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) |
1328 | { | 1344 | { |
1329 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); | 1345 | m_log.DebugFormat("[RADMIN] updateUserAppearance"); |
1346 | m_log.Warn("[RADMIN]: This method needs update for 0.7"); | ||
1330 | 1347 | ||
1331 | string dmale = m_config.GetString("default_male", "Default Male"); | 1348 | //string dmale = m_config.GetString("default_male", "Default Male"); |
1332 | string dfemale = m_config.GetString("default_female", "Default Female"); | 1349 | //string dfemale = m_config.GetString("default_female", "Default Female"); |
1333 | string dneut = m_config.GetString("default_female", "Default Default"); | 1350 | //string dneut = m_config.GetString("default_female", "Default Default"); |
1334 | string model = String.Empty; | 1351 | string model = String.Empty; |
1335 | 1352 | ||
1336 | // Has a gender preference been supplied? | 1353 | //// Has a gender preference been supplied? |
1337 | 1354 | ||
1338 | if (requestData.Contains("gender")) | 1355 | //if (requestData.Contains("gender")) |
1339 | { | 1356 | //{ |
1340 | switch ((string)requestData["gender"]) | 1357 | // switch ((string)requestData["gender"]) |
1341 | { | 1358 | // { |
1342 | case "m" : | 1359 | // case "m" : |
1343 | model = dmale; | 1360 | // model = dmale; |
1344 | break; | 1361 | // break; |
1345 | case "f" : | 1362 | // case "f" : |
1346 | model = dfemale; | 1363 | // model = dfemale; |
1347 | break; | 1364 | // break; |
1348 | case "n" : | 1365 | // case "n" : |
1349 | default : | 1366 | // default : |
1350 | model = dneut; | 1367 | // model = dneut; |
1351 | break; | 1368 | // break; |
1352 | } | 1369 | // } |
1353 | } | 1370 | //} |
1354 | 1371 | ||
1355 | // Has an explicit model been specified? | 1372 | //// Has an explicit model been specified? |
1356 | 1373 | ||
1357 | if (requestData.Contains("model")) | 1374 | //if (requestData.Contains("model")) |
1358 | { | 1375 | //{ |
1359 | model = (string)requestData["model"]; | 1376 | // model = (string)requestData["model"]; |
1360 | } | 1377 | //} |
1361 | 1378 | ||
1362 | // No appearance attributes were set | 1379 | //// No appearance attributes were set |
1363 | 1380 | ||
1364 | if (model == String.Empty) | 1381 | //if (model == String.Empty) |
1365 | { | 1382 | //{ |
1366 | m_log.DebugFormat("[RADMIN] Appearance update not requested"); | 1383 | // m_log.DebugFormat("[RADMIN] Appearance update not requested"); |
1367 | return; | 1384 | // return; |
1368 | } | 1385 | //} |
1369 | 1386 | ||
1370 | m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); | 1387 | //m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); |
1371 | 1388 | ||
1372 | string[] nomens = model.Split(); | 1389 | //string[] nomens = model.Split(); |
1373 | if (nomens.Length != 2) | 1390 | //if (nomens.Length != 2) |
1374 | { | 1391 | //{ |
1375 | m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); | 1392 | // m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); |
1376 | // nomens = dmodel.Split(); | 1393 | // // nomens = dmodel.Split(); |
1377 | return; | 1394 | // return; |
1378 | } | 1395 | //} |
1379 | 1396 | ||
1380 | UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); | 1397 | //UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); |
1381 | 1398 | ||
1382 | // Is this the first time one of the default models has been used? Create it if that is the case | 1399 | //// 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. | 1400 | //// otherwise default to male. |
1384 | 1401 | ||
1385 | if (mprof == null) | 1402 | //if (mprof == null) |
1386 | { | 1403 | //{ |
1387 | m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); | 1404 | // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); |
1388 | return; | 1405 | // return; |
1389 | } | 1406 | //} |
1390 | 1407 | ||
1391 | // Set current user's appearance. This bit is easy. The appearance structure is populated with | 1408 | //// 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 | 1409 | //// actual asset ids, however to complete the magic we need to populate the inventory with the |
1393 | // assets in question. | 1410 | //// assets in question. |
1394 | 1411 | ||
1395 | establishAppearance(userid, mprof.ID); | 1412 | //establishAppearance(userid, mprof.ID); |
1396 | 1413 | ||
1397 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", | 1414 | m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", |
1398 | userid, model); | 1415 | userid, model); |
@@ -1604,20 +1621,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1604 | passwd = GetStringAttribute(avatar,"password",passwd); | 1621 | passwd = GetStringAttribute(avatar,"password",passwd); |
1605 | 1622 | ||
1606 | string[] nomens = name.Split(); | 1623 | string[] nomens = name.Split(); |
1607 | UI = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(nomens[0], nomens[1]); | 1624 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
1608 | if (null == UI) | 1625 | UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]); |
1626 | if (null == account) | ||
1609 | { | 1627 | { |
1610 | ID = m_app.CommunicationsManager.UserAdminService.AddUser(nomens[0], nomens[1], | 1628 | account = new UserAccount(scopeID, nomens[0], nomens[1], email); |
1611 | passwd, email, regX, regY); | 1629 | bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account); |
1612 | if (ID == UUID.Zero) | 1630 | if (!success) |
1613 | { | 1631 | { |
1614 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); | 1632 | m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); |
1615 | return false; | 1633 | return false; |
1616 | } | 1634 | } |
1635 | // !!! REFACTORING PROBLEM: need to set the password | ||
1636 | |||
1637 | GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID, | ||
1638 | (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize)); | ||
1639 | if (home != null) | ||
1640 | m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1617 | } | 1641 | } |
1618 | else | 1642 | else |
1619 | { | 1643 | { |
1620 | ID = UI.UserProfile.ID; | 1644 | ID = account.PrincipalID; |
1621 | } | 1645 | } |
1622 | 1646 | ||
1623 | m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); | 1647 | m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); |
@@ -2391,17 +2415,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2391 | 2415 | ||
2392 | if (requestData.Contains("users")) | 2416 | if (requestData.Contains("users")) |
2393 | { | 2417 | { |
2394 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 2418 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2419 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | ||
2395 | Scene s = m_app.SceneManager.CurrentScene; | 2420 | Scene s = m_app.SceneManager.CurrentScene; |
2396 | Hashtable users = (Hashtable) requestData["users"]; | 2421 | Hashtable users = (Hashtable) requestData["users"]; |
2397 | List<UUID> uuids = new List<UUID>(); | 2422 | List<UUID> uuids = new List<UUID>(); |
2398 | foreach (string name in users.Values) | 2423 | foreach (string name in users.Values) |
2399 | { | 2424 | { |
2400 | string[] parts = name.Split(); | 2425 | string[] parts = name.Split(); |
2401 | CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); | 2426 | UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]); |
2402 | if (udata != null) | 2427 | if (account != null) |
2403 | { | 2428 | { |
2404 | uuids.Add(udata.UserProfile.ID); | 2429 | uuids.Add(account.PrincipalID); |
2405 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); | 2430 | m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); |
2406 | } | 2431 | } |
2407 | } | 2432 | } |
@@ -2477,21 +2502,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2477 | 2502 | ||
2478 | if (requestData.Contains("users")) | 2503 | if (requestData.Contains("users")) |
2479 | { | 2504 | { |
2480 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 2505 | UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; |
2506 | IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService; | ||
2507 | //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | ||
2481 | Scene s = m_app.SceneManager.CurrentScene; | 2508 | Scene s = m_app.SceneManager.CurrentScene; |
2482 | Hashtable users = (Hashtable) requestData["users"]; | 2509 | Hashtable users = (Hashtable) requestData["users"]; |
2483 | List<UUID> uuids = new List<UUID>(); | 2510 | List<UUID> uuids = new List<UUID>(); |
2484 | foreach (string name in users.Values) | 2511 | foreach (string name in users.Values) |
2485 | { | 2512 | { |
2486 | string[] parts = name.Split(); | 2513 | string[] parts = name.Split(); |
2487 | CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); | 2514 | UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]); |
2488 | if (udata != null) | 2515 | if (account != null) |
2489 | { | 2516 | { |
2490 | uuids.Add(udata.UserProfile.ID); | 2517 | uuids.Add(account.PrincipalID); |
2491 | } | 2518 | } |
2492 | } | 2519 | } |
2493 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 2520 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); |
2494 | foreach (UUID uuid in uuids) | 2521 | foreach (UUID uuid in uuids) |
2495 | { | 2522 | { |
2496 | if (acl.Contains(uuid)) | 2523 | if (acl.Contains(uuid)) |
2497 | { | 2524 | { |