diff options
author | Diva Canto | 2009-08-13 11:30:29 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-13 11:30:29 -0700 |
commit | 6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75 (patch) | |
tree | 82b2f99cb17b12d2bae173e33065170200b49eae /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.zip opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.gz opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.bz2 opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.xz |
Inventory redirects from CachedUserInfo to InventoryService COMPLETE!
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 25 insertions, 70 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs index fa5369f..956dd10 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Framework.Communications.Cache; | |||
37 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>; | 39 | using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>; |
40 | using OpenSim.Services.Interfaces; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Agent.TextureDownload | 42 | namespace OpenSim.Region.CoreModules.Agent.TextureDownload |
42 | { | 43 | { |
@@ -217,7 +218,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload | |||
217 | if (profile == null) // Deny unknown user | 218 | if (profile == null) // Deny unknown user |
218 | return; | 219 | return; |
219 | 220 | ||
220 | if (profile.RootFolder == null) // Deny no inventory | 221 | IInventoryService invService = scene.InventoryService; |
222 | if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory | ||
221 | return; | 223 | return; |
222 | 224 | ||
223 | if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned | 225 | if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 33dc7a5..547f923 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
39 | { | 40 | { |
@@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
115 | } | 116 | } |
116 | 117 | ||
117 | 118 | ||
118 | public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance) | 119 | public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
119 | { | 120 | { |
120 | if (profile.RootFolder != null) | 121 | IInventoryService invService = m_scene.InventoryService; |
122 | |||
123 | if (invService.GetRootFolder(userID) != null) | ||
121 | { | 124 | { |
122 | for (int i = 0; i < 13; i++) | 125 | for (int i = 0; i < 13; i++) |
123 | { | 126 | { |
@@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
127 | } | 130 | } |
128 | else | 131 | else |
129 | { | 132 | { |
130 | InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); | 133 | InventoryItemBase baseItem = invService.QueryItem(new InventoryItemBase(appearance.Wearables[i].ItemID)); |
131 | 134 | ||
132 | if (baseItem != null) | 135 | if (baseItem != null) |
133 | { | 136 | { |
@@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
143 | } | 146 | } |
144 | else | 147 | else |
145 | { | 148 | { |
146 | m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work"); | 149 | m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); |
147 | } | 150 | } |
148 | } | 151 | } |
149 | 152 | ||
@@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
163 | return; | 166 | return; |
164 | } | 167 | } |
165 | 168 | ||
166 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); | ||
167 | |||
168 | AvatarAppearance avatAppearance = null; | 169 | AvatarAppearance avatAppearance = null; |
169 | if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) | 170 | if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) |
170 | { | 171 | { |
@@ -174,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
174 | 175 | ||
175 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); | 176 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); |
176 | 177 | ||
177 | if (profile != null) | 178 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
178 | { | 179 | { |
179 | if (profile.RootFolder != null) | 180 | if (wear.Type < 13) |
180 | { | 181 | { |
181 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 182 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; |
182 | { | ||
183 | if (wear.Type < 13) | ||
184 | { | ||
185 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | SetAppearanceAssets(profile, ref avatAppearance); | ||
190 | |||
191 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); | ||
192 | avatar.Appearance = avatAppearance; | ||
193 | } | ||
194 | else | ||
195 | { | ||
196 | m_log.WarnFormat( | ||
197 | "[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables", | ||
198 | clientView.Name); | ||
199 | } | 183 | } |
200 | } | 184 | } |
201 | else | 185 | |
202 | { | 186 | SetAppearanceAssets(avatar.UUID, ref avatAppearance); |
203 | m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name); | 187 | |
204 | } | 188 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); |
189 | avatar.Appearance = avatAppearance; | ||
205 | } | 190 | } |
206 | 191 | ||
207 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 192 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 6db9cbf..8f99395 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | // Temporary fix of wrong GroupPowers constants in OpenMetaverse library | 40 | // Temporary fix of wrong GroupPowers constants in OpenMetaverse library |
40 | enum GroupPowers : long | 41 | enum GroupPowers : long |
@@ -964,19 +965,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
964 | 965 | ||
965 | if (objectID == UUID.Zero) // User inventory | 966 | if (objectID == UUID.Zero) // User inventory |
966 | { | 967 | { |
967 | CachedUserInfo userInfo = | 968 | IInventoryService invService = m_scene.InventoryService; |
968 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 969 | InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(notecard)); |
969 | |||
970 | if (userInfo == null) | ||
971 | { | ||
972 | m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for edit notecard check", user); | ||
973 | return false; | ||
974 | } | ||
975 | |||
976 | if (userInfo.RootFolder == null) | ||
977 | return false; | ||
978 | |||
979 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard); | ||
980 | if (assetRequestItem == null) // Library item | 970 | if (assetRequestItem == null) // Library item |
981 | { | 971 | { |
982 | assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | 972 | assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); |
@@ -1394,19 +1384,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1394 | 1384 | ||
1395 | if (objectID == UUID.Zero) // User inventory | 1385 | if (objectID == UUID.Zero) // User inventory |
1396 | { | 1386 | { |
1397 | CachedUserInfo userInfo = | 1387 | IInventoryService invService = m_scene.InventoryService; |
1398 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 1388 | InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(script)); |
1399 | |||
1400 | if (userInfo == null) | ||
1401 | { | ||
1402 | m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for administrator check", user); | ||
1403 | return false; | ||
1404 | } | ||
1405 | |||
1406 | if (userInfo.RootFolder == null) | ||
1407 | return false; | ||
1408 | |||
1409 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(script); | ||
1410 | if (assetRequestItem == null) // Library item | 1389 | if (assetRequestItem == null) // Library item |
1411 | { | 1390 | { |
1412 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); | 1391 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); |
@@ -1499,19 +1478,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1499 | 1478 | ||
1500 | if (objectID == UUID.Zero) // User inventory | 1479 | if (objectID == UUID.Zero) // User inventory |
1501 | { | 1480 | { |
1502 | CachedUserInfo userInfo = | 1481 | IInventoryService invService = m_scene.InventoryService; |
1503 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 1482 | InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(notecard)); |
1504 | |||
1505 | if (userInfo == null) | ||
1506 | { | ||
1507 | m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for view notecard check", user); | ||
1508 | return false; | ||
1509 | } | ||
1510 | |||
1511 | if (userInfo.RootFolder == null) | ||
1512 | return false; | ||
1513 | |||
1514 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard); | ||
1515 | if (assetRequestItem == null) // Library item | 1483 | if (assetRequestItem == null) // Library item |
1516 | { | 1484 | { |
1517 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | 1485 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); |