diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
8 files changed, 129 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs index 3b66859..53d2cef 100644 --- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs | |||
@@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
109 | 109 | ||
110 | // Try to parse the texture ID from the request URL | 110 | // Try to parse the texture ID from the request URL |
111 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 111 | NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
112 | string textureStr = GetOne(query, "texture_id"); | 112 | string textureStr = query.GetOne("texture_id"); |
113 | 113 | ||
114 | if (m_assetService == null) | 114 | if (m_assetService == null) |
115 | { | 115 | { |
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
166 | 166 | ||
167 | private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture) | 167 | private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture) |
168 | { | 168 | { |
169 | string range = GetOne(request.Headers, "Range"); | 169 | string range = request.Headers.GetOne("Range"); |
170 | if (!String.IsNullOrEmpty(range)) | 170 | if (!String.IsNullOrEmpty(range)) |
171 | { | 171 | { |
172 | // Range request | 172 | // Range request |
@@ -216,14 +216,5 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps | |||
216 | start = end = 0; | 216 | start = end = 0; |
217 | return false; | 217 | return false; |
218 | } | 218 | } |
219 | |||
220 | private static string GetOne(NameValueCollection collection, string key) | ||
221 | { | ||
222 | string[] values = collection.GetValues(key); | ||
223 | if (values != null && values.Length > 0) | ||
224 | return values[0]; | ||
225 | |||
226 | return null; | ||
227 | } | ||
228 | } | 219 | } |
229 | } | 220 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 23828ef..77e73fb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -30,6 +30,7 @@ using System.Reflection; | |||
30 | using log4net; | 30 | using log4net; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenMetaverse.Packets; | ||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework; | 35 | using OpenSim.Region.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -169,6 +170,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
169 | return true; | 170 | return true; |
170 | } | 171 | } |
171 | 172 | ||
173 | public void RezMultipleAttachmentsFromInventory( | ||
174 | IClientAPI remoteClient, | ||
175 | RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, | ||
176 | RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects) | ||
177 | { | ||
178 | foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects) | ||
179 | { | ||
180 | RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt); | ||
181 | } | ||
182 | } | ||
183 | |||
172 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | 184 | public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) |
173 | { | 185 | { |
174 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); | 186 | m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); |
@@ -238,6 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
238 | itemID, remoteClient.Name, AttachmentPt); | 250 | itemID, remoteClient.Name, AttachmentPt); |
239 | } | 251 | } |
240 | 252 | ||
253 | objatt.ResumeScripts(); | ||
241 | return objatt; | 254 | return objatt; |
242 | } | 255 | } |
243 | 256 | ||
@@ -311,6 +324,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
311 | } | 324 | } |
312 | } | 325 | } |
313 | 326 | ||
327 | public void DetachObject(uint objectLocalID, IClientAPI remoteClient) | ||
328 | { | ||
329 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); | ||
330 | if (group != null) | ||
331 | { | ||
332 | //group.DetachToGround(); | ||
333 | ShowDetachInUserInventory(group.GetFromItemID(), remoteClient); | ||
334 | } | ||
335 | } | ||
336 | |||
314 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) | 337 | public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) |
315 | { | 338 | { |
316 | ScenePresence presence; | 339 | ScenePresence presence; |
@@ -329,6 +352,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
329 | DetachSingleAttachmentToInv(itemID, remoteClient); | 352 | DetachSingleAttachmentToInv(itemID, remoteClient); |
330 | } | 353 | } |
331 | 354 | ||
355 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) | ||
356 | { | ||
357 | SceneObjectPart part = m_scene.GetSceneObjectPart(itemID); | ||
358 | if (part == null || part.ParentGroup == null) | ||
359 | return; | ||
360 | |||
361 | UUID inventoryID = part.ParentGroup.GetFromItemID(); | ||
362 | |||
363 | ScenePresence presence; | ||
364 | if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
365 | { | ||
366 | if (!m_scene.Permissions.CanRezObject( | ||
367 | part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) | ||
368 | return; | ||
369 | |||
370 | presence.Appearance.DetachAttachment(itemID); | ||
371 | |||
372 | if (m_scene.AvatarFactory != null) | ||
373 | { | ||
374 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
375 | } | ||
376 | part.ParentGroup.DetachToGround(); | ||
377 | |||
378 | List<UUID> uuids = new List<UUID>(); | ||
379 | uuids.Add(inventoryID); | ||
380 | m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids); | ||
381 | remoteClient.SendRemoveInventoryItem(inventoryID); | ||
382 | } | ||
383 | |||
384 | m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero); | ||
385 | } | ||
386 | |||
332 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. | 387 | // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. |
333 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? | 388 | // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? |
334 | protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | 389 | protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) |
@@ -359,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
359 | } | 414 | } |
360 | } | 415 | } |
361 | } | 416 | } |
362 | } \ No newline at end of file | 417 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 16e05b7..32a0df9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -621,6 +621,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
621 | } | 621 | } |
622 | } | 622 | } |
623 | 623 | ||
624 | rootPart.ParentGroup.ResumeScripts(); | ||
624 | return rootPart.ParentGroup; | 625 | return rootPart.ParentGroup; |
625 | } | 626 | } |
626 | } | 627 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index e97d21f..a2f26d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -311,10 +311,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
311 | { | 311 | { |
312 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); | 312 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); |
313 | 313 | ||
314 | UUID requestedItemId = item.ID; | ||
315 | |||
314 | item = m_InventoryService.GetItem(item); | 316 | item = m_InventoryService.GetItem(item); |
315 | 317 | ||
316 | if (null == item) | 318 | if (null == item) |
317 | m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", item.ID); | 319 | m_log.ErrorFormat( |
320 | "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", requestedItemId); | ||
318 | 321 | ||
319 | return item; | 322 | return item; |
320 | } | 323 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 14bab6e..b37beab 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -53,25 +53,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | 56 | protected Scene m_scene; |
57 | private static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); | 57 | protected Stream m_loadStream; |
58 | 58 | protected Guid m_requestId; | |
59 | private Scene m_scene; | 59 | protected string m_errorMessage; |
60 | private Stream m_loadStream; | ||
61 | private Guid m_requestId; | ||
62 | private string m_errorMessage; | ||
63 | 60 | ||
64 | /// <value> | 61 | /// <value> |
65 | /// Should the archive being loaded be merged with what is already on the region? | 62 | /// Should the archive being loaded be merged with what is already on the region? |
66 | /// </value> | 63 | /// </value> |
67 | private bool m_merge; | 64 | protected bool m_merge; |
65 | |||
66 | /// <value> | ||
67 | /// Should we ignore any assets when reloading the archive? | ||
68 | /// </value> | ||
69 | protected bool m_skipAssets; | ||
68 | 70 | ||
69 | /// <summary> | 71 | /// <summary> |
70 | /// Used to cache lookups for valid uuids. | 72 | /// Used to cache lookups for valid uuids. |
71 | /// </summary> | 73 | /// </summary> |
72 | private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>(); | 74 | private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>(); |
73 | 75 | ||
74 | public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId) | 76 | public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId) |
75 | { | 77 | { |
76 | m_scene = scene; | 78 | m_scene = scene; |
77 | 79 | ||
@@ -89,14 +91,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
89 | 91 | ||
90 | m_errorMessage = String.Empty; | 92 | m_errorMessage = String.Empty; |
91 | m_merge = merge; | 93 | m_merge = merge; |
94 | m_skipAssets = skipAssets; | ||
92 | m_requestId = requestId; | 95 | m_requestId = requestId; |
93 | } | 96 | } |
94 | 97 | ||
95 | public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId) | 98 | public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId) |
96 | { | 99 | { |
97 | m_scene = scene; | 100 | m_scene = scene; |
98 | m_loadStream = loadStream; | 101 | m_loadStream = loadStream; |
99 | m_merge = merge; | 102 | m_merge = merge; |
103 | m_skipAssets = skipAssets; | ||
100 | m_requestId = requestId; | 104 | m_requestId = requestId; |
101 | } | 105 | } |
102 | 106 | ||
@@ -133,9 +137,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
133 | 137 | ||
134 | if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) | 138 | if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) |
135 | { | 139 | { |
136 | serialisedSceneObjects.Add(m_utf8Encoding.GetString(data)); | 140 | serialisedSceneObjects.Add(Encoding.UTF8.GetString(data)); |
137 | } | 141 | } |
138 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 142 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH) && !m_skipAssets) |
139 | { | 143 | { |
140 | if (LoadAsset(filePath, data)) | 144 | if (LoadAsset(filePath, data)) |
141 | successfulAssetRestores++; | 145 | successfulAssetRestores++; |
@@ -155,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
155 | } | 159 | } |
156 | else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) | 160 | else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) |
157 | { | 161 | { |
158 | serialisedParcels.Add(m_utf8Encoding.GetString(data)); | 162 | serialisedParcels.Add(Encoding.UTF8.GetString(data)); |
159 | } | 163 | } |
160 | else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) | 164 | else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
161 | { | 165 | { |
@@ -178,12 +182,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
178 | archive.Close(); | 182 | archive.Close(); |
179 | } | 183 | } |
180 | 184 | ||
181 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); | 185 | if (!m_skipAssets) |
182 | |||
183 | if (failedAssetRestores > 0) | ||
184 | { | 186 | { |
185 | m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); | 187 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); |
186 | m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); | 188 | |
189 | if (failedAssetRestores > 0) | ||
190 | { | ||
191 | m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); | ||
192 | m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); | ||
193 | } | ||
187 | } | 194 | } |
188 | 195 | ||
189 | if (!m_merge) | 196 | if (!m_merge) |
@@ -279,6 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
279 | { | 286 | { |
280 | sceneObjectsLoadedCount++; | 287 | sceneObjectsLoadedCount++; |
281 | sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); | 288 | sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); |
289 | sceneObject.ResumeScripts(); | ||
282 | } | 290 | } |
283 | } | 291 | } |
284 | 292 | ||
@@ -543,7 +551,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
543 | XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); | 551 | XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); |
544 | 552 | ||
545 | XmlTextReader xtr | 553 | XmlTextReader xtr |
546 | = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context); | 554 | = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); |
547 | 555 | ||
548 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; | 556 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; |
549 | 557 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index fc8d4e1..82ede01 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
94 | public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) | 94 | public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) |
95 | { | 95 | { |
96 | bool mergeOar = false; | 96 | bool mergeOar = false; |
97 | bool skipAssets = false; | ||
97 | 98 | ||
98 | OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); | 99 | OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); |
100 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); | ||
101 | |||
99 | List<string> mainParams = options.Parse(cmdparams); | 102 | List<string> mainParams = options.Parse(cmdparams); |
100 | 103 | ||
101 | // m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar); | 104 | // m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar); |
@@ -105,11 +108,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
105 | 108 | ||
106 | if (mainParams.Count > 2) | 109 | if (mainParams.Count > 2) |
107 | { | 110 | { |
108 | DearchiveRegion(mainParams[2], mergeOar, Guid.Empty); | 111 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); |
109 | } | 112 | } |
110 | else | 113 | else |
111 | { | 114 | { |
112 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, Guid.Empty); | 115 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, skipAssets, Guid.Empty); |
113 | } | 116 | } |
114 | } | 117 | } |
115 | 118 | ||
@@ -154,25 +157,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
154 | 157 | ||
155 | public void DearchiveRegion(string loadPath) | 158 | public void DearchiveRegion(string loadPath) |
156 | { | 159 | { |
157 | DearchiveRegion(loadPath, false, Guid.Empty); | 160 | DearchiveRegion(loadPath, false, false, Guid.Empty); |
158 | } | 161 | } |
159 | 162 | ||
160 | public void DearchiveRegion(string loadPath, bool merge, Guid requestId) | 163 | public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId) |
161 | { | 164 | { |
162 | m_log.InfoFormat( | 165 | m_log.InfoFormat( |
163 | "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath); | 166 | "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath); |
164 | 167 | ||
165 | new ArchiveReadRequest(m_scene, loadPath, merge, requestId).DearchiveRegion(); | 168 | new ArchiveReadRequest(m_scene, loadPath, merge, skipAssets, requestId).DearchiveRegion(); |
166 | } | 169 | } |
167 | 170 | ||
168 | public void DearchiveRegion(Stream loadStream) | 171 | public void DearchiveRegion(Stream loadStream) |
169 | { | 172 | { |
170 | DearchiveRegion(loadStream, false, Guid.Empty); | 173 | DearchiveRegion(loadStream, false, false, Guid.Empty); |
171 | } | 174 | } |
172 | 175 | ||
173 | public void DearchiveRegion(Stream loadStream, bool merge, Guid requestId) | 176 | public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId) |
174 | { | 177 | { |
175 | new ArchiveReadRequest(m_scene, loadStream, merge, requestId).DearchiveRegion(); | 178 | new ArchiveReadRequest(m_scene, loadStream, merge, skipAssets, requestId).DearchiveRegion(); |
176 | } | 179 | } |
177 | } | 180 | } |
178 | } | 181 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index de16d89..624dc22 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -442,7 +442,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
442 | byte[] archive = archiveWriteStream.ToArray(); | 442 | byte[] archive = archiveWriteStream.ToArray(); |
443 | MemoryStream archiveReadStream = new MemoryStream(archive); | 443 | MemoryStream archiveReadStream = new MemoryStream(archive); |
444 | 444 | ||
445 | m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); | 445 | m_archiverModule.DearchiveRegion(archiveReadStream, true, false, Guid.Empty); |
446 | 446 | ||
447 | SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name); | 447 | SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name); |
448 | Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); | 448 | Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 0f830e1..d940564 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -162,7 +162,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
162 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 162 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
163 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 163 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
164 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 164 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
165 | private IFriendsModule m_friendsModule = null; | 165 | private IFriendsModule m_friendsModule; |
166 | private IGroupsModule m_groupsModule; | ||
166 | 167 | ||
167 | #endregion | 168 | #endregion |
168 | 169 | ||
@@ -386,9 +387,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
386 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 387 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
387 | 388 | ||
388 | if (m_friendsModule == null) | 389 | if (m_friendsModule == null) |
389 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | 390 | m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work"); |
390 | else | 391 | |
391 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); | 392 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); |
393 | |||
394 | if (m_groupsModule == null) | ||
395 | m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); | ||
392 | } | 396 | } |
393 | 397 | ||
394 | public void Close() | 398 | public void Close() |
@@ -423,14 +427,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
423 | // with the powers requested (powers = 0 for no powers check) | 427 | // with the powers requested (powers = 0 for no powers check) |
424 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) | 428 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) |
425 | { | 429 | { |
426 | ScenePresence sp = m_scene.GetScenePresence(userID); | 430 | if (null == m_groupsModule) |
427 | if (sp != null) | 431 | return false; |
428 | { | 432 | |
429 | IClientAPI client = sp.ControllingClient; | 433 | GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); |
430 | 434 | ||
431 | return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && | 435 | if (gmd != null) |
432 | ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); | 436 | { |
437 | if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers) | ||
438 | return true; | ||
433 | } | 439 | } |
440 | |||
434 | return false; | 441 | return false; |
435 | } | 442 | } |
436 | 443 | ||
@@ -721,8 +728,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
721 | permission = false; | 728 | permission = false; |
722 | } | 729 | } |
723 | 730 | ||
731 | // m_log.DebugFormat( | ||
732 | // "[PERMISSIONS]: group.GroupID = {0}, part.GroupMask = {1}, isGroupMember = {2} for {3}", | ||
733 | // group.GroupID, | ||
734 | // m_scene.GetSceneObjectPart(objId).GroupMask, | ||
735 | // IsGroupMember(group.GroupID, currentUser, 0), | ||
736 | // currentUser); | ||
737 | |||
724 | // Group members should be able to edit group objects | 738 | // Group members should be able to edit group objects |
725 | if ((group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0)) | 739 | if ((group.GroupID != UUID.Zero) |
740 | && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) | ||
741 | && IsGroupMember(group.GroupID, currentUser, 0)) | ||
726 | { | 742 | { |
727 | // Return immediately, so that the administrator can shares group objects | 743 | // Return immediately, so that the administrator can shares group objects |
728 | return true; | 744 | return true; |
@@ -957,7 +973,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
957 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 973 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
958 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 974 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
959 | 975 | ||
960 | |||
961 | return GenericObjectPermission(editorID, objectID, false); | 976 | return GenericObjectPermission(editorID, objectID, false); |
962 | } | 977 | } |
963 | 978 | ||