Added a check to the CreateRegion method of the RemoteAdmin module that the specified user exists.

A meaningful exception message is returned if the user is not found. Previously it was returning "Object not set..."
remove-scene-viewer
Kevin Houlihan 2011-09-04 14:46:52 +01:00 committed by Justin Clark-Casey (justincc)
parent 28961dd1cf
commit 7cafc2e46e
1 changed files with 13 additions and 0 deletions

View File

@ -709,6 +709,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// ok, client wants us to use an explicit UUID // ok, client wants us to use an explicit UUID
// regardless of what the avatar name provided // regardless of what the avatar name provided
userID = new UUID((string) requestData["estate_owner_uuid"]); userID = new UUID((string) requestData["estate_owner_uuid"]);
// Check that the specified user exists
Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
IUserAccountService accountService = currentOrFirst.UserAccountService;
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, userID);
if (user == null)
throw new Exception("Specified user was not found.");
} }
else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last")) else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last"))
{ {
@ -720,6 +728,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
IUserAccountService accountService = currentOrFirst.UserAccountService; IUserAccountService accountService = currentOrFirst.UserAccountService;
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID, UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
ownerFirst, ownerLast); ownerFirst, ownerLast);
// Check that the specified user exists
if (user == null)
throw new Exception("Specified user was not found.");
userID = user.PrincipalID; userID = user.PrincipalID;
} }
else else