aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs20
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs6
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs99
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs2
10 files changed, 98 insertions, 111 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index afdd99e..bba7a96 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -338,7 +338,7 @@ namespace OpenSim.Region.Framework.Scenes
338 // Update item with new asset 338 // Update item with new asset
339 item.AssetID = asset.FullID; 339 item.AssetID = asset.FullID;
340 group.UpdateInventoryItem(item); 340 group.UpdateInventoryItem(item);
341 group.AggregatePerms(); 341 group.InvalidateEffectivePerms();
342 342
343 part.SendPropertiesToClient(remoteClient); 343 part.SendPropertiesToClient(remoteClient);
344 344
@@ -1216,7 +1216,7 @@ namespace OpenSim.Region.Framework.Scenes
1216 } 1216 }
1217 1217
1218 group.RemoveInventoryItem(localID, itemID); 1218 group.RemoveInventoryItem(localID, itemID);
1219 group.AggregatePerms(); 1219 group.InvalidateEffectivePerms();
1220 } 1220 }
1221 1221
1222 part.SendPropertiesToClient(remoteClient); 1222 part.SendPropertiesToClient(remoteClient);
@@ -1388,11 +1388,7 @@ namespace OpenSim.Region.Framework.Scenes
1388 } 1388 }
1389 1389
1390 if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId)) 1390 if (!Permissions.CanCopyObjectInventory(itemId, part.UUID, remoteClient.AgentId))
1391 { 1391 return;
1392 // check also if we can delete the no copy item
1393 if(!Permissions.CanEditObject(part.UUID, remoteClient.AgentId))
1394 return;
1395 }
1396 1392
1397 string message; 1393 string message;
1398 InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message); 1394 InventoryItemBase item = MoveTaskInventoryItem(remoteClient, folderId, part, itemId, out message);
@@ -1742,8 +1738,25 @@ namespace OpenSim.Region.Framework.Scenes
1742 // Check if we're allowed to mess with permissions 1738 // Check if we're allowed to mess with permissions
1743 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god 1739 if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god
1744 { 1740 {
1741 bool noChange;
1745 if (remoteClient.AgentId != part.OwnerID) // Not owner 1742 if (remoteClient.AgentId != part.OwnerID) // Not owner
1746 { 1743 {
1744 noChange = true;
1745 if(itemInfo.OwnerID == UUID.Zero && itemInfo.GroupID != UUID.Zero)
1746 {
1747 if(remoteClient.IsGroupMember(itemInfo.GroupID))
1748 {
1749 ulong powers = remoteClient.GetGroupPowers(itemInfo.GroupID);
1750 if((powers & (ulong)GroupPowers.ObjectManipulate) != 0)
1751 noChange = false;
1752 }
1753 }
1754 }
1755 else
1756 noChange = false;
1757
1758 if(noChange)
1759 {
1747 // Friends and group members can't change any perms 1760 // Friends and group members can't change any perms
1748 itemInfo.BasePermissions = currentItem.BasePermissions; 1761 itemInfo.BasePermissions = currentItem.BasePermissions;
1749 itemInfo.EveryonePermissions = currentItem.EveryonePermissions; 1762 itemInfo.EveryonePermissions = currentItem.EveryonePermissions;
@@ -1769,7 +1782,6 @@ namespace OpenSim.Region.Framework.Scenes
1769 itemInfo.CurrentPermissions &= currentItem.BasePermissions; 1782 itemInfo.CurrentPermissions &= currentItem.BasePermissions;
1770 itemInfo.NextPermissions &= currentItem.BasePermissions; 1783 itemInfo.NextPermissions &= currentItem.BasePermissions;
1771 } 1784 }
1772
1773 } 1785 }
1774 else 1786 else
1775 { 1787 {
@@ -1955,7 +1967,7 @@ namespace OpenSim.Region.Framework.Scenes
1955 part.Inventory.AddInventoryItem(taskItem, false); 1967 part.Inventory.AddInventoryItem(taskItem, false);
1956 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); 1968 part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
1957 1969
1958 part.ParentGroup.AggregatePerms(); 1970 part.ParentGroup.InvalidateEffectivePerms();
1959 1971
1960 // tell anyone managing scripts that a new script exists 1972 // tell anyone managing scripts that a new script exists
1961 EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); 1973 EventManager.TriggerNewScript(agentID, part, taskItem.ItemID);
@@ -2643,7 +2655,7 @@ namespace OpenSim.Region.Framework.Scenes
2643 2655
2644 // We can only call this after adding the scene object, since the scene object references the scene 2656 // We can only call this after adding the scene object, since the scene object references the scene
2645 // to find out if scripts should be activated at all. 2657 // to find out if scripts should be activated at all.
2646 group.AggregatePerms(); 2658 group.InvalidateEffectivePerms();
2647 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); 2659 group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
2648 2660
2649 group.ScheduleGroupForFullUpdate(); 2661 group.ScheduleGroupForFullUpdate();
@@ -2740,7 +2752,7 @@ namespace OpenSim.Region.Framework.Scenes
2740 // and with this comented code, if user does not set next permissions on the object 2752 // and with this comented code, if user does not set next permissions on the object
2741 // and on ALL contents of ALL prims, he may loose rights, making the object useless 2753 // and on ALL contents of ALL prims, he may loose rights, making the object useless
2742 sog.ApplyNextOwnerPermissions(); 2754 sog.ApplyNextOwnerPermissions();
2743 sog.AggregatePerms(); 2755 sog.InvalidateEffectivePerms();
2744 2756
2745 sog.ScheduleGroupForFullUpdate(); 2757 sog.ScheduleGroupForFullUpdate();
2746 2758
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index c55a7a6..a75671e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Region.Framework.Scenes
53 public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp); 53 public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
54 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID); 54 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
55 public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); 55 public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
56 public delegate bool EditObjectPermsHandler(SceneObjectGroup sog, UUID editorID);
56 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID); 57 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
57 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); 58 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
58 public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint); 59 public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
@@ -133,6 +134,7 @@ namespace OpenSim.Region.Framework.Scenes
133 public event DuplicateObjectHandler OnDuplicateObject; 134 public event DuplicateObjectHandler OnDuplicateObject;
134 public event EditObjectByIDsHandler OnEditObjectByIDs; 135 public event EditObjectByIDsHandler OnEditObjectByIDs;
135 public event EditObjectHandler OnEditObject; 136 public event EditObjectHandler OnEditObject;
137 public event EditObjectPermsHandler OnEditObjectPerms;
136 public event EditObjectInventoryHandler OnEditObjectInventory; 138 public event EditObjectInventoryHandler OnEditObjectInventory;
137 public event MoveObjectHandler OnMoveObject; 139 public event MoveObjectHandler OnMoveObject;
138 public event ObjectEntryHandler OnObjectEntry; 140 public event ObjectEntryHandler OnObjectEntry;
@@ -511,6 +513,24 @@ namespace OpenSim.Region.Framework.Scenes
511 return true; 513 return true;
512 } 514 }
513 515
516 public bool CanEditObjectPermissions(SceneObjectGroup sog, UUID editorID)
517 {
518 EditObjectPermsHandler handler = OnEditObjectPerms;
519 if (handler != null)
520 {
521 if(sog == null)
522 return false;
523 Delegate[] list = handler.GetInvocationList();
524 foreach (EditObjectPermsHandler h in list)
525 {
526 if (h(sog, editorID) == false)
527 return false;
528 }
529 }
530 return true;
531 }
532
533
514 public bool CanEditObjectInventory(UUID objectID, UUID editorID) 534 public bool CanEditObjectInventory(UUID objectID, UUID editorID)
515 { 535 {
516 EditObjectInventoryHandler handler = OnEditObjectInventory; 536 EditObjectInventoryHandler handler = OnEditObjectInventory;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 715ae5c..e709d6c 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -978,6 +978,7 @@ namespace OpenSim.Region.Framework.Scenes
978 m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance); 978 m_maxDrawDistance = startupConfig.GetFloat("MaxDrawDistance", m_maxDrawDistance);
979 m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance); 979 m_maxRegionViewDistance = startupConfig.GetFloat("MaxRegionsViewDistance", m_maxRegionViewDistance);
980 980
981 // old versions compatibility
981 LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets); 982 LegacySitOffsets = startupConfig.GetBoolean("LegacySitOffsets", LegacySitOffsets);
982 983
983 if (m_defaultDrawDistance > m_maxDrawDistance) 984 if (m_defaultDrawDistance > m_maxDrawDistance)
@@ -2390,8 +2391,9 @@ namespace OpenSim.Region.Framework.Scenes
2390 EventManager.TriggerOnSceneObjectLoaded(group); 2391 EventManager.TriggerOnSceneObjectLoaded(group);
2391 SceneObjectPart rootPart = group.GetPart(group.UUID); 2392 SceneObjectPart rootPart = group.GetPart(group.UUID);
2392 rootPart.Flags &= ~PrimFlags.Scripted; 2393 rootPart.Flags &= ~PrimFlags.Scripted;
2393 group.AggregateDeepPerms(); 2394
2394 rootPart.TrimPermissions(); 2395 rootPart.TrimPermissions();
2396 group.InvalidateDeepEffectivePerms();
2395 2397
2396 // Don't do this here - it will get done later on when sculpt data is loaded. 2398 // Don't do this here - it will get done later on when sculpt data is loaded.
2397 // group.CheckSculptAndLoad(); 2399 // group.CheckSculptAndLoad();
@@ -2662,7 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes
2662 if (UserManagementModule != null) 2664 if (UserManagementModule != null)
2663 sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID); 2665 sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
2664 2666
2665 sceneObject.AggregateDeepPerms(); 2667 sceneObject.InvalidateDeepEffectivePerms();;
2666 sceneObject.ScheduleGroupForFullUpdate(); 2668 sceneObject.ScheduleGroupForFullUpdate();
2667 2669
2668 return sceneObject; 2670 return sceneObject;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a005068..117d92d 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes
343 sceneObject.ForceInventoryPersistence(); 343 sceneObject.ForceInventoryPersistence();
344 sceneObject.HasGroupChanged = true; 344 sceneObject.HasGroupChanged = true;
345 } 345 }
346 sceneObject.AggregateDeepPerms(); 346 sceneObject.InvalidateDeepEffectivePerms();
347 return ret; 347 return ret;
348 } 348 }
349 349
@@ -2094,7 +2094,7 @@ namespace OpenSim.Region.Framework.Scenes
2094 child.TriggerScriptChangedEvent(Changed.OWNER); 2094 child.TriggerScriptChangedEvent(Changed.OWNER);
2095 child.ApplyNextOwnerPermissions(); 2095 child.ApplyNextOwnerPermissions();
2096 } 2096 }
2097 copy.AggregatePerms(); 2097 copy.InvalidateEffectivePerms();
2098 } 2098 }
2099 } 2099 }
2100 2100
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 36844a9..f778367 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -183,7 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
183 addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0; 183 addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0;
184 184
185 part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); 185 part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop);
186 part.ParentGroup.AggregatePerms(); 186 part.ParentGroup.InvalidateEffectivePerms();
187 return true; 187 return true;
188 188
189 } 189 }
@@ -254,13 +254,26 @@ namespace OpenSim.Region.Framework.Scenes
254 // new test code, to place in better place later 254 // new test code, to place in better place later
255 private object m_PermissionsLock = new object(); 255 private object m_PermissionsLock = new object();
256 private bool m_EffectivePermsInvalid = true; 256 private bool m_EffectivePermsInvalid = true;
257 private bool m_DeepEffectivePermsInvalid = true;
257 258
259 // should called when parts chanced by their contents did not, so we know their cacche is valid
260 // in case of doubt call InvalidateDeepEffectivePerms(), it only costs a bit more cpu time
258 public void InvalidateEffectivePerms() 261 public void InvalidateEffectivePerms()
259 { 262 {
260 lock(m_PermissionsLock) 263 lock(m_PermissionsLock)
261 m_EffectivePermsInvalid = true; 264 m_EffectivePermsInvalid = true;
262 } 265 }
263 266
267 // should called when parts chanced and their contents where accounted for
268 public void InvalidateDeepEffectivePerms()
269 {
270 lock(m_PermissionsLock)
271 {
272 m_DeepEffectivePermsInvalid = true;
273 m_EffectivePermsInvalid = true;
274 }
275 }
276
264 private uint m_EffectiveEveryOnePerms; 277 private uint m_EffectiveEveryOnePerms;
265 public uint EffectiveEveryOnePerms 278 public uint EffectiveEveryOnePerms
266 { 279 {
@@ -317,79 +330,6 @@ namespace OpenSim.Region.Framework.Scenes
317 } 330 }
318 } 331 }
319 332
320 // aggregates perms scanning parts and their contents
321 // AggregatePerms does same using cached parts content perms
322 public void AggregateDeepPerms()
323 {
324 lock(m_PermissionsLock)
325 {
326 // aux
327 const uint allmask = (uint)PermissionMask.AllEffective;
328 const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
329 const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
330
331 uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
332 bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
333
334 uint rootOwnerPerms = RootPart.OwnerMask;
335 uint owner = rootOwnerPerms;
336 uint rootGroupPerms = RootPart.GroupMask;
337 uint group = rootGroupPerms;
338 uint rootEveryonePerms = RootPart.EveryoneMask;
339 uint everyone = rootEveryonePerms;
340
341 // date is time of writing april 30th 2017
342 bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
343 SceneObjectPart[] parts = m_parts.GetArray();
344 for (int i = 0; i < parts.Length; i++)
345 {
346 SceneObjectPart part = parts[i];
347 part.AggregateInnerPerms();
348 owner &= part.AggregatedInnerOwnerPerms;
349 group &= part.AggregatedInnerGroupPerms;
350 if(newObject)
351 everyone &= part.AggregatedInnerEveryonePerms;
352 }
353 // recover modify and move
354 rootOwnerPerms &= movemodmask;
355 owner |= rootOwnerPerms;
356 if((owner & copytransfermask) == 0)
357 owner |= (uint)PermissionMask.Transfer;
358
359 owner &= basePerms;
360 m_EffectiveOwnerPerms = owner;
361 uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
362
363 // recover modify and move
364 rootGroupPerms &= movemodmask;
365 group |= rootGroupPerms;
366 if(noBaseTransfer)
367 group &=~(uint)PermissionMask.Copy;
368 else
369 group |= ownertransfermask;
370
371 uint groupOrEveryone = group;
372 m_EffectiveGroupPerms = group & owner;
373
374 // recover move
375 rootEveryonePerms &= (uint)PermissionMask.Move;
376 everyone |= rootEveryonePerms;
377 everyone &= ~(uint)PermissionMask.Modify;
378 if(noBaseTransfer)
379 everyone &=~(uint)PermissionMask.Copy;
380 else
381 everyone |= ownertransfermask;
382
383 groupOrEveryone |= everyone;
384
385 m_EffectiveEveryOnePerms = everyone & owner;
386 m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
387 m_EffectivePermsInvalid = false;
388 }
389 }
390
391 // aggregates perms scanning parts, assuming their contents was already aggregated and cached
392 // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
393 public void AggregatePerms() 333 public void AggregatePerms()
394 { 334 {
395 lock(m_PermissionsLock) 335 lock(m_PermissionsLock)
@@ -411,14 +351,20 @@ namespace OpenSim.Region.Framework.Scenes
411 351
412 bool needUpdate = false; 352 bool needUpdate = false;
413 // date is time of writing april 30th 2017 353 // date is time of writing april 30th 2017
414 bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994); 354 bool newobj = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
415 SceneObjectPart[] parts = m_parts.GetArray(); 355 SceneObjectPart[] parts = m_parts.GetArray();
416 for (int i = 0; i < parts.Length; i++) 356 for (int i = 0; i < parts.Length; i++)
417 { 357 {
418 SceneObjectPart part = parts[i]; 358 SceneObjectPart part = parts[i];
359
360 if(m_DeepEffectivePermsInvalid)
361 part.AggregateInnerPerms();
362
419 owner &= part.AggregatedInnerOwnerPerms; 363 owner &= part.AggregatedInnerOwnerPerms;
420 group &= part.AggregatedInnerGroupPerms; 364 group &= part.AggregatedInnerGroupPerms;
421 if(newObject) 365 if(newobj)
366 group &= part.AggregatedInnerGroupPerms;
367 if(newobj)
422 everyone &= part.AggregatedInnerEveryonePerms; 368 everyone &= part.AggregatedInnerEveryonePerms;
423 } 369 }
424 // recover modify and move 370 // recover modify and move
@@ -477,6 +423,7 @@ namespace OpenSim.Region.Framework.Scenes
477 m_EffectiveGroupOrEveryOnePerms = tmpPerms; 423 m_EffectiveGroupOrEveryOnePerms = tmpPerms;
478 } 424 }
479 425
426 m_DeepEffectivePermsInvalid = false;
480 m_EffectivePermsInvalid = false; 427 m_EffectivePermsInvalid = false;
481 428
482 if(needUpdate) 429 if(needUpdate)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index e73795e..93c9b42 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2677,7 +2677,7 @@ namespace OpenSim.Region.Framework.Scenes
2677 if (dupe.m_rootPart.PhysActor != null) 2677 if (dupe.m_rootPart.PhysActor != null)
2678 dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building 2678 dupe.m_rootPart.PhysActor.Building = false; // tell physics to finish building
2679 2679
2680 dupe.AggregateDeepPerms(); 2680 dupe.InvalidateDeepEffectivePerms();
2681 2681
2682 dupe.HasGroupChanged = true; 2682 dupe.HasGroupChanged = true;
2683 dupe.AttachToBackup(); 2683 dupe.AttachToBackup();
@@ -2943,7 +2943,7 @@ namespace OpenSim.Region.Framework.Scenes
2943 if (!m_scene.Permissions.BypassPermissions()) 2943 if (!m_scene.Permissions.BypassPermissions())
2944 { 2944 {
2945 ApplyNextOwnerPermissions(); 2945 ApplyNextOwnerPermissions();
2946 AggregatePerms(); 2946 InvalidateEffectivePerms();
2947 } 2947 }
2948 } 2948 }
2949 2949
@@ -3605,7 +3605,7 @@ namespace OpenSim.Region.Framework.Scenes
3605 3605
3606 InvalidBoundsRadius(); 3606 InvalidBoundsRadius();
3607 InvalidatePartsLinkMaps(); 3607 InvalidatePartsLinkMaps();
3608 objectGroup.AggregatePerms(); 3608 objectGroup.InvalidateEffectivePerms();
3609 3609
3610 if (sendEvents) 3610 if (sendEvents)
3611 linkPart.TriggerScriptChangedEvent(Changed.LINK); 3611 linkPart.TriggerScriptChangedEvent(Changed.LINK);
@@ -4163,7 +4163,7 @@ namespace OpenSim.Region.Framework.Scenes
4163// m_log.DebugFormat( 4163// m_log.DebugFormat(
4164// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}", 4164// "[SCENE OBJECT GROUP]: RootPart.OwnerMask now {0} for {1} in {2}",
4165// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name); 4165// (OpenMetaverse.PermissionMask)RootPart.OwnerMask, Name, Scene.Name);
4166 AggregatePerms(); 4166 InvalidateEffectivePerms();
4167 RootPart.ScheduleFullUpdate(); 4167 RootPart.ScheduleFullUpdate();
4168 } 4168 }
4169 4169
@@ -4188,7 +4188,7 @@ namespace OpenSim.Region.Framework.Scenes
4188 { 4188 {
4189 foreach (SceneObjectPart part in Parts) 4189 foreach (SceneObjectPart part in Parts)
4190 part.Inventory.ApplyGodPermissions(RootPart.BaseMask); 4190 part.Inventory.ApplyGodPermissions(RootPart.BaseMask);
4191 AggregatePerms(); 4191 InvalidateEffectivePerms();
4192 } 4192 }
4193 4193
4194 HasGroupChanged = true; 4194 HasGroupChanged = true;
@@ -5447,7 +5447,7 @@ namespace OpenSim.Region.Framework.Scenes
5447 { 5447 {
5448 part.ResetOwnerChangeFlag(); 5448 part.ResetOwnerChangeFlag();
5449 }); 5449 });
5450 AggregatePerms(); 5450 InvalidateEffectivePerms();
5451 } 5451 }
5452 5452
5453 // clear some references to easy cg 5453 // clear some references to easy cg
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f948336..d980fe5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4460,8 +4460,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
4460 if (god) 4460 if (god)
4461 baseMask = 0x7ffffff0; 4461 baseMask = 0x7ffffff0;
4462 4462
4463 // Are we the owner? 4463 bool canChange = (AgentID == OwnerID) || god;
4464 if ((AgentID == OwnerID) || god) 4464 if(!canChange)
4465 canChange = ParentGroup.Scene.Permissions.CanEditObjectPermissions(ParentGroup, AgentID);
4466
4467 if (canChange)
4465 { 4468 {
4466 switch (field) 4469 switch (field)
4467 { 4470 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 3ed37a2..60efc04 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -236,11 +236,8 @@ namespace OpenSim.Region.Framework.Scenes
236 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 236 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
237 foreach (TaskInventoryItem item in items) 237 foreach (TaskInventoryItem item in items)
238 { 238 {
239 if (groupID != item.GroupID)
240 {
241 item.GroupID = groupID; 239 item.GroupID = groupID;
242 } 240 }
243 }
244 m_items.LockItemsForWrite(false); 241 m_items.LockItemsForWrite(false);
245 } 242 }
246 243
@@ -982,7 +979,7 @@ namespace OpenSim.Region.Framework.Scenes
982 } 979 }
983// old code end 980// old code end
984 rootPart.TrimPermissions(); 981 rootPart.TrimPermissions();
985 group.AggregateDeepPerms(); 982 group.InvalidateDeepEffectivePerms();
986 } 983 }
987 984
988 return true; 985 return true;
@@ -1020,6 +1017,9 @@ namespace OpenSim.Region.Framework.Scenes
1020 if (item.GroupPermissions != (uint)PermissionMask.None) 1017 if (item.GroupPermissions != (uint)PermissionMask.None)
1021 item.GroupID = m_part.GroupID; 1018 item.GroupID = m_part.GroupID;
1022 1019
1020 if(item.OwnerID == UUID.Zero) // viewer to internal enconding of group owned
1021 item.OwnerID = item.GroupID;
1022
1023 if (item.AssetID == UUID.Zero) 1023 if (item.AssetID == UUID.Zero)
1024 item.AssetID = m_items[item.ItemID].AssetID; 1024 item.AssetID = m_items[item.ItemID].AssetID;
1025 1025
@@ -1031,8 +1031,7 @@ namespace OpenSim.Region.Framework.Scenes
1031 1031
1032 if (considerChanged) 1032 if (considerChanged)
1033 { 1033 {
1034 m_part.AggregateInnerPerms(); 1034 m_part.ParentGroup.InvalidateDeepEffectivePerms();
1035 m_part.ParentGroup.AggregatePerms();
1036 HasInventoryChanged = true; 1035 HasInventoryChanged = true;
1037 m_part.ParentGroup.HasGroupChanged = true; 1036 m_part.ParentGroup.HasGroupChanged = true;
1038 } 1037 }
@@ -1075,8 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes
1075 m_items.Remove(itemID); 1074 m_items.Remove(itemID);
1076 m_items.LockItemsForWrite(false); 1075 m_items.LockItemsForWrite(false);
1077 1076
1078 m_part.AggregateInnerPerms(); 1077 m_part.ParentGroup.InvalidateDeepEffectivePerms();
1079 m_part.ParentGroup.AggregatePerms();
1080 1078
1081 m_inventorySerial++; 1079 m_inventorySerial++;
1082 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 1080 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
@@ -1199,15 +1197,20 @@ namespace OpenSim.Region.Framework.Scenes
1199 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); 1197 invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions));
1200 1198
1201 invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); 1199 invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
1202 invString.AddNameValueLine("owner_id", ownerID.ToString());
1203 1200
1204 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); 1201 invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString());
1205 1202
1206 invString.AddNameValueLine("group_id",groupID.ToString()); 1203 invString.AddNameValueLine("group_id",groupID.ToString());
1207 if(groupID != UUID.Zero && ownerID == groupID) 1204 if(groupID != UUID.Zero && ownerID == groupID)
1205 {
1206 invString.AddNameValueLine("owner_id", UUID.Zero.ToString());
1208 invString.AddNameValueLine("group_owned","1"); 1207 invString.AddNameValueLine("group_owned","1");
1208 }
1209 else 1209 else
1210 {
1211 invString.AddNameValueLine("owner_id", ownerID.ToString());
1210 invString.AddNameValueLine("group_owned","0"); 1212 invString.AddNameValueLine("group_owned","0");
1213 }
1211 1214
1212 invString.AddSectionEnd(); 1215 invString.AddSectionEnd();
1213 1216
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 87d1ace..892403b 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
114 // Script state may, or may not, exist. Not having any, is NOT 114 // Script state may, or may not, exist. Not having any, is NOT
115 // ever a problem. 115 // ever a problem.
116 sceneObject.LoadScriptState(reader); 116 sceneObject.LoadScriptState(reader);
117 sceneObject.AggregateDeepPerms(); 117 sceneObject.InvalidateDeepEffectivePerms();
118 return sceneObject; 118 return sceneObject;
119 } 119 }
120 120
@@ -278,7 +278,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
278 // Script state may, or may not, exist. Not having any, is NOT 278 // Script state may, or may not, exist. Not having any, is NOT
279 // ever a problem. 279 // ever a problem.
280 sceneObject.LoadScriptState(doc); 280 sceneObject.LoadScriptState(doc);
281 sceneObject.AggregatePerms(); 281// sceneObject.AggregatePerms();
282 return sceneObject; 282 return sceneObject;
283 } 283 }
284 catch (Exception e) 284 catch (Exception e)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index 0f022dd..34fdb6d 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
70 //obj.RegenerateFullIDs(); 70 //obj.RegenerateFullIDs();
71 71
72 scene.AddNewSceneObject(obj, true); 72 scene.AddNewSceneObject(obj, true);
73 obj.AggregateDeepPerms(); 73 obj.InvalidateDeepEffectivePerms();
74 } 74 }
75 } 75 }
76 else 76 else