diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IUserManagement.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | 5 | ||||
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 6 | ||||
-rw-r--r-- | OpenSim/Services/AssetService/AssetService.cs | 73 | ||||
-rw-r--r-- | OpenSim/Services/HypergridService/HGAssetService.cs | 181 | ||||
-rw-r--r-- | OpenSim/Services/HypergridService/HGInventoryService.cs (renamed from OpenSim/Services/InventoryService/HGInventoryService.cs) | 47 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 16 |
12 files changed, 319 insertions, 45 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 67732ff..1ff1a47 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -53,6 +53,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
53 | 53 | ||
54 | protected bool m_Enabled = false; | 54 | protected bool m_Enabled = false; |
55 | protected Scene m_Scene; | 55 | protected Scene m_Scene; |
56 | protected IUserManagement m_UserManagement; | ||
57 | protected IUserManagement UserManagementModule | ||
58 | { | ||
59 | get | ||
60 | { | ||
61 | if (m_UserManagement == null) | ||
62 | m_UserManagement = m_Scene.RequestModuleInterface<IUserManagement>(); | ||
63 | return m_UserManagement; | ||
64 | } | ||
65 | } | ||
66 | |||
56 | 67 | ||
57 | #region INonSharedRegionModule | 68 | #region INonSharedRegionModule |
58 | 69 | ||
@@ -542,6 +553,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
542 | SceneObjectGroup group | 553 | SceneObjectGroup group |
543 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | 554 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); |
544 | 555 | ||
556 | Util.FireAndForget(delegate { AddUserData(group); }); | ||
557 | |||
545 | group.RootPart.FromFolderID = item.Folder; | 558 | group.RootPart.FromFolderID = item.Folder; |
546 | 559 | ||
547 | // If it's rezzed in world, select it. Much easier to | 560 | // If it's rezzed in world, select it. Much easier to |
@@ -699,6 +712,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
699 | return null; | 712 | return null; |
700 | } | 713 | } |
701 | 714 | ||
715 | protected void AddUserData(SceneObjectGroup sog) | ||
716 | { | ||
717 | UserManagementModule.AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); | ||
718 | foreach (SceneObjectPart sop in sog.Parts) | ||
719 | UserManagementModule.AddUser(sop.CreatorID, sop.CreatorData); | ||
720 | } | ||
721 | |||
702 | public virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | 722 | public virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) |
703 | { | 723 | { |
704 | } | 724 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 0d94baa..bf84100 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -275,6 +275,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
275 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); | 275 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); |
276 | } | 276 | } |
277 | 277 | ||
278 | public void AddUser(UUID uuid, string first, string last, string profileURL) | ||
279 | { | ||
280 | AddUser(uuid, profileURL + ";" + first + " " + last); | ||
281 | } | ||
282 | |||
278 | //public void AddUser(UUID uuid, string userData) | 283 | //public void AddUser(UUID uuid, string userData) |
279 | //{ | 284 | //{ |
280 | // if (m_UserCache.ContainsKey(uuid)) | 285 | // if (m_UserCache.ContainsKey(uuid)) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs index 2324380..e25700d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs | |||
@@ -91,9 +91,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset | |||
91 | { | 91 | { |
92 | m_Registered = true; | 92 | m_Registered = true; |
93 | 93 | ||
94 | m_log.Info("[RegionAssetService]: Starting..."); | 94 | m_log.Info("[HGAssetService]: Starting..."); |
95 | 95 | ||
96 | Object[] args = new Object[] { m_Config, MainServer.Instance, string.Empty }; | 96 | |
97 | Object[] args = new Object[] { m_Config, MainServer.Instance, "HGAssetService" }; | ||
97 | 98 | ||
98 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args); | 99 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args); |
99 | } | 100 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 1a5cb7e..2904ee8 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs | |||
@@ -9,5 +9,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
9 | { | 9 | { |
10 | string GetUserName(UUID uuid); | 10 | string GetUserName(UUID uuid); |
11 | void AddUser(UUID uuid, string userData); | 11 | void AddUser(UUID uuid, string userData); |
12 | void AddUser(UUID uuid, string firstName, string lastName, string profileURL); | ||
12 | } | 13 | } |
13 | } | 14 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 06f8ac1..2cf0ced 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -416,6 +416,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
416 | 416 | ||
417 | if ((item != null) && (item.Owner == senderId)) | 417 | if ((item != null) && (item.Owner == senderId)) |
418 | { | 418 | { |
419 | IUserManagement uman = RequestModuleInterface<IUserManagement>(); | ||
420 | if (uman != null) | ||
421 | uman.AddUser(item.CreatorIdAsUuid, item.CreatorData); | ||
422 | |||
419 | if (!Permissions.BypassPermissions()) | 423 | if (!Permissions.BypassPermissions()) |
420 | { | 424 | { |
421 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 425 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 129b52d..70aceb1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2563,6 +2563,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2563 | } | 2563 | } |
2564 | else | 2564 | else |
2565 | m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); | 2565 | m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); |
2566 | |||
2566 | } | 2567 | } |
2567 | } | 2568 | } |
2568 | 2569 | ||
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index b6425f4..df571fa 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -53,12 +53,15 @@ namespace OpenSim.Server.Handlers.Asset | |||
53 | String.Empty); | 53 | String.Empty); |
54 | 54 | ||
55 | if (assetService == String.Empty) | 55 | if (assetService == String.Empty) |
56 | throw new Exception("No AssetService in config file"); | 56 | throw new Exception("No LocalServiceModule in config file"); |
57 | 57 | ||
58 | Object[] args = new Object[] { config }; | 58 | Object[] args = new Object[] { config }; |
59 | m_AssetService = | 59 | m_AssetService = |
60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | 60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); |
61 | 61 | ||
62 | if (m_AssetService == null) | ||
63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | ||
64 | |||
62 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); | 65 | bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); |
63 | 66 | ||
64 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 67 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 22a718a..00f035c 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -153,7 +153,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
153 | } | 153 | } |
154 | catch (Exception e) | 154 | catch (Exception e) |
155 | { | 155 | { |
156 | m_log.Debug("[XINVENTORY HANDLER]: Exception {0}", e); | 156 | m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e); |
157 | } | 157 | } |
158 | 158 | ||
159 | return FailureResult(); | 159 | return FailureResult(); |
@@ -604,6 +604,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
604 | ret["CreatorId"] = item.CreatorId.ToString(); | 604 | ret["CreatorId"] = item.CreatorId.ToString(); |
605 | else | 605 | else |
606 | ret["CreatorId"] = String.Empty; | 606 | ret["CreatorId"] = String.Empty; |
607 | if (item.CreatorData != null) | ||
608 | ret["CreatorData"] = item.CreatorData; | ||
609 | else | ||
610 | ret["CreatorData"] = String.Empty; | ||
607 | ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); | 611 | ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); |
608 | ret["Description"] = item.Description.ToString(); | 612 | ret["Description"] = item.Description.ToString(); |
609 | ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); | 613 | ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 470a4dd..3fd2fcf 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -43,44 +43,51 @@ namespace OpenSim.Services.AssetService | |||
43 | LogManager.GetLogger( | 43 | LogManager.GetLogger( |
44 | MethodBase.GetCurrentMethod().DeclaringType); | 44 | MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected static AssetService m_RootInstance; | ||
47 | |||
46 | public AssetService(IConfigSource config) : base(config) | 48 | public AssetService(IConfigSource config) : base(config) |
47 | { | 49 | { |
48 | MainConsole.Instance.Commands.AddCommand("kfs", false, | 50 | if (m_RootInstance == null) |
49 | "show digest", | ||
50 | "show digest <ID>", | ||
51 | "Show asset digest", HandleShowDigest); | ||
52 | |||
53 | MainConsole.Instance.Commands.AddCommand("kfs", false, | ||
54 | "delete asset", | ||
55 | "delete asset <ID>", | ||
56 | "Delete asset from database", HandleDeleteAsset); | ||
57 | |||
58 | if (m_AssetLoader != null) | ||
59 | { | 51 | { |
60 | IConfig assetConfig = config.Configs["AssetService"]; | 52 | m_RootInstance = this; |
61 | if (assetConfig == null) | ||
62 | throw new Exception("No AssetService configuration"); | ||
63 | 53 | ||
64 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", | 54 | MainConsole.Instance.Commands.AddCommand("kfs", false, |
65 | String.Empty); | 55 | "show digest", |
56 | "show digest <ID>", | ||
57 | "Show asset digest", HandleShowDigest); | ||
66 | 58 | ||
67 | bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true); | 59 | MainConsole.Instance.Commands.AddCommand("kfs", false, |
60 | "delete asset", | ||
61 | "delete asset <ID>", | ||
62 | "Delete asset from database", HandleDeleteAsset); | ||
68 | 63 | ||
69 | if (assetLoaderEnabled) | 64 | if (m_AssetLoader != null) |
70 | { | 65 | { |
71 | m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); | 66 | IConfig assetConfig = config.Configs["AssetService"]; |
72 | m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, | 67 | if (assetConfig == null) |
73 | delegate(AssetBase a) | 68 | throw new Exception("No AssetService configuration"); |
74 | { | 69 | |
75 | Store(a); | 70 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", |
76 | }); | 71 | String.Empty); |
72 | |||
73 | bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true); | ||
74 | |||
75 | if (assetLoaderEnabled) | ||
76 | { | ||
77 | m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); | ||
78 | m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, | ||
79 | delegate(AssetBase a) | ||
80 | { | ||
81 | Store(a); | ||
82 | }); | ||
83 | } | ||
84 | |||
85 | m_log.Info("[ASSET SERVICE]: Local asset service enabled"); | ||
77 | } | 86 | } |
78 | |||
79 | m_log.Info("[ASSET SERVICE]: Local asset service enabled"); | ||
80 | } | 87 | } |
81 | } | 88 | } |
82 | 89 | ||
83 | public AssetBase Get(string id) | 90 | public virtual AssetBase Get(string id) |
84 | { | 91 | { |
85 | UUID assetID; | 92 | UUID assetID; |
86 | 93 | ||
@@ -93,12 +100,12 @@ namespace OpenSim.Services.AssetService | |||
93 | return m_Database.GetAsset(assetID); | 100 | return m_Database.GetAsset(assetID); |
94 | } | 101 | } |
95 | 102 | ||
96 | public AssetBase GetCached(string id) | 103 | public virtual AssetBase GetCached(string id) |
97 | { | 104 | { |
98 | return Get(id); | 105 | return Get(id); |
99 | } | 106 | } |
100 | 107 | ||
101 | public AssetMetadata GetMetadata(string id) | 108 | public virtual AssetMetadata GetMetadata(string id) |
102 | { | 109 | { |
103 | UUID assetID; | 110 | UUID assetID; |
104 | 111 | ||
@@ -112,7 +119,7 @@ namespace OpenSim.Services.AssetService | |||
112 | return null; | 119 | return null; |
113 | } | 120 | } |
114 | 121 | ||
115 | public byte[] GetData(string id) | 122 | public virtual byte[] GetData(string id) |
116 | { | 123 | { |
117 | UUID assetID; | 124 | UUID assetID; |
118 | 125 | ||
@@ -123,7 +130,7 @@ namespace OpenSim.Services.AssetService | |||
123 | return asset.Data; | 130 | return asset.Data; |
124 | } | 131 | } |
125 | 132 | ||
126 | public bool Get(string id, Object sender, AssetRetrieved handler) | 133 | public virtual bool Get(string id, Object sender, AssetRetrieved handler) |
127 | { | 134 | { |
128 | //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); | 135 | //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); |
129 | 136 | ||
@@ -141,7 +148,7 @@ namespace OpenSim.Services.AssetService | |||
141 | return true; | 148 | return true; |
142 | } | 149 | } |
143 | 150 | ||
144 | public string Store(AssetBase asset) | 151 | public virtual string Store(AssetBase asset) |
145 | { | 152 | { |
146 | //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); | 153 | //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); |
147 | m_Database.StoreAsset(asset); | 154 | m_Database.StoreAsset(asset); |
@@ -154,7 +161,7 @@ namespace OpenSim.Services.AssetService | |||
154 | return false; | 161 | return false; |
155 | } | 162 | } |
156 | 163 | ||
157 | public bool Delete(string id) | 164 | public virtual bool Delete(string id) |
158 | { | 165 | { |
159 | m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id); | 166 | m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id); |
160 | UUID assetID; | 167 | UUID assetID; |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs new file mode 100644 index 0000000..6e0d4cd --- /dev/null +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -0,0 +1,181 @@ | |||
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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.IO; | ||
30 | using System.Reflection; | ||
31 | using System.Xml; | ||
32 | |||
33 | using Nini.Config; | ||
34 | using log4net; | ||
35 | using OpenMetaverse; | ||
36 | |||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Server.Base; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenSim.Services.AssetService; | ||
41 | |||
42 | namespace OpenSim.Services.HypergridService | ||
43 | { | ||
44 | public class HGAssetService : OpenSim.Services.AssetService.AssetService, IAssetService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private string m_ProfileServiceURL; | ||
51 | private IUserAccountService m_UserAccountService; | ||
52 | |||
53 | private UserAccountCache m_Cache; | ||
54 | |||
55 | public HGAssetService(IConfigSource config) : base(config) | ||
56 | { | ||
57 | m_log.Debug("[HGAsset Service]: Starting"); | ||
58 | IConfig assetConfig = config.Configs["HGAssetService"]; | ||
59 | if (assetConfig == null) | ||
60 | throw new Exception("No HGAssetService configuration"); | ||
61 | |||
62 | string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); | ||
63 | if (userAccountsDll == string.Empty) | ||
64 | throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); | ||
65 | |||
66 | Object[] args = new Object[] { config }; | ||
67 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args); | ||
68 | if (m_UserAccountService == null) | ||
69 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | ||
70 | |||
71 | m_ProfileServiceURL = assetConfig.GetString("ProfileServerURI", string.Empty); | ||
72 | |||
73 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | ||
74 | } | ||
75 | |||
76 | #region IAssetService overrides | ||
77 | public override AssetBase Get(string id) | ||
78 | { | ||
79 | AssetBase asset = base.Get(id); | ||
80 | |||
81 | if (asset == null) | ||
82 | return null; | ||
83 | |||
84 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | ||
85 | asset.Data = AdjustIdentifiers(asset.Data); ; | ||
86 | |||
87 | AdjustIdentifiers(asset.Metadata); | ||
88 | |||
89 | return asset; | ||
90 | } | ||
91 | |||
92 | public override AssetMetadata GetMetadata(string id) | ||
93 | { | ||
94 | AssetMetadata meta = base.GetMetadata(id); | ||
95 | |||
96 | if (meta == null) | ||
97 | return null; | ||
98 | |||
99 | AdjustIdentifiers(meta); | ||
100 | |||
101 | return meta; | ||
102 | } | ||
103 | |||
104 | public override byte[] GetData(string id) | ||
105 | { | ||
106 | byte[] data = base.GetData(id); | ||
107 | |||
108 | if (data == null) | ||
109 | return null; | ||
110 | |||
111 | return AdjustIdentifiers(data); | ||
112 | } | ||
113 | |||
114 | //public virtual bool Get(string id, Object sender, AssetRetrieved handler) | ||
115 | |||
116 | public override bool Delete(string id) | ||
117 | { | ||
118 | // NOGO | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | #endregion | ||
123 | |||
124 | protected void AdjustIdentifiers(AssetMetadata meta) | ||
125 | { | ||
126 | UserAccount creator = m_Cache.GetUser(meta.CreatorID); | ||
127 | if (creator != null) | ||
128 | meta.CreatorID = m_ProfileServiceURL + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; | ||
129 | |||
130 | } | ||
131 | |||
132 | protected byte[] AdjustIdentifiers(byte[] data) | ||
133 | { | ||
134 | string xml = Utils.BytesToString(data); | ||
135 | return Utils.StringToBytes(RewriteSOP(xml)); | ||
136 | } | ||
137 | |||
138 | protected string RewriteSOP(string xml) | ||
139 | { | ||
140 | XmlDocument doc = new XmlDocument(); | ||
141 | doc.LoadXml(xml); | ||
142 | XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); | ||
143 | |||
144 | foreach (XmlNode sop in sops) | ||
145 | { | ||
146 | UserAccount creator = null; | ||
147 | bool hasCreatorData = false; | ||
148 | XmlNodeList nodes = sop.ChildNodes; | ||
149 | foreach (XmlNode node in nodes) | ||
150 | { | ||
151 | if (node.Name == "CreatorID") | ||
152 | creator = m_Cache.GetUser(node.InnerText); | ||
153 | if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty) | ||
154 | hasCreatorData = true; | ||
155 | |||
156 | //if (node.Name == "OwnerID") | ||
157 | //{ | ||
158 | // UserAccount owner = GetUser(node.InnerText); | ||
159 | // if (owner != null) | ||
160 | // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName; | ||
161 | //} | ||
162 | } | ||
163 | if (!hasCreatorData && creator != null) | ||
164 | { | ||
165 | XmlElement creatorData = doc.CreateElement("CreatorData"); | ||
166 | creatorData.InnerText = m_ProfileServiceURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; | ||
167 | sop.AppendChild(creatorData); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | using (StringWriter wr = new StringWriter()) | ||
172 | { | ||
173 | doc.Save(wr); | ||
174 | return wr.ToString(); | ||
175 | } | ||
176 | |||
177 | } | ||
178 | |||
179 | } | ||
180 | |||
181 | } | ||
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index d62c008..a04f0c4 100644 --- a/OpenSim/Services/InventoryService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs | |||
@@ -33,10 +33,12 @@ using Nini.Config; | |||
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using OpenSim.Services.Base; | 34 | using OpenSim.Services.Base; |
35 | using OpenSim.Services.Interfaces; | 35 | using OpenSim.Services.Interfaces; |
36 | using OpenSim.Services.InventoryService; | ||
36 | using OpenSim.Data; | 37 | using OpenSim.Data; |
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Server.Base; | ||
38 | 40 | ||
39 | namespace OpenSim.Services.InventoryService | 41 | namespace OpenSim.Services.HypergridService |
40 | { | 42 | { |
41 | public class HGInventoryService : XInventoryService, IInventoryService | 43 | public class HGInventoryService : XInventoryService, IInventoryService |
42 | { | 44 | { |
@@ -46,9 +48,16 @@ namespace OpenSim.Services.InventoryService | |||
46 | 48 | ||
47 | protected new IXInventoryData m_Database; | 49 | protected new IXInventoryData m_Database; |
48 | 50 | ||
51 | private string m_ProfileServiceURL; | ||
52 | private IUserAccountService m_UserAccountService; | ||
53 | |||
54 | private UserAccountCache m_Cache; | ||
55 | |||
49 | public HGInventoryService(IConfigSource config) | 56 | public HGInventoryService(IConfigSource config) |
50 | : base(config) | 57 | : base(config) |
51 | { | 58 | { |
59 | m_log.Debug("[HGInventory Service]: Starting"); | ||
60 | |||
52 | string dllName = String.Empty; | 61 | string dllName = String.Empty; |
53 | string connString = String.Empty; | 62 | string connString = String.Empty; |
54 | //string realm = "Inventory"; // OSG version doesn't use this | 63 | //string realm = "Inventory"; // OSG version doesn't use this |
@@ -68,12 +77,25 @@ namespace OpenSim.Services.InventoryService | |||
68 | // | 77 | // |
69 | // Try reading the [InventoryService] section, if it exists | 78 | // Try reading the [InventoryService] section, if it exists |
70 | // | 79 | // |
71 | IConfig authConfig = config.Configs["InventoryService"]; | 80 | IConfig invConfig = config.Configs["HGInventoryService"]; |
72 | if (authConfig != null) | 81 | if (invConfig != null) |
73 | { | 82 | { |
74 | dllName = authConfig.GetString("StorageProvider", dllName); | 83 | dllName = invConfig.GetString("StorageProvider", dllName); |
75 | connString = authConfig.GetString("ConnectionString", connString); | 84 | connString = invConfig.GetString("ConnectionString", connString); |
85 | |||
76 | // realm = authConfig.GetString("Realm", realm); | 86 | // realm = authConfig.GetString("Realm", realm); |
87 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); | ||
88 | if (userAccountsDll == string.Empty) | ||
89 | throw new Exception("Please specify UserAccountsService in HGInventoryService configuration"); | ||
90 | |||
91 | Object[] args = new Object[] { config }; | ||
92 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountsDll, args); | ||
93 | if (m_UserAccountService == null) | ||
94 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | ||
95 | |||
96 | m_ProfileServiceURL = invConfig.GetString("ProfileServerURI", string.Empty); | ||
97 | |||
98 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | ||
77 | } | 99 | } |
78 | 100 | ||
79 | // | 101 | // |
@@ -282,9 +304,18 @@ namespace OpenSim.Services.InventoryService | |||
282 | //{ | 304 | //{ |
283 | //} | 305 | //} |
284 | 306 | ||
285 | //public InventoryItemBase GetItem(InventoryItemBase item) | 307 | public override InventoryItemBase GetItem(InventoryItemBase item) |
286 | //{ | 308 | { |
287 | //} | 309 | InventoryItemBase it = base.GetItem(item); |
310 | |||
311 | UserAccount user = m_Cache.GetUser(it.CreatorId); | ||
312 | |||
313 | // Adjust the creator data | ||
314 | if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) | ||
315 | it.CreatorData = m_ProfileServiceURL + "/" + it.CreatorId + ";" + user.FirstName + " " + user.LastName; | ||
316 | |||
317 | return it; | ||
318 | } | ||
288 | 319 | ||
289 | //public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 320 | //public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
290 | //{ | 321 | //{ |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index fcfdd1d..f806af3 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -762,6 +762,7 @@ namespace OpenSim.Services.LLLoginService | |||
762 | if (account.ServiceURLs == null) | 762 | if (account.ServiceURLs == null) |
763 | return; | 763 | return; |
764 | 764 | ||
765 | // Old style: get the service keys from the DB | ||
765 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) | 766 | foreach (KeyValuePair<string, object> kvp in account.ServiceURLs) |
766 | { | 767 | { |
767 | if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty)) | 768 | if (kvp.Value == null || (kvp.Value != null && kvp.Value.ToString() == string.Empty)) |
@@ -773,6 +774,21 @@ namespace OpenSim.Services.LLLoginService | |||
773 | aCircuit.ServiceURLs[kvp.Key] = kvp.Value; | 774 | aCircuit.ServiceURLs[kvp.Key] = kvp.Value; |
774 | } | 775 | } |
775 | } | 776 | } |
777 | |||
778 | // New style: service keys start with SRV_; override the previous | ||
779 | string[] keys = m_LoginServerConfig.GetKeys(); | ||
780 | |||
781 | if (keys.Length > 0) | ||
782 | { | ||
783 | IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("SRV_")); | ||
784 | foreach (string serviceKey in serviceKeys) | ||
785 | { | ||
786 | string keyName = serviceKey.Replace("SRV_", ""); | ||
787 | aCircuit.ServiceURLs[keyName] = m_LoginServerConfig.GetString(serviceKey, string.Empty); | ||
788 | m_log.DebugFormat("[LLLOGIN SERVICE]: found new key {0} {1}", keyName, aCircuit.ServiceURLs[keyName]); | ||
789 | } | ||
790 | } | ||
791 | |||
776 | } | 792 | } |
777 | 793 | ||
778 | private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason) | 794 | private bool LaunchAgentDirectly(ISimulationService simConnector, GridRegion region, AgentCircuitData aCircuit, out string reason) |