aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
authorMelanie2010-03-03 02:07:03 +0000
committerMelanie2010-03-03 02:07:03 +0000
commit028a87fe37002e7a0611f66babf1deee46c83804 (patch)
tree387aec499fd60c2012bed8148e6a2ddc847c3d95 /OpenSim/ApplicationPlugins
parentRevert "test" (diff)
parentFixes Region.Framework tests. Although these tests don't fail, they need to b... (diff)
downloadopensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.zip
opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.gz
opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.bz2
opensim-SC-028a87fe37002e7a0611f66babf1deee46c83804.tar.xz
Merge branch 'master' into careminster-presence-refactor
This brings careminster on the level of master. To be tested
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs219
-rw-r--r--OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml11
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs4
-rw-r--r--OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs28
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs498
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs26
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs18
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs373
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs4
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs400
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs8
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs9
12 files changed, 684 insertions, 914 deletions
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs b/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
deleted file mode 100644
index 0f827b0..0000000
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/CreateCommsManagerPlugin.cs
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using OpenSim.Data;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Services;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Communications.Osp;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Communications.Hypergrid;
41using OpenSim.Region.Communications.Local;
42using OpenSim.Region.Communications.OGS1;
43
44namespace OpenSim.ApplicationPlugins.CreateCommsManager
45{
46 public class CreateCommsManagerPlugin : IApplicationPlugin
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 #region IApplicationPlugin Members
51
52 // TODO: required by IPlugin, but likely not at all right
53 private string m_name = "CreateCommsManagerPlugin";
54 private string m_version = "0.0";
55
56 public string Version
57 {
58 get { return m_version; }
59 }
60
61 public string Name
62 {
63 get { return m_name; }
64 }
65
66 protected OpenSimBase m_openSim;
67
68 protected BaseHttpServer m_httpServer;
69
70 protected CommunicationsManager m_commsManager;
71 protected GridInfoService m_gridInfoService;
72
73 protected IRegionCreator m_regionCreator;
74
75 public void Initialise()
76 {
77 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
78 throw new PluginNotInitialisedException(Name);
79 }
80
81 public void Initialise(OpenSimBase openSim)
82 {
83 m_openSim = openSim;
84 m_httpServer = openSim.HttpServer;
85 MainServer.Instance = m_httpServer;
86
87 InitialiseCommsManager(openSim);
88 if (m_commsManager != null)
89 {
90 m_openSim.ApplicationRegistry.RegisterInterface<IUserService>(m_commsManager.UserService);
91 }
92 }
93
94 public void PostInitialise()
95 {
96 if (m_openSim.ApplicationRegistry.TryGet<IRegionCreator>(out m_regionCreator))
97 {
98 m_regionCreator.OnNewRegionCreated += RegionCreated;
99 }
100 }
101
102 public void Dispose()
103 {
104 }
105
106 #endregion
107
108 private void RegionCreated(IScene scene)
109 {
110 if (m_commsManager != null)
111 {
112 scene.RegisterModuleInterface<IUserService>(m_commsManager.UserService);
113 }
114 }
115
116 protected void InitialiseCommsManager(OpenSimBase openSim)
117 {
118 LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_openSim.ConfigurationSettings.LibrariesXMLFile);
119
120 bool hgrid = m_openSim.ConfigSource.Source.Configs["Startup"].GetBoolean("hypergrid", false);
121
122 if (hgrid)
123 {
124 InitialiseHGServices(openSim, libraryRootFolder);
125 }
126 else
127 {
128 InitialiseStandardServices(libraryRootFolder);
129 }
130
131 openSim.CommunicationsManager = m_commsManager;
132 }
133
134 protected void InitialiseHGServices(OpenSimBase openSim, LibraryRootFolder libraryRootFolder)
135 {
136 // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
137 if (m_openSim.ConfigurationSettings.Standalone)
138 {
139 InitialiseHGStandaloneServices(libraryRootFolder);
140 }
141 else
142 {
143 // We are in grid mode
144 InitialiseHGGridServices(libraryRootFolder);
145 }
146 }
147
148 protected void InitialiseStandardServices(LibraryRootFolder libraryRootFolder)
149 {
150 // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false)
151 if (m_openSim.ConfigurationSettings.Standalone)
152 {
153 InitialiseStandaloneServices(libraryRootFolder);
154 }
155 else
156 {
157 // We are in grid mode
158 InitialiseGridServices(libraryRootFolder);
159 }
160 }
161
162 /// <summary>
163 /// Initialises the backend services for standalone mode, and registers some http handlers
164 /// </summary>
165 /// <param name="libraryRootFolder"></param>
166 protected virtual void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
167 {
168 m_commsManager
169 = new CommunicationsLocal(
170 m_openSim.ConfigurationSettings, m_openSim.NetServersInfo,
171 libraryRootFolder);
172
173 CreateGridInfoService();
174 }
175
176 protected virtual void InitialiseGridServices(LibraryRootFolder libraryRootFolder)
177 {
178 m_commsManager
179 = new CommunicationsOGS1(m_openSim.NetServersInfo, libraryRootFolder);
180
181 m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
182 m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
183 if (m_openSim.userStatsURI != String.Empty)
184 m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
185 }
186
187 protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder)
188 {
189 m_commsManager
190 = new HGCommunicationsStandalone(
191 m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer,
192 libraryRootFolder, false);
193
194 CreateGridInfoService();
195 }
196
197 protected virtual void InitialiseHGGridServices(LibraryRootFolder libraryRootFolder)
198 {
199 m_commsManager
200 = new HGCommunicationsGridMode(
201 m_openSim.NetServersInfo,
202 m_openSim.SceneManager, libraryRootFolder);
203
204 m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
205 m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
206 if (m_openSim.userStatsURI != String.Empty)
207 m_httpServer.AddStreamHandler(new OpenSim.UXSimStatusHandler(m_openSim));
208 }
209
210 private void CreateGridInfoService()
211 {
212 // provide grid info
213 m_gridInfoService = new GridInfoService(m_openSim.ConfigSource.Source);
214 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
215 m_httpServer.AddStreamHandler(
216 new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
217 }
218 }
219}
diff --git a/OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml b/OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml
deleted file mode 100644
index ec042f3..0000000
--- a/OpenSim/ApplicationPlugins/CreateCommsManager/Resources/CreateCommsManagerPlugin.addin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
1<Addin id="OpenSim.ApplicationPlugins.CreateCommsManager" version="0.1">
2 <Runtime>
3 <Import assembly="OpenSim.ApplicationPlugins.CreateCommsManager.dll"/>
4 </Runtime>
5 <Dependencies>
6 <Addin id="OpenSim" version="0.5" />
7 </Dependencies>
8 <Extension path = "/OpenSim/Startup">
9 <Plugin id="CreateCommsManager" type="OpenSim.ApplicationPlugins.CreateCommsManager.CreateCommsManagerPlugin" />
10 </Extension>
11</Addin>
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 6fd3d30..1e85a22 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -102,8 +102,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
102 m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); 102 m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); 103 m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); 104 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
105 m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule...");
106 m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
107 m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule..."); 105 m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
108 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); 106 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
109 m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule..."); 107 m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
@@ -217,4 +215,4 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
217 } 215 }
218 } 216 }
219 } 217 }
220} \ No newline at end of file 218}
diff --git a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
index 6c0c74d..9d79b3a 100644
--- a/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RegionModulesController/RegionModulesControllerPlugin.cs
@@ -65,9 +65,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
65 65
66 public void Initialise (OpenSimBase openSim) 66 public void Initialise (OpenSimBase openSim)
67 { 67 {
68 m_log.DebugFormat("[REGIONMODULES]: Initializing...");
69 m_openSim = openSim; 68 m_openSim = openSim;
70 openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this); 69 m_openSim.ApplicationRegistry.RegisterInterface<IRegionModulesController>(this);
70 m_log.DebugFormat("[REGIONMODULES]: Initializing...");
71 71
72 // Who we are 72 // Who we are
73 string id = AddinManager.CurrentAddin.Id; 73 string id = AddinManager.CurrentAddin.Id;
@@ -81,9 +81,9 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
81 81
82 // The [Modules] section in the ini file 82 // The [Modules] section in the ini file
83 IConfig modulesConfig = 83 IConfig modulesConfig =
84 openSim.ConfigSource.Source.Configs["Modules"]; 84 m_openSim.ConfigSource.Source.Configs["Modules"];
85 if (modulesConfig == null) 85 if (modulesConfig == null)
86 modulesConfig = openSim.ConfigSource.Source.AddConfig("Modules"); 86 modulesConfig = m_openSim.ConfigSource.Source.AddConfig("Modules");
87 87
88 // Scan modules and load all that aren't disabled 88 // Scan modules and load all that aren't disabled
89 foreach (TypeExtensionNode node in 89 foreach (TypeExtensionNode node in
@@ -104,7 +104,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
104 continue; 104 continue;
105 105
106 // Split off port, if present 106 // Split off port, if present
107 string[] moduleParts = moduleString.Split(new char[] {'/'}, 2); 107 string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
108 // Format is [port/][class] 108 // Format is [port/][class]
109 string className = moduleParts[0]; 109 string className = moduleParts[0];
110 if (moduleParts.Length > 1) 110 if (moduleParts.Length > 1)
@@ -134,7 +134,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
134 continue; 134 continue;
135 135
136 // Split off port, if present 136 // Split off port, if present
137 string[] moduleParts = moduleString.Split(new char[] {'/'}, 2); 137 string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
138 // Format is [port/][class] 138 // Format is [port/][class]
139 string className = moduleParts[0]; 139 string className = moduleParts[0];
140 if (moduleParts.Length > 1) 140 if (moduleParts.Length > 1)
@@ -162,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
162 // 162 //
163 foreach (TypeExtensionNode node in m_sharedModules) 163 foreach (TypeExtensionNode node in m_sharedModules)
164 { 164 {
165 Object[] ctorArgs = new Object[] {(uint)0}; 165 Object[] ctorArgs = new Object[] { (uint)0 };
166 166
167 // Read the config again 167 // Read the config again
168 string moduleString = 168 string moduleString =
@@ -172,7 +172,7 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
172 if (moduleString != String.Empty) 172 if (moduleString != String.Empty)
173 { 173 {
174 // Get the port number from the string 174 // Get the port number from the string
175 string[] moduleParts = moduleString.Split(new char[] {'/'}, 175 string[] moduleParts = moduleString.Split(new char[] { '/' },
176 2); 176 2);
177 if (moduleParts.Length > 1) 177 if (moduleParts.Length > 1)
178 ctorArgs[0] = Convert.ToUInt32(moduleParts[0]); 178 ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
@@ -195,18 +195,22 @@ namespace OpenSim.ApplicationPlugins.RegionModulesController
195 195
196 // OK, we're up and running 196 // OK, we're up and running
197 m_sharedInstances.Add(module); 197 m_sharedInstances.Add(module);
198 module.Initialise(openSim.ConfigSource.Source); 198 module.Initialise(m_openSim.ConfigSource.Source);
199 } 199 }
200 200
201
202 }
203
204 public void PostInitialise ()
205 {
206 m_log.DebugFormat("[REGIONMODULES]: PostInitializing...");
207
201 // Immediately run PostInitialise on shared modules 208 // Immediately run PostInitialise on shared modules
202 foreach (ISharedRegionModule module in m_sharedInstances) 209 foreach (ISharedRegionModule module in m_sharedInstances)
203 { 210 {
204 module.PostInitialise(); 211 module.PostInitialise();
205 } 212 }
206 }
207 213
208 public void PostInitialise ()
209 {
210 } 214 }
211 215
212#endregion 216#endregion
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 87eae1e..0c1e3ca 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41using OpenSim; 41using OpenSim;
42using OpenSim.Framework; 42using OpenSim.Framework;
43using OpenSim.Framework.Communications; 43using OpenSim.Framework.Communications;
44using OpenSim.Framework.Communications.Cache; 44
45using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
46using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
47using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
@@ -49,6 +49,8 @@ using OpenSim.Region.CoreModules.World.Terrain;
49using OpenSim.Region.Framework.Interfaces; 49using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.Framework.Scenes; 50using OpenSim.Region.Framework.Scenes;
51using OpenSim.Services.Interfaces; 51using OpenSim.Services.Interfaces;
52using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
53using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 54
53namespace OpenSim.ApplicationPlugins.RemoteController 55namespace OpenSim.ApplicationPlugins.RemoteController
54{ 56{
@@ -700,39 +702,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
700 { 702 {
701 // ok, client wants us to use an explicit UUID 703 // ok, client wants us to use an explicit UUID
702 // regardless of what the avatar name provided 704 // regardless of what the avatar name provided
703 userID = new UUID((string) requestData["region_master_uuid"]); 705 userID = new UUID((string) requestData["estate_owner_uuid"]);
704 } 706 }
705 else
706 {
707 if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar
708 {
709 // no client supplied UUID: look it up...
710 CachedUserInfo userInfo
711 = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(
712 masterFirst, masterLast);
713
714 if (null == userInfo)
715 {
716 m_log.InfoFormat("master avatar does not exist, creating it");
717 // ...or create new user
718 userID = m_app.CommunicationsManager.UserAdminService.AddUser(
719 masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
720
721 if (userID == UUID.Zero)
722 throw new Exception(String.Format("failed to create new user {0} {1}",
723 masterFirst, masterLast));
724 }
725 else
726 {
727 userID = userInfo.UserProfile.ID;
728 }
729 }
730 }
731
732 region.MasterAvatarFirstName = masterFirst;
733 region.MasterAvatarLastName = masterLast;
734 region.MasterAvatarSandboxPassword = masterPassword;
735 region.MasterAvatarAssignedUUID = userID;
736 707
737 bool persist = Convert.ToBoolean((string) requestData["persist"]); 708 bool persist = Convert.ToBoolean((string) requestData["persist"]);
738 if (persist) 709 if (persist)
@@ -777,6 +748,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
777 // If an access specification was provided, use it. 748 // If an access specification was provided, use it.
778 // Otherwise accept the default. 749 // Otherwise accept the default.
779 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess); 750 newscene.RegionInfo.EstateSettings.PublicAccess = getBoolean(requestData, "public", m_publicAccess);
751 newscene.RegionInfo.EstateSettings.EstateOwner = userID;
780 if (persist) 752 if (persist)
781 newscene.RegionInfo.EstateSettings.Save(); 753 newscene.RegionInfo.EstateSettings.Save();
782 754
@@ -1150,30 +1122,37 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1150 if (requestData.Contains("user_email")) 1122 if (requestData.Contains("user_email"))
1151 email = (string)requestData["user_email"]; 1123 email = (string)requestData["user_email"];
1152 1124
1153 CachedUserInfo userInfo = 1125 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1154 m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1155 1126
1156 if (null != userInfo) 1127 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
1157 throw new Exception(String.Format("Avatar {0} {1} already exists", firstname, lastname));
1158 1128
1159 UUID userID = 1129 if (null != account)
1160 m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname, 1130 throw new Exception(String.Format("Account {0} {1} already exists", firstname, lastname));
1161 passwd, email, regX, regY);
1162 1131
1163 if (userID == UUID.Zero) 1132 account = new UserAccount(scopeID, firstname, lastname, email);
1133 // REFACTORING PROBLEM: no method to set the password!
1134
1135 bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
1136
1137 if (!success)
1164 throw new Exception(String.Format("failed to create new user {0} {1}", 1138 throw new Exception(String.Format("failed to create new user {0} {1}",
1165 firstname, lastname)); 1139 firstname, lastname));
1166 1140
1141 GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
1142 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
1143 if (home == null)
1144 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstname, lastname);
1145
1167 // Establish the avatar's initial appearance 1146 // Establish the avatar's initial appearance
1168 1147
1169 updateUserAppearance(responseData, requestData, userID); 1148 updateUserAppearance(responseData, requestData, account.PrincipalID);
1170 1149
1171 responseData["success"] = true; 1150 responseData["success"] = true;
1172 responseData["avatar_uuid"] = userID.ToString(); 1151 responseData["avatar_uuid"] = account.PrincipalID.ToString();
1173 1152
1174 response.Value = responseData; 1153 response.Value = responseData;
1175 1154
1176 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); 1155 m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, account.PrincipalID);
1177 } 1156 }
1178 catch (Exception e) 1157 catch (Exception e)
1179 { 1158 {
@@ -1242,21 +1221,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1242 string firstname = (string) requestData["user_firstname"]; 1221 string firstname = (string) requestData["user_firstname"];
1243 string lastname = (string) requestData["user_lastname"]; 1222 string lastname = (string) requestData["user_lastname"];
1244 1223
1245 CachedUserInfo userInfo
1246 = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
1247
1248 responseData["user_firstname"] = firstname; 1224 responseData["user_firstname"] = firstname;
1249 responseData["user_lastname"] = lastname; 1225 responseData["user_lastname"] = lastname;
1250 1226
1251 if (null == userInfo) 1227 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1228
1229 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, firstname, lastname);
1230
1231 if (null == account)
1252 { 1232 {
1253 responseData["success"] = false; 1233 responseData["success"] = false;
1254 responseData["lastlogin"] = 0; 1234 responseData["lastlogin"] = 0;
1255 } 1235 }
1256 else 1236 else
1257 { 1237 {
1238 PresenceInfo[] pinfos = m_app.SceneManager.CurrentOrFirstScene.PresenceService.GetAgents(new string[] { account.PrincipalID.ToString() });
1239 if (pinfos != null && pinfos.Length >= 1)
1240 responseData["lastlogin"] = pinfos[0].Login;
1241 else
1242 responseData["lastlogin"] = 0;
1243
1258 responseData["success"] = true; 1244 responseData["success"] = true;
1259 responseData["lastlogin"] = userInfo.UserProfile.LastLogin;
1260 } 1245 }
1261 1246
1262 response.Value = responseData; 1247 response.Value = responseData;
@@ -1318,117 +1303,118 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1318 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient) 1303 public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request, IPEndPoint remoteClient)
1319 { 1304 {
1320 m_log.Info("[RADMIN]: UpdateUserAccount: new request"); 1305 m_log.Info("[RADMIN]: UpdateUserAccount: new request");
1306 m_log.Warn("[RADMIN]: This method needs update for 0.7");
1321 XmlRpcResponse response = new XmlRpcResponse(); 1307 XmlRpcResponse response = new XmlRpcResponse();
1322 Hashtable responseData = new Hashtable(); 1308 Hashtable responseData = new Hashtable();
1323 1309
1324 lock (rslock) 1310 //lock (rslock)
1325 { 1311 //{
1326 try 1312 // try
1327 { 1313 // {
1328 Hashtable requestData = (Hashtable) request.Params[0]; 1314 // Hashtable requestData = (Hashtable) request.Params[0];
1329 1315
1330 // check completeness 1316 // // check completeness
1331 checkStringParameters(request, new string[] { 1317 // checkStringParameters(request, new string[] {
1332 "password", "user_firstname", 1318 // "password", "user_firstname",
1333 "user_lastname"}); 1319 // "user_lastname"});
1334 1320
1335 // check password 1321 // // check password
1336 if (!String.IsNullOrEmpty(m_requiredPassword) && 1322 // if (!String.IsNullOrEmpty(m_requiredPassword) &&
1337 (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password"); 1323 // (string) requestData["password"] != m_requiredPassword) throw new Exception("wrong password");
1338 1324
1339 // do the job 1325 // // do the job
1340 string firstname = (string) requestData["user_firstname"]; 1326 // string firstname = (string) requestData["user_firstname"];
1341 string lastname = (string) requestData["user_lastname"]; 1327 // string lastname = (string) requestData["user_lastname"];
1342 1328
1343 string passwd = String.Empty; 1329 // string passwd = String.Empty;
1344 uint? regX = null; 1330 // uint? regX = null;
1345 uint? regY = null; 1331 // uint? regY = null;
1346 uint? ulaX = null; 1332 // uint? ulaX = null;
1347 uint? ulaY = null; 1333 // uint? ulaY = null;
1348 uint? ulaZ = null; 1334 // uint? ulaZ = null;
1349 uint? usaX = null; 1335 // uint? usaX = null;
1350 uint? usaY = null; 1336 // uint? usaY = null;
1351 uint? usaZ = null; 1337 // uint? usaZ = null;
1352 string aboutFirstLive = String.Empty; 1338 // string aboutFirstLive = String.Empty;
1353 string aboutAvatar = String.Empty; 1339 // string aboutAvatar = String.Empty;
1354 1340
1355 if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"]; 1341 // if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
1356 if (requestData.ContainsKey("start_region_x")) 1342 // if (requestData.ContainsKey("start_region_x"))
1357 regX = Convert.ToUInt32((Int32) requestData["start_region_x"]); 1343 // regX = Convert.ToUInt32((Int32) requestData["start_region_x"]);
1358 if (requestData.ContainsKey("start_region_y")) 1344 // if (requestData.ContainsKey("start_region_y"))
1359 regY = Convert.ToUInt32((Int32) requestData["start_region_y"]); 1345 // regY = Convert.ToUInt32((Int32) requestData["start_region_y"]);
1360 1346
1361 if (requestData.ContainsKey("start_lookat_x")) 1347 // if (requestData.ContainsKey("start_lookat_x"))
1362 ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]); 1348 // ulaX = Convert.ToUInt32((Int32) requestData["start_lookat_x"]);
1363 if (requestData.ContainsKey("start_lookat_y")) 1349 // if (requestData.ContainsKey("start_lookat_y"))
1364 ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]); 1350 // ulaY = Convert.ToUInt32((Int32) requestData["start_lookat_y"]);
1365 if (requestData.ContainsKey("start_lookat_z")) 1351 // if (requestData.ContainsKey("start_lookat_z"))
1366 ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]); 1352 // ulaZ = Convert.ToUInt32((Int32) requestData["start_lookat_z"]);
1367 1353
1368 if (requestData.ContainsKey("start_standat_x")) 1354 // if (requestData.ContainsKey("start_standat_x"))
1369 usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]); 1355 // usaX = Convert.ToUInt32((Int32) requestData["start_standat_x"]);
1370 if (requestData.ContainsKey("start_standat_y")) 1356 // if (requestData.ContainsKey("start_standat_y"))
1371 usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]); 1357 // usaY = Convert.ToUInt32((Int32) requestData["start_standat_y"]);
1372 if (requestData.ContainsKey("start_standat_z")) 1358 // if (requestData.ContainsKey("start_standat_z"))
1373 usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]); 1359 // usaZ = Convert.ToUInt32((Int32) requestData["start_standat_z"]);
1374 if (requestData.ContainsKey("about_real_world")) 1360 // if (requestData.ContainsKey("about_real_world"))
1375 aboutFirstLive = (string)requestData["about_real_world"]; 1361 // aboutFirstLive = (string)requestData["about_real_world"];
1376 if (requestData.ContainsKey("about_virtual_world")) 1362 // if (requestData.ContainsKey("about_virtual_world"))
1377 aboutAvatar = (string)requestData["about_virtual_world"]; 1363 // aboutAvatar = (string)requestData["about_virtual_world"];
1378 1364
1379 UserProfileData userProfile 1365 // UserProfileData userProfile
1380 = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); 1366 // = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
1381 1367
1382 if (null == userProfile) 1368 // if (null == userProfile)
1383 throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); 1369 // throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
1384 1370
1385 if (!String.IsNullOrEmpty(passwd)) 1371 // if (!String.IsNullOrEmpty(passwd))
1386 { 1372 // {
1387 m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname); 1373 // m_log.DebugFormat("[RADMIN]: UpdateUserAccount: updating password for avatar {0} {1}", firstname, lastname);
1388 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); 1374 // string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
1389 userProfile.PasswordHash = md5PasswdHash; 1375 // userProfile.PasswordHash = md5PasswdHash;
1390 } 1376 // }
1391 1377
1392 if (null != regX) userProfile.HomeRegionX = (uint) regX; 1378 // if (null != regX) userProfile.HomeRegionX = (uint) regX;
1393 if (null != regY) userProfile.HomeRegionY = (uint) regY; 1379 // if (null != regY) userProfile.HomeRegionY = (uint) regY;
1394 1380
1395 if (null != usaX) userProfile.HomeLocationX = (uint) usaX; 1381 // if (null != usaX) userProfile.HomeLocationX = (uint) usaX;
1396 if (null != usaY) userProfile.HomeLocationY = (uint) usaY; 1382 // if (null != usaY) userProfile.HomeLocationY = (uint) usaY;
1397 if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ; 1383 // if (null != usaZ) userProfile.HomeLocationZ = (uint) usaZ;
1398 1384
1399 if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX; 1385 // if (null != ulaX) userProfile.HomeLookAtX = (uint) ulaX;
1400 if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY; 1386 // if (null != ulaY) userProfile.HomeLookAtY = (uint) ulaY;
1401 if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ; 1387 // if (null != ulaZ) userProfile.HomeLookAtZ = (uint) ulaZ;
1402 1388
1403 if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; 1389 // if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive;
1404 if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; 1390 // if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar;
1405 1391
1406 // User has been created. Now establish gender and appearance. 1392 // // User has been created. Now establish gender and appearance.
1407 1393
1408 updateUserAppearance(responseData, requestData, userProfile.ID); 1394 // updateUserAppearance(responseData, requestData, userProfile.ID);
1409 1395
1410 if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) 1396 // if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
1411 throw new Exception("did not manage to update user profile"); 1397 // throw new Exception("did not manage to update user profile");
1412 1398
1413 responseData["success"] = true; 1399 // responseData["success"] = true;
1414 1400
1415 response.Value = responseData; 1401 // response.Value = responseData;
1416 1402
1417 m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", 1403 // m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}",
1418 firstname, lastname, 1404 // firstname, lastname,
1419 userProfile.ID); 1405 // userProfile.ID);
1420 } 1406 // }
1421 catch (Exception e) 1407 // catch (Exception e)
1422 { 1408 // {
1423 m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message); 1409 // m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
1424 m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString()); 1410 // m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
1425 1411
1426 responseData["success"] = false; 1412 // responseData["success"] = false;
1427 responseData["error"] = e.Message; 1413 // responseData["error"] = e.Message;
1428 1414
1429 response.Value = responseData; 1415 // response.Value = responseData;
1430 } 1416 // }
1431 } 1417 //}
1432 1418
1433 m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); 1419 m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
1434 return response; 1420 return response;
@@ -1445,72 +1431,73 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1445 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid) 1431 private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
1446 { 1432 {
1447 m_log.DebugFormat("[RADMIN] updateUserAppearance"); 1433 m_log.DebugFormat("[RADMIN] updateUserAppearance");
1434 m_log.Warn("[RADMIN]: This method needs update for 0.7");
1448 1435
1449 string dmale = m_config.GetString("default_male", "Default Male"); 1436 //string dmale = m_config.GetString("default_male", "Default Male");
1450 string dfemale = m_config.GetString("default_female", "Default Female"); 1437 //string dfemale = m_config.GetString("default_female", "Default Female");
1451 string dneut = m_config.GetString("default_female", "Default Default"); 1438 //string dneut = m_config.GetString("default_female", "Default Default");
1452 string model = String.Empty; 1439 string model = String.Empty;
1453 1440
1454 // Has a gender preference been supplied? 1441 //// Has a gender preference been supplied?
1455 1442
1456 if (requestData.Contains("gender")) 1443 //if (requestData.Contains("gender"))
1457 { 1444 //{
1458 switch ((string)requestData["gender"]) 1445 // switch ((string)requestData["gender"])
1459 { 1446 // {
1460 case "m" : 1447 // case "m" :
1461 model = dmale; 1448 // model = dmale;
1462 break; 1449 // break;
1463 case "f" : 1450 // case "f" :
1464 model = dfemale; 1451 // model = dfemale;
1465 break; 1452 // break;
1466 case "n" : 1453 // case "n" :
1467 default : 1454 // default :
1468 model = dneut; 1455 // model = dneut;
1469 break; 1456 // break;
1470 } 1457 // }
1471 } 1458 //}
1472 1459
1473 // Has an explicit model been specified? 1460 //// Has an explicit model been specified?
1474 1461
1475 if (requestData.Contains("model")) 1462 //if (requestData.Contains("model"))
1476 { 1463 //{
1477 model = (string)requestData["model"]; 1464 // model = (string)requestData["model"];
1478 } 1465 //}
1479 1466
1480 // No appearance attributes were set 1467 //// No appearance attributes were set
1481 1468
1482 if (model == String.Empty) 1469 //if (model == String.Empty)
1483 { 1470 //{
1484 m_log.DebugFormat("[RADMIN] Appearance update not requested"); 1471 // m_log.DebugFormat("[RADMIN] Appearance update not requested");
1485 return; 1472 // return;
1486 } 1473 //}
1487 1474
1488 m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model); 1475 //m_log.DebugFormat("[RADMIN] Setting appearance for avatar {0}, using model {1}", userid, model);
1489 1476
1490 string[] nomens = model.Split(); 1477 //string[] nomens = model.Split();
1491 if (nomens.Length != 2) 1478 //if (nomens.Length != 2)
1492 { 1479 //{
1493 m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model); 1480 // m_log.WarnFormat("[RADMIN] User appearance not set for {0}. Invalid model name : <{1}>", userid, model);
1494 // nomens = dmodel.Split(); 1481 // // nomens = dmodel.Split();
1495 return; 1482 // return;
1496 } 1483 //}
1497 1484
1498 UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]); 1485 //UserProfileData mprof = m_app.CommunicationsManager.UserService.GetUserProfile(nomens[0], nomens[1]);
1499 1486
1500 // Is this the first time one of the default models has been used? Create it if that is the case 1487 //// Is this the first time one of the default models has been used? Create it if that is the case
1501 // otherwise default to male. 1488 //// otherwise default to male.
1502 1489
1503 if (mprof == null) 1490 //if (mprof == null)
1504 { 1491 //{
1505 m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model); 1492 // m_log.WarnFormat("[RADMIN] Requested model ({0}) not found. Appearance unchanged", model);
1506 return; 1493 // return;
1507 } 1494 //}
1508 1495
1509 // Set current user's appearance. This bit is easy. The appearance structure is populated with 1496 //// Set current user's appearance. This bit is easy. The appearance structure is populated with
1510 // actual asset ids, however to complete the magic we need to populate the inventory with the 1497 //// actual asset ids, however to complete the magic we need to populate the inventory with the
1511 // assets in question. 1498 //// assets in question.
1512 1499
1513 establishAppearance(userid, mprof.ID); 1500 //establishAppearance(userid, mprof.ID);
1514 1501
1515 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}", 1502 m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
1516 userid, model); 1503 userid, model);
@@ -1525,8 +1512,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1525 private void establishAppearance(UUID dest, UUID srca) 1512 private void establishAppearance(UUID dest, UUID srca)
1526 { 1513 {
1527 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca); 1514 m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca);
1528 1515 AvatarAppearance ava = null;
1529 AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(srca); 1516 AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca);
1517 if (avatar != null)
1518 ava = avatar.ToAvatarAppearance(srca);
1530 1519
1531 // If the model has no associated appearance we're done. 1520 // If the model has no associated appearance we're done.
1532 1521
@@ -1619,7 +1608,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1619 throw new Exception("Unable to load both inventories"); 1608 throw new Exception("Unable to load both inventories");
1620 } 1609 }
1621 1610
1622 m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava); 1611 AvatarData adata = new AvatarData(ava);
1612 m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(dest, adata);
1623 } 1613 }
1624 catch (Exception e) 1614 catch (Exception e)
1625 { 1615 {
@@ -1674,7 +1664,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1674 uint regX = 1000; 1664 uint regX = 1000;
1675 uint regY = 1000; 1665 uint regY = 1000;
1676 string passwd = UUID.Random().ToString(); // No requirement to sign-in. 1666 string passwd = UUID.Random().ToString(); // No requirement to sign-in.
1677 CachedUserInfo UI;
1678 UUID ID = UUID.Zero; 1667 UUID ID = UUID.Zero;
1679 AvatarAppearance mava; 1668 AvatarAppearance mava;
1680 XmlNodeList avatars; 1669 XmlNodeList avatars;
@@ -1693,7 +1682,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1693 assets = doc.GetElementsByTagName("RequiredAsset"); 1682 assets = doc.GetElementsByTagName("RequiredAsset");
1694 foreach (XmlNode asset in assets) 1683 foreach (XmlNode asset in assets)
1695 { 1684 {
1696 AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset,"name",""), SByte.Parse(GetStringAttribute(asset,"type",""))); 1685 AssetBase rass = new AssetBase(UUID.Random(), GetStringAttribute(asset, "name", ""), SByte.Parse(GetStringAttribute(asset, "type", "")), UUID.Zero.ToString());
1697 rass.Description = GetStringAttribute(asset,"desc",""); 1686 rass.Description = GetStringAttribute(asset,"desc","");
1698 rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); 1687 rass.Local = Boolean.Parse(GetStringAttribute(asset,"local",""));
1699 rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); 1688 rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary",""));
@@ -1722,20 +1711,27 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1722 passwd = GetStringAttribute(avatar,"password",passwd); 1711 passwd = GetStringAttribute(avatar,"password",passwd);
1723 1712
1724 string[] nomens = name.Split(); 1713 string[] nomens = name.Split();
1725 UI = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(nomens[0], nomens[1]); 1714 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
1726 if (null == UI) 1715 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, nomens[0], nomens[1]);
1716 if (null == account)
1727 { 1717 {
1728 ID = m_app.CommunicationsManager.UserAdminService.AddUser(nomens[0], nomens[1], 1718 account = new UserAccount(scopeID, nomens[0], nomens[1], email);
1729 passwd, email, regX, regY); 1719 bool success = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.StoreUserAccount(account);
1730 if (ID == UUID.Zero) 1720 if (!success)
1731 { 1721 {
1732 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]); 1722 m_log.ErrorFormat("[RADMIN] Avatar {0} {1} was not created", nomens[0], nomens[1]);
1733 return false; 1723 return false;
1734 } 1724 }
1725 // !!! REFACTORING PROBLEM: need to set the password
1726
1727 GridRegion home = m_app.SceneManager.CurrentOrFirstScene.GridService.GetRegionByPosition(scopeID,
1728 (int)(regX * Constants.RegionSize), (int)(regY * Constants.RegionSize));
1729 if (home != null)
1730 m_app.SceneManager.CurrentOrFirstScene.PresenceService.SetHomeLocation(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1735 } 1731 }
1736 else 1732 else
1737 { 1733 {
1738 ID = UI.UserProfile.ID; 1734 ID = account.PrincipalID;
1739 } 1735 }
1740 1736
1741 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID); 1737 m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
@@ -1759,10 +1755,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1759 iserv.GetUserInventory(ID, uic.callback); 1755 iserv.GetUserInventory(ID, uic.callback);
1760 1756
1761 // While the inventory is being fetched, setup for appearance processing 1757 // While the inventory is being fetched, setup for appearance processing
1762 if ((mava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(ID)) == null) 1758 AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID);
1763 { 1759 if (adata != null)
1760 mava = adata.ToAvatarAppearance(ID);
1761 else
1764 mava = new AvatarAppearance(); 1762 mava = new AvatarAppearance();
1765 }
1766 1763
1767 { 1764 {
1768 AvatarWearable[] wearables = mava.Wearables; 1765 AvatarWearable[] wearables = mava.Wearables;
@@ -1897,7 +1894,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1897 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname); 1894 m_log.DebugFormat("[RADMIN] Outfit {0} load completed", oname);
1898 } // foreach outfit 1895 } // foreach outfit
1899 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); 1896 m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name);
1900 m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(ID, mava); 1897 AvatarData adata2 = new AvatarData(mava);
1898 m_app.SceneManager.CurrentOrFirstScene.AvatarService.SetAvatar(ID, adata2);
1901 } 1899 }
1902 catch (Exception e) 1900 catch (Exception e)
1903 { 1901 {
@@ -2509,17 +2507,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2509 2507
2510 if (requestData.Contains("users")) 2508 if (requestData.Contains("users"))
2511 { 2509 {
2512 UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2510 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2511 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
2513 Scene s = m_app.SceneManager.CurrentScene; 2512 Scene s = m_app.SceneManager.CurrentScene;
2514 Hashtable users = (Hashtable) requestData["users"]; 2513 Hashtable users = (Hashtable) requestData["users"];
2515 List<UUID> uuids = new List<UUID>(); 2514 List<UUID> uuids = new List<UUID>();
2516 foreach (string name in users.Values) 2515 foreach (string name in users.Values)
2517 { 2516 {
2518 string[] parts = name.Split(); 2517 string[] parts = name.Split();
2519 CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); 2518 UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
2520 if (udata != null) 2519 if (account != null)
2521 { 2520 {
2522 uuids.Add(udata.UserProfile.ID); 2521 uuids.Add(account.PrincipalID);
2523 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName); 2522 m_log.DebugFormat("[RADMIN] adding \"{0}\" to ACL for \"{1}\"", name, s.RegionInfo.RegionName);
2524 } 2523 }
2525 } 2524 }
@@ -2595,21 +2594,23 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2595 2594
2596 if (requestData.Contains("users")) 2595 if (requestData.Contains("users"))
2597 { 2596 {
2598 UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; 2597 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2598 IUserAccountService userService = m_app.SceneManager.CurrentOrFirstScene.UserAccountService;
2599 //UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
2599 Scene s = m_app.SceneManager.CurrentScene; 2600 Scene s = m_app.SceneManager.CurrentScene;
2600 Hashtable users = (Hashtable) requestData["users"]; 2601 Hashtable users = (Hashtable) requestData["users"];
2601 List<UUID> uuids = new List<UUID>(); 2602 List<UUID> uuids = new List<UUID>();
2602 foreach (string name in users.Values) 2603 foreach (string name in users.Values)
2603 { 2604 {
2604 string[] parts = name.Split(); 2605 string[] parts = name.Split();
2605 CachedUserInfo udata = ups.GetUserDetails(parts[0],parts[1]); 2606 UserAccount account = userService.GetUserAccount(scopeID, parts[0], parts[1]);
2606 if (udata != null) 2607 if (account != null)
2607 { 2608 {
2608 uuids.Add(udata.UserProfile.ID); 2609 uuids.Add(account.PrincipalID);
2609 } 2610 }
2610 } 2611 }
2611 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); 2612 List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess);
2612 foreach (UUID uuid in uuids) 2613 foreach (UUID uuid in uuids)
2613 { 2614 {
2614 if (acl.Contains(uuid)) 2615 if (acl.Contains(uuid))
2615 { 2616 {
@@ -2682,10 +2683,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2682 2683
2683 foreach (UUID user in acl) 2684 foreach (UUID user in acl)
2684 { 2685 {
2685 CachedUserInfo udata = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user); 2686 UUID scopeID = m_app.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID;
2686 if (udata != null) 2687 UserAccount account = m_app.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user);
2688 if (account != null)
2687 { 2689 {
2688 users[user.ToString()] = udata.UserProfile.Name; 2690 users[user.ToString()] = account.FirstName + " " + account.LastName;
2689 } 2691 }
2690 } 2692 }
2691 2693
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
index d3a7e64..10f1a6e 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs
@@ -35,6 +35,9 @@ using System.Xml;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces;
39
40using OpenMetaverse;
38 41
39namespace OpenSim.ApplicationPlugins.Rest.Inventory 42namespace OpenSim.ApplicationPlugins.Rest.Inventory
40{ 43{
@@ -658,7 +661,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
658 { 661 {
659 662
660 int x; 663 int x;
661 string HA1;
662 string first; 664 string first;
663 string last; 665 string last;
664 666
@@ -675,17 +677,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
675 last = String.Empty; 677 last = String.Empty;
676 } 678 }
677 679
678 UserProfileData udata = Rest.UserServices.GetUserProfile(first, last); 680 UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
679 681
680 // If we don't recognize the user id, perhaps it is god? 682 // If we don't recognize the user id, perhaps it is god?
681 683 if (account == null)
682 if (udata == null)
683 return pass == Rest.GodKey; 684 return pass == Rest.GodKey;
684 685
685 HA1 = HashToString(pass); 686 return (Rest.AuthServices.Authenticate(account.PrincipalID, pass, 1) != string.Empty);
686 HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
687
688 return (0 == sc.Compare(HA1, udata.PasswordHash));
689 687
690 } 688 }
691 689
@@ -897,11 +895,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
897 last = String.Empty; 895 last = String.Empty;
898 } 896 }
899 897
900 UserProfileData udata = Rest.UserServices.GetUserProfile(first, last); 898 UserAccount account = Rest.UserServices.GetUserAccount(UUID.Zero, first, last);
901
902 // If we don;t recognize the user id, perhaps it is god? 899 // If we don;t recognize the user id, perhaps it is god?
903 900
904 if (udata == null) 901 if (account == null)
905 { 902 {
906 Rest.Log.DebugFormat("{0} Administrator", MsgId); 903 Rest.Log.DebugFormat("{0} Administrator", MsgId);
907 return Rest.GodKey; 904 return Rest.GodKey;
@@ -909,7 +906,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
909 else 906 else
910 { 907 {
911 Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user); 908 Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
912 return udata.PasswordHash; 909
910 // !!! REFACTORING PROBLEM
911 // This is what it was. It doesn't work in 0.7
912 // Nothing retrieves the password from the authentication service, there's only authentication.
913 //return udata.PasswordHash;
914 return string.Empty;
913 } 915 }
914 916
915 } 917 }
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
index 7db705e..9755e73 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs
@@ -35,7 +35,7 @@ using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using IUserService = OpenSim.Framework.Communications.IUserService; 38using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
39 39
40namespace OpenSim.ApplicationPlugins.Rest.Inventory 40namespace OpenSim.ApplicationPlugins.Rest.Inventory
41{ 41{
@@ -92,24 +92,24 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
92 /// initializes. 92 /// initializes.
93 /// </summary> 93 /// </summary>
94 94
95 internal static CommunicationsManager Comms 95 internal static IInventoryService InventoryServices
96 { 96 {
97 get { return main.CommunicationsManager; } 97 get { return main.SceneManager.CurrentOrFirstScene.InventoryService; }
98 } 98 }
99 99
100 internal static IInventoryService InventoryServices 100 internal static IUserAccountService UserServices
101 { 101 {
102 get { return main.SceneManager.CurrentOrFirstScene.InventoryService; } 102 get { return main.SceneManager.CurrentOrFirstScene.UserAccountService; }
103 } 103 }
104 104
105 internal static IUserService UserServices 105 internal static IAuthenticationService AuthServices
106 { 106 {
107 get { return Comms.UserService; } 107 get { return main.SceneManager.CurrentOrFirstScene.AuthenticationService; }
108 } 108 }
109 109
110 internal static IAvatarService AvatarServices 110 internal static IAvatarService AvatarServices
111 { 111 {
112 get { return Comms.AvatarService; } 112 get { return main.SceneManager.CurrentOrFirstScene.AvatarService; }
113 } 113 }
114 114
115 internal static IAssetService AssetServices 115 internal static IAssetService AssetServices
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index b2b4aa7..b70a511 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -32,6 +32,7 @@ using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
34using OpenSim.Framework.Servers.HttpServer; 34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Services.Interfaces;
35 36
36namespace OpenSim.ApplicationPlugins.Rest.Inventory 37namespace OpenSim.ApplicationPlugins.Rest.Inventory
37{ 38{
@@ -135,152 +136,153 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
135 136
136 private void DoAppearance(RequestData hdata) 137 private void DoAppearance(RequestData hdata)
137 { 138 {
138 139 // !!! REFACTORIMG PROBLEM. This needs rewriting for 0.7
139 AppearanceRequestData rdata = (AppearanceRequestData) hdata; 140
140 141 //AppearanceRequestData rdata = (AppearanceRequestData) hdata;
141 Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId); 142
142 143 //Rest.Log.DebugFormat("{0} DoAppearance ENTRY", MsgId);
143 // If we're disabled, do nothing. 144
144 145 //// If we're disabled, do nothing.
145 if (!enabled) 146
146 { 147 //if (!enabled)
147 return; 148 //{
148 } 149 // return;
149 150 //}
150 // Now that we know this is a serious attempt to 151
151 // access inventory data, we should find out who 152 //// Now that we know this is a serious attempt to
152 // is asking, and make sure they are authorized 153 //// access inventory data, we should find out who
153 // to do so. We need to validate the caller's 154 //// is asking, and make sure they are authorized
154 // identity before revealing anything about the 155 //// to do so. We need to validate the caller's
155 // status quo. Authenticate throws an exception 156 //// identity before revealing anything about the
156 // via Fail if no identity information is present. 157 //// status quo. Authenticate throws an exception
157 // 158 //// via Fail if no identity information is present.
158 // With the present HTTP server we can't use the 159 ////
159 // builtin authentication mechanisms because they 160 //// With the present HTTP server we can't use the
160 // would be enforced for all in-bound requests. 161 //// builtin authentication mechanisms because they
161 // Instead we look at the headers ourselves and 162 //// would be enforced for all in-bound requests.
162 // handle authentication directly. 163 //// Instead we look at the headers ourselves and
163 164 //// handle authentication directly.
164 try 165
165 { 166 //try
166 if (!rdata.IsAuthenticated) 167 //{
167 { 168 // if (!rdata.IsAuthenticated)
168 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); 169 // {
169 } 170 // rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
170 } 171 // }
171 catch (RestException e) 172 //}
172 { 173 //catch (RestException e)
173 if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) 174 //{
174 { 175 // if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
175 Rest.Log.WarnFormat("{0} User not authenticated", MsgId); 176 // {
176 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 177 // Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
177 } 178 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
178 else 179 // }
179 { 180 // else
180 Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); 181 // {
181 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 182 // Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
182 } 183 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
183 throw (e); 184 // }
184 } 185 // throw (e);
185 186 //}
186 Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName); 187
187 188 //Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
188 // We can only get here if we are authorized 189
189 // 190 //// We can only get here if we are authorized
190 // The requestor may have specified an UUID or 191 ////
191 // a conjoined FirstName LastName string. We'll 192 //// The requestor may have specified an UUID or
192 // try both. If we fail with the first, UUID, 193 //// a conjoined FirstName LastName string. We'll
193 // attempt, we try the other. As an example, the 194 //// try both. If we fail with the first, UUID,
194 // URI for a valid inventory request might be: 195 //// attempt, we try the other. As an example, the
195 // 196 //// URI for a valid inventory request might be:
196 // http://<host>:<port>/admin/inventory/Arthur Dent 197 ////
197 // 198 //// http://<host>:<port>/admin/inventory/Arthur Dent
198 // Indicating that this is an inventory request for 199 ////
199 // an avatar named Arthur Dent. This is ALL that is 200 //// Indicating that this is an inventory request for
200 // required to designate a GET for an entire 201 //// an avatar named Arthur Dent. This is ALL that is
201 // inventory. 202 //// required to designate a GET for an entire
202 // 203 //// inventory.
203 204 ////
204 // Do we have at least a user agent name? 205
205 206 //// Do we have at least a user agent name?
206 if (rdata.Parameters.Length < 1) 207
207 { 208 //if (rdata.Parameters.Length < 1)
208 Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId); 209 //{
209 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified"); 210 // Rest.Log.WarnFormat("{0} Appearance: No user agent identifier specified", MsgId);
210 } 211 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
211 212 //}
212 // The first parameter MUST be the agent identification, either an UUID 213
213 // or a space-separated First-name Last-Name specification. We check for 214 //// The first parameter MUST be the agent identification, either an UUID
214 // an UUID first, if anyone names their character using a valid UUID 215 //// or a space-separated First-name Last-Name specification. We check for
215 // that identifies another existing avatar will cause this a problem... 216 //// an UUID first, if anyone names their character using a valid UUID
216 217 //// that identifies another existing avatar will cause this a problem...
217 try 218
218 { 219 //try
219 rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]); 220 //{
220 Rest.Log.DebugFormat("{0} UUID supplied", MsgId); 221 // rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
221 rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid); 222 // Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
222 } 223 // rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
223 catch 224 //}
224 { 225 //catch
225 string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE); 226 //{
226 if (names.Length == 2) 227 // string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
227 { 228 // if (names.Length == 2)
228 Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId); 229 // {
229 rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]); 230 // Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
230 } 231 // rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
231 else 232 // }
232 { 233 // else
233 Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId); 234 // {
234 rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity"); 235 // Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
235 } 236 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
236 } 237 // }
237 238 //}
238 // If the user profile is null then either the server is broken, or the 239
239 // user is not known. We always assume the latter case. 240 //// If the user profile is null then either the server is broken, or the
240 241 //// user is not known. We always assume the latter case.
241 if (rdata.userProfile != null) 242
242 { 243 //if (rdata.userProfile != null)
243 Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}", 244 //{
244 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 245 // Rest.Log.DebugFormat("{0} User profile obtained for agent {1} {2}",
245 } 246 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
246 else 247 //}
247 { 248 //else
248 Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path); 249 //{
249 rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity"); 250 // Rest.Log.WarnFormat("{0} No user profile for {1}", MsgId, rdata.path);
250 } 251 // rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
251 252 //}
252 // If we get to here, then we have effectively validated the user's 253
253 254 //// If we get to here, then we have effectively validated the user's
254 switch (rdata.method) 255
255 { 256 //switch (rdata.method)
256 case Rest.HEAD : // Do the processing, set the status code, suppress entity 257 //{
257 DoGet(rdata); 258 // case Rest.HEAD : // Do the processing, set the status code, suppress entity
258 rdata.buffer = null; 259 // DoGet(rdata);
259 break; 260 // rdata.buffer = null;
260 261 // break;
261 case Rest.GET : // Do the processing, set the status code, return entity 262
262 DoGet(rdata); 263 // case Rest.GET : // Do the processing, set the status code, return entity
263 break; 264 // DoGet(rdata);
264 265 // break;
265 case Rest.PUT : // Update named element 266
266 DoUpdate(rdata); 267 // case Rest.PUT : // Update named element
267 break; 268 // DoUpdate(rdata);
268 269 // break;
269 case Rest.POST : // Add new information to identified context. 270
270 DoExtend(rdata); 271 // case Rest.POST : // Add new information to identified context.
271 break; 272 // DoExtend(rdata);
272 273 // break;
273 case Rest.DELETE : // Delete information 274
274 DoDelete(rdata); 275 // case Rest.DELETE : // Delete information
275 break; 276 // DoDelete(rdata);
276 277 // break;
277 default : 278
278 Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", 279 // default :
279 MsgId, rdata.method, rdata.path); 280 // Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
280 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, 281 // MsgId, rdata.method, rdata.path);
281 String.Format("{0} not supported", rdata.method)); 282 // rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
282 break; 283 // String.Format("{0} not supported", rdata.method));
283 } 284 // break;
285 //}
284 } 286 }
285 287
286 #endregion Interface 288 #endregion Interface
@@ -294,15 +296,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
294 296
295 private void DoGet(AppearanceRequestData rdata) 297 private void DoGet(AppearanceRequestData rdata)
296 { 298 {
299 AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
297 300
298 rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 301 if (adata == null)
299
300 if (rdata.userAppearance == null)
301 { 302 {
302 rdata.Fail(Rest.HttpStatusCodeNoContent, 303 rdata.Fail(Rest.HttpStatusCodeNoContent,
303 String.Format("appearance data not found for user {0} {1}", 304 String.Format("appearance data not found for user {0} {1}",
304 rdata.userProfile.FirstName, rdata.userProfile.SurName)); 305 rdata.userProfile.FirstName, rdata.userProfile.SurName));
305 } 306 }
307 rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
306 308
307 rdata.initXmlWriter(); 309 rdata.initXmlWriter();
308 310
@@ -341,18 +343,20 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
341 // increasingly doubtful that it is appropriate for REST. If I attempt to 343 // increasingly doubtful that it is appropriate for REST. If I attempt to
342 // add a new record, and it already exists, then it seems to me that the 344 // add a new record, and it already exists, then it seems to me that the
343 // attempt should fail, rather than update the existing record. 345 // attempt should fail, rather than update the existing record.
344 346 AvatarData adata = null;
345 if (GetUserAppearance(rdata)) 347 if (GetUserAppearance(rdata))
346 { 348 {
347 modified = rdata.userAppearance != null; 349 modified = rdata.userAppearance != null;
348 created = !modified; 350 created = !modified;
349 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 351 adata = new AvatarData(rdata.userAppearance);
352 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
350 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 353 // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
351 } 354 }
352 else 355 else
353 { 356 {
354 created = true; 357 created = true;
355 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 358 adata = new AvatarData(rdata.userAppearance);
359 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
356 // Rest.UserServices.UpdateUserProfile(rdata.userProfile); 360 // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
357 } 361 }
358 362
@@ -391,37 +395,39 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
391 private void DoUpdate(AppearanceRequestData rdata) 395 private void DoUpdate(AppearanceRequestData rdata)
392 { 396 {
393 397
394 bool created = false; 398 // REFACTORING PROBLEM This was commented out. It doesn't work for 0.7
395 bool modified = false;
396 399
400 //bool created = false;
401 //bool modified = false;
397 402
398 rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
399 403
400 // If the user exists then this is considered a modification regardless 404 //rdata.userAppearance = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID);
401 // of what may, or may not be, specified in the payload.
402 405
403 if (rdata.userAppearance != null) 406 //// If the user exists then this is considered a modification regardless
404 { 407 //// of what may, or may not be, specified in the payload.
405 modified = true;
406 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
407 Rest.UserServices.UpdateUserProfile(rdata.userProfile);
408 }
409 408
410 if (created) 409 //if (rdata.userAppearance != null)
411 { 410 //{
412 rdata.Complete(Rest.HttpStatusCodeCreated); 411 // modified = true;
413 } 412 // Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance);
414 else 413 // Rest.UserServices.UpdateUserProfile(rdata.userProfile);
415 { 414 //}
416 if (modified) 415
417 { 416 //if (created)
418 rdata.Complete(Rest.HttpStatusCodeOK); 417 //{
419 } 418 // rdata.Complete(Rest.HttpStatusCodeCreated);
420 else 419 //}
421 { 420 //else
422 rdata.Complete(Rest.HttpStatusCodeNoContent); 421 //{
423 } 422 // if (modified)
424 } 423 // {
424 // rdata.Complete(Rest.HttpStatusCodeOK);
425 // }
426 // else
427 // {
428 // rdata.Complete(Rest.HttpStatusCodeNoContent);
429 // }
430 //}
425 431
426 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); 432 rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
427 433
@@ -436,21 +442,22 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
436 442
437 private void DoDelete(AppearanceRequestData rdata) 443 private void DoDelete(AppearanceRequestData rdata)
438 { 444 {
445 AvatarData adata = Rest.AvatarServices.GetAvatar(rdata.userProfile.ID);
439 446
440 AvatarAppearance old = Rest.AvatarServices.GetUserAppearance(rdata.userProfile.ID); 447 if (adata != null)
441
442 if (old != null)
443 { 448 {
449 AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
444 rdata.userAppearance = new AvatarAppearance(); 450 rdata.userAppearance = new AvatarAppearance();
445
446 rdata.userAppearance.Owner = old.Owner; 451 rdata.userAppearance.Owner = old.Owner;
452 adata = new AvatarData(rdata.userAppearance);
447 453
448 Rest.AvatarServices.UpdateUserAppearance(rdata.userProfile.ID, rdata.userAppearance); 454 Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
449 455
450 rdata.Complete(); 456 rdata.Complete();
451 } 457 }
452 else 458 else
453 { 459 {
460
454 rdata.Complete(Rest.HttpStatusCodeNoContent); 461 rdata.Complete(Rest.HttpStatusCodeNoContent);
455 } 462 }
456 463
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
index 66572d5..4ba3d77 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs
@@ -261,7 +261,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
261 modified = (asset != null); 261 modified = (asset != null);
262 created = !modified; 262 created = !modified;
263 263
264 asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); 264 asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero.ToString());
265 asset.Description = xml.GetAttribute("desc"); 265 asset.Description = xml.GetAttribute("desc");
266 asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; 266 asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
267 asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; 267 asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
@@ -338,7 +338,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
338 modified = (asset != null); 338 modified = (asset != null);
339 created = !modified; 339 created = !modified;
340 340
341 asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type"))); 341 asset = new AssetBase(uuid, xml.GetAttribute("name"), SByte.Parse(xml.GetAttribute("type")), UUID.Zero.ToString());
342 asset.Description = xml.GetAttribute("desc"); 342 asset.Description = xml.GetAttribute("desc");
343 asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; 343 asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
344 asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; 344 asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index 01bfe00..10f387d 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -36,7 +36,7 @@ using System.Xml;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Imaging; 37using OpenMetaverse.Imaging;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache; 39
40using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
42using Timer=System.Timers.Timer; 42using Timer=System.Timers.Timer;
@@ -143,203 +143,205 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
143 143
144 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId); 144 Rest.Log.DebugFormat("{0} DoInventory ENTRY", MsgId);
145 145
146 // If we're disabled, do nothing. 146 // !!! REFACTORING PROBLEM
147 147
148 if (!enabled) 148 //// If we're disabled, do nothing.
149 { 149
150 return; 150 //if (!enabled)
151 } 151 //{
152 152 // return;
153 // Now that we know this is a serious attempt to 153 //}
154 // access inventory data, we should find out who 154
155 // is asking, and make sure they are authorized 155 //// Now that we know this is a serious attempt to
156 // to do so. We need to validate the caller's 156 //// access inventory data, we should find out who
157 // identity before revealing anything about the 157 //// is asking, and make sure they are authorized
158 // status quo. Authenticate throws an exception 158 //// to do so. We need to validate the caller's
159 // via Fail if no identity information is present. 159 //// identity before revealing anything about the
160 // 160 //// status quo. Authenticate throws an exception
161 // With the present HTTP server we can't use the 161 //// via Fail if no identity information is present.
162 // builtin authentication mechanisms because they 162 ////
163 // would be enforced for all in-bound requests. 163 //// With the present HTTP server we can't use the
164 // Instead we look at the headers ourselves and 164 //// builtin authentication mechanisms because they
165 // handle authentication directly. 165 //// would be enforced for all in-bound requests.
166 166 //// Instead we look at the headers ourselves and
167 try 167 //// handle authentication directly.
168 { 168
169 if (!rdata.IsAuthenticated) 169 //try
170 { 170 //{
171 rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName)); 171 // if (!rdata.IsAuthenticated)
172 } 172 // {
173 } 173 // rdata.Fail(Rest.HttpStatusCodeNotAuthorized,String.Format("user \"{0}\" could not be authenticated", rdata.userName));
174 catch (RestException e) 174 // }
175 { 175 //}
176 if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) 176 //catch (RestException e)
177 { 177 //{
178 Rest.Log.WarnFormat("{0} User not authenticated", MsgId); 178 // if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
179 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 179 // {
180 } 180 // Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
181 else 181 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
182 { 182 // }
183 Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); 183 // else
184 Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization")); 184 // {
185 } 185 // Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
186 throw (e); 186 // Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, rdata.request.Headers.Get("Authorization"));
187 } 187 // }
188 188 // throw (e);
189 Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName); 189 //}
190 190
191 // We can only get here if we are authorized 191 //Rest.Log.DebugFormat("{0} Authenticated {1}", MsgId, rdata.userName);
192 // 192
193 // The requestor may have specified an UUID or 193 //// We can only get here if we are authorized
194 // a conjoined FirstName LastName string. We'll 194 ////
195 // try both. If we fail with the first, UUID, 195 //// The requestor may have specified an UUID or
196 // attempt, we try the other. As an example, the 196 //// a conjoined FirstName LastName string. We'll
197 // URI for a valid inventory request might be: 197 //// try both. If we fail with the first, UUID,
198 // 198 //// attempt, we try the other. As an example, the
199 // http://<host>:<port>/admin/inventory/Arthur Dent 199 //// URI for a valid inventory request might be:
200 // 200 ////
201 // Indicating that this is an inventory request for 201 //// http://<host>:<port>/admin/inventory/Arthur Dent
202 // an avatar named Arthur Dent. This is ALL that is 202 ////
203 // required to designate a GET for an entire 203 //// Indicating that this is an inventory request for
204 // inventory. 204 //// an avatar named Arthur Dent. This is ALL that is
205 // 205 //// required to designate a GET for an entire
206 206 //// inventory.
207 207 ////
208 // Do we have at least a user agent name? 208
209 209
210 if (rdata.Parameters.Length < 1) 210 //// Do we have at least a user agent name?
211 { 211
212 Rest.Log.WarnFormat("{0} Inventory: No user agent identifier specified", MsgId); 212 //if (rdata.Parameters.Length < 1)
213 rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified"); 213 //{
214 } 214 // Rest.Log.WarnFormat("{0} Inventory: No user agent identifier specified", MsgId);
215 215 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "no user identity specified");
216 // The first parameter MUST be the agent identification, either an UUID 216 //}
217 // or a space-separated First-name Last-Name specification. We check for 217
218 // an UUID first, if anyone names their character using a valid UUID 218 //// The first parameter MUST be the agent identification, either an UUID
219 // that identifies another existing avatar will cause this a problem... 219 //// or a space-separated First-name Last-Name specification. We check for
220 220 //// an UUID first, if anyone names their character using a valid UUID
221 try 221 //// that identifies another existing avatar will cause this a problem...
222 { 222
223 rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]); 223 //try
224 Rest.Log.DebugFormat("{0} UUID supplied", MsgId); 224 //{
225 rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid); 225 // rdata.uuid = new UUID(rdata.Parameters[PARM_USERID]);
226 } 226 // Rest.Log.DebugFormat("{0} UUID supplied", MsgId);
227 catch 227 // rdata.userProfile = Rest.UserServices.GetUserProfile(rdata.uuid);
228 { 228 //}
229 string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE); 229 //catch
230 if (names.Length == 2) 230 //{
231 { 231 // string[] names = rdata.Parameters[PARM_USERID].Split(Rest.CA_SPACE);
232 Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId); 232 // if (names.Length == 2)
233 rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]); 233 // {
234 } 234 // Rest.Log.DebugFormat("{0} Agent Name supplied [2]", MsgId);
235 else 235 // rdata.userProfile = Rest.UserServices.GetUserProfile(names[0],names[1]);
236 { 236 // }
237 Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId); 237 // else
238 rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity"); 238 // {
239 } 239 // Rest.Log.WarnFormat("{0} A Valid UUID or both first and last names must be specified", MsgId);
240 } 240 // rdata.Fail(Rest.HttpStatusCodeBadRequest, "invalid user identity");
241 241 // }
242 // If the user profile is null then either the server is broken, or the 242 //}
243 // user is not known. We always assume the latter case. 243
244 244 //// If the user profile is null then either the server is broken, or the
245 if (rdata.userProfile != null) 245 //// user is not known. We always assume the latter case.
246 { 246
247 Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}", 247 //if (rdata.userProfile != null)
248 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 248 //{
249 } 249 // Rest.Log.DebugFormat("{0} Profile obtained for agent {1} {2}",
250 else 250 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
251 { 251 //}
252 Rest.Log.WarnFormat("{0} No profile for {1}", MsgId, rdata.path); 252 //else
253 rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity"); 253 //{
254 } 254 // Rest.Log.WarnFormat("{0} No profile for {1}", MsgId, rdata.path);
255 255 // rdata.Fail(Rest.HttpStatusCodeNotFound, "unrecognized user identity");
256 // If we get to here, then we have effectively validated the user's 256 //}
257 // identity. Now we need to get the inventory. If the server does not 257
258 // have the inventory, we reject the request with an appropriate explanation. 258 //// If we get to here, then we have effectively validated the user's
259 // 259 //// identity. Now we need to get the inventory. If the server does not
260 // Note that inventory retrieval is an asynchronous event, we use the rdata 260 //// have the inventory, we reject the request with an appropriate explanation.
261 // class instance as the basis for our synchronization. 261 ////
262 // 262 //// Note that inventory retrieval is an asynchronous event, we use the rdata
263 263 //// class instance as the basis for our synchronization.
264 rdata.uuid = rdata.userProfile.ID; 264 ////
265 265
266 if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) 266 //rdata.uuid = rdata.userProfile.ID;
267 { 267
268 rdata.root = Rest.InventoryServices.GetRootFolder(rdata.uuid); 268 //if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
269 269 //{
270 Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", 270 // rdata.root = Rest.InventoryServices.GetRootFolder(rdata.uuid);
271 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 271
272 272 // Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
273 Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory); 273 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
274 274
275 Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}", 275 // Rest.InventoryServices.GetUserInventory(rdata.uuid, rdata.GetUserInventory);
276 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 276
277 277 // Rest.Log.DebugFormat("{0} Inventory catalog requested for {1} {2}",
278 lock (rdata) 278 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
279 { 279
280 if (!rdata.HaveInventory) 280 // lock (rdata)
281 { 281 // {
282 rdata.startWD(1000); 282 // if (!rdata.HaveInventory)
283 rdata.timeout = false; 283 // {
284 Monitor.Wait(rdata); 284 // rdata.startWD(1000);
285 } 285 // rdata.timeout = false;
286 } 286 // Monitor.Wait(rdata);
287 287 // }
288 if (rdata.timeout) 288 // }
289 { 289
290 Rest.Log.WarnFormat("{0} Inventory not available for {1} {2}. No response from service.", 290 // if (rdata.timeout)
291 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 291 // {
292 rdata.Fail(Rest.HttpStatusCodeServerError, "inventory server not responding"); 292 // Rest.Log.WarnFormat("{0} Inventory not available for {1} {2}. No response from service.",
293 } 293 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
294 294 // rdata.Fail(Rest.HttpStatusCodeServerError, "inventory server not responding");
295 if (rdata.root == null) 295 // }
296 { 296
297 Rest.Log.WarnFormat("{0} Inventory is not available [1] for agent {1} {2}", 297 // if (rdata.root == null)
298 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 298 // {
299 rdata.Fail(Rest.HttpStatusCodeServerError, "inventory retrieval failed"); 299 // Rest.Log.WarnFormat("{0} Inventory is not available [1] for agent {1} {2}",
300 } 300 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
301 301 // rdata.Fail(Rest.HttpStatusCodeServerError, "inventory retrieval failed");
302 } 302 // }
303 else 303
304 { 304 //}
305 Rest.Log.WarnFormat("{0} Inventory is not locally available for agent {1} {2}", 305 //else
306 MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName); 306 //{
307 rdata.Fail(Rest.HttpStatusCodeNotFound, "no local inventory for user"); 307 // Rest.Log.WarnFormat("{0} Inventory is not locally available for agent {1} {2}",
308 } 308 // MsgId, rdata.userProfile.FirstName, rdata.userProfile.SurName);
309 309 // rdata.Fail(Rest.HttpStatusCodeNotFound, "no local inventory for user");
310 // If we get here, then we have successfully retrieved the user's information 310 //}
311 // and inventory information is now available locally. 311
312 312 //// If we get here, then we have successfully retrieved the user's information
313 switch (rdata.method) 313 //// and inventory information is now available locally.
314 { 314
315 case Rest.HEAD : // Do the processing, set the status code, suppress entity 315 //switch (rdata.method)
316 DoGet(rdata); 316 //{
317 rdata.buffer = null; 317 // case Rest.HEAD : // Do the processing, set the status code, suppress entity
318 break; 318 // DoGet(rdata);
319 319 // rdata.buffer = null;
320 case Rest.GET : // Do the processing, set the status code, return entity 320 // break;
321 DoGet(rdata); 321
322 break; 322 // case Rest.GET : // Do the processing, set the status code, return entity
323 323 // DoGet(rdata);
324 case Rest.PUT : // Update named element 324 // break;
325 DoUpdate(rdata); 325
326 break; 326 // case Rest.PUT : // Update named element
327 327 // DoUpdate(rdata);
328 case Rest.POST : // Add new information to identified context. 328 // break;
329 DoExtend(rdata); 329
330 break; 330 // case Rest.POST : // Add new information to identified context.
331 331 // DoExtend(rdata);
332 case Rest.DELETE : // Delete information 332 // break;
333 DoDelete(rdata); 333
334 break; 334 // case Rest.DELETE : // Delete information
335 335 // DoDelete(rdata);
336 default : 336 // break;
337 Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", 337
338 MsgId, rdata.method, rdata.path); 338 // default :
339 rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, 339 // Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
340 String.Format("{0} not supported", rdata.method)); 340 // MsgId, rdata.method, rdata.path);
341 break; 341 // rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
342 } 342 // String.Format("{0} not supported", rdata.method));
343 // break;
344 //}
343 } 345 }
344 346
345 #endregion Interface 347 #endregion Interface
@@ -1869,7 +1871,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
1869 1871
1870 // Create AssetBase entity to hold the inlined asset 1872 // Create AssetBase entity to hold the inlined asset
1871 1873
1872 asset = new AssetBase(uuid, name, type); 1874 asset = new AssetBase(uuid, name, type, UUID.Zero.ToString());
1873 1875
1874 asset.Description = desc; 1876 asset.Description = desc;
1875 asset.Local = local; 1877 asset.Local = local;
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
index 5798286..734b668 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs
@@ -113,14 +113,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
113 rxw.WriteString(s.RegionInfo.ExternalHostName); 113 rxw.WriteString(s.RegionInfo.ExternalHostName);
114 rxw.WriteEndAttribute(); 114 rxw.WriteEndAttribute();
115 115
116 rxw.WriteStartAttribute(String.Empty, "master_name", String.Empty);
117 rxw.WriteString(String.Format("{0} {1}", s.RegionInfo.MasterAvatarFirstName, s.RegionInfo.MasterAvatarLastName));
118 rxw.WriteEndAttribute();
119
120 rxw.WriteStartAttribute(String.Empty, "master_uuid", String.Empty);
121 rxw.WriteString(s.RegionInfo.MasterAvatarAssignedUUID.ToString());
122 rxw.WriteEndAttribute();
123
124 rxw.WriteStartAttribute(String.Empty, "ip", String.Empty); 116 rxw.WriteStartAttribute(String.Empty, "ip", String.Empty);
125 rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString()); 117 rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
126 rxw.WriteEndAttribute(); 118 rxw.WriteEndAttribute();
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs b/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
index 746d08d..5e76009 100644
--- a/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Regions/RegionDetails.cs
@@ -56,20 +56,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
56 region_id = regInfo.RegionID.ToString(); 56 region_id = regInfo.RegionID.ToString();
57 region_x = regInfo.RegionLocX; 57 region_x = regInfo.RegionLocX;
58 region_y = regInfo.RegionLocY; 58 region_y = regInfo.RegionLocY;
59 if (regInfo.EstateSettings.EstateOwner != UUID.Zero) 59 region_owner_id = regInfo.EstateSettings.EstateOwner.ToString();
60 region_owner_id = regInfo.EstateSettings.EstateOwner.ToString();
61 else
62 region_owner_id = regInfo.MasterAvatarAssignedUUID.ToString();
63 region_http_port = regInfo.HttpPort; 60 region_http_port = regInfo.HttpPort;
64 region_server_uri = regInfo.ServerURI; 61 region_server_uri = regInfo.ServerURI;
65 region_external_hostname = regInfo.ExternalHostName; 62 region_external_hostname = regInfo.ExternalHostName;
66 63
67 Uri uri = new Uri(region_server_uri); 64 Uri uri = new Uri(region_server_uri);
68 region_port = (uint)uri.Port; 65 region_port = (uint)uri.Port;
69
70 if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName))
71 region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName,
72 regInfo.MasterAvatarLastName);
73 } 66 }
74 67
75 public string this[string idx] 68 public string this[string idx]