diff options
author | Teravus Ovares | 2007-11-30 04:54:15 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-30 04:54:15 +0000 |
commit | 31cec30aa0a589f622635c689b08c2e026898556 (patch) | |
tree | 1f6763396fdd0eed5dff737a878b57f262cc06bc /OpenSim/Region/Environment/Scenes | |
parent | * This extends my first hack to clear out the useragent table for that specif... (diff) | |
download | opensim-SC_OLD-31cec30aa0a589f622635c689b08c2e026898556.zip opensim-SC_OLD-31cec30aa0a589f622635c689b08c2e026898556.tar.gz opensim-SC_OLD-31cec30aa0a589f622635c689b08c2e026898556.tar.bz2 opensim-SC_OLD-31cec30aa0a589f622635c689b08c2e026898556.tar.xz |
* Extended our semi-stupid implementation of in world object permissions to show a user's client that it can't edit a prim if it doesn't have permission.
* Permissions is due for a big revamp. The current way it's done is a hack at best.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 83 |
2 files changed, 93 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2d74913..cc0f3e1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
733 | /// <summary> | 733 | /// <summary> |
734 | /// Loads the World's objects | 734 | /// Loads the World's objects |
735 | /// </summary> | 735 | /// </summary> |
736 | public virtual void LoadPrimsFromStorage() | 736 | public virtual void LoadPrimsFromStorage(bool m_permissions) |
737 | { | 737 | { |
738 | MainLog.Instance.Verbose("Loading objects from datastore"); | 738 | MainLog.Instance.Verbose("Loading objects from datastore"); |
739 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); | 739 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(m_regInfo.RegionID); |
@@ -741,6 +741,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
741 | { | 741 | { |
742 | AddEntityFromStorage(prim); | 742 | AddEntityFromStorage(prim); |
743 | SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); | 743 | SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); |
744 | if (m_permissions) | ||
745 | { | ||
746 | rootPart.EveryoneMask = rootPart.ObjectFlags; | ||
747 | rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; | ||
748 | rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | ||
749 | rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; | ||
750 | rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; | ||
751 | rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; | ||
752 | rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; | ||
753 | } | ||
754 | else | ||
755 | { | ||
756 | rootPart.EveryoneMask = rootPart.ObjectFlags; | ||
757 | } | ||
744 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); | 758 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); |
745 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) | 759 | if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) |
746 | rootPart.PhysActor = PhysicsScene.AddPrimShape( | 760 | rootPart.PhysActor = PhysicsScene.AddPrimShape( |
@@ -839,7 +853,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
839 | // if grass or tree, make phantom | 853 | // if grass or tree, make phantom |
840 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) | 854 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) |
841 | { | 855 | { |
842 | rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; | 856 | rootPart.AddFlag(LLObject.ObjectFlags.Phantom); |
857 | //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; | ||
843 | } | 858 | } |
844 | // if not phantom, add to physics | 859 | // if not phantom, add to physics |
845 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); | 860 | bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index c94bfd9..d8e2143 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -466,6 +466,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
466 | LLObject.ObjectFlags.CreateSelected | | 466 | LLObject.ObjectFlags.CreateSelected | |
467 | LLObject.ObjectFlags.ObjectOwnerModify; | 467 | LLObject.ObjectFlags.ObjectOwnerModify; |
468 | 468 | ||
469 | if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | ||
470 | { | ||
471 | EveryoneMask = (uint)m_flags; | ||
472 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; | ||
473 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | ||
474 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; | ||
475 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; | ||
476 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; | ||
477 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; | ||
478 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; | ||
479 | } | ||
480 | |||
469 | ScheduleFullUpdate(); | 481 | ScheduleFullUpdate(); |
470 | } | 482 | } |
471 | 483 | ||
@@ -503,6 +515,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
503 | OffsetPosition = position; | 515 | OffsetPosition = position; |
504 | RotationOffset = rotation; | 516 | RotationOffset = rotation; |
505 | ObjectFlags = flags; | 517 | ObjectFlags = flags; |
518 | |||
519 | if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | ||
520 | { | ||
521 | EveryoneMask = (uint)m_flags; | ||
522 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; | ||
523 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | ||
524 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; | ||
525 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; | ||
526 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; | ||
527 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; | ||
528 | EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; | ||
529 | } | ||
530 | else | ||
531 | { | ||
532 | EveryoneMask = ObjectFlags; | ||
533 | } | ||
534 | |||
506 | bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | 535 | bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); |
507 | doPhysicsPropertyUpdate(UsePhysics, true); | 536 | doPhysicsPropertyUpdate(UsePhysics, true); |
508 | ScheduleFullUpdate(); | 537 | ScheduleFullUpdate(); |
@@ -519,6 +548,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
519 | { | 548 | { |
520 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); | 549 | XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); |
521 | SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); | 550 | SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); |
551 | |||
552 | if (!newobject.ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | ||
553 | { | ||
554 | newobject.EveryoneMask = newobject.ObjectFlags; | ||
555 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; | ||
556 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | ||
557 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; | ||
558 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; | ||
559 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; | ||
560 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; | ||
561 | newobject.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; | ||
562 | } | ||
563 | else | ||
564 | { | ||
565 | newobject.EveryoneMask = newobject.ObjectFlags; | ||
566 | } | ||
567 | |||
522 | bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); | 568 | bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); |
523 | newobject.doPhysicsPropertyUpdate(UsePhysics, true); | 569 | newobject.doPhysicsPropertyUpdate(UsePhysics, true); |
524 | 570 | ||
@@ -711,6 +757,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
711 | { | 757 | { |
712 | //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); | 758 | //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); |
713 | m_flags |= flag; | 759 | m_flags |= flag; |
760 | BaseMask |= (uint)flag; | ||
761 | GroupMask |= (uint)flag; | ||
762 | EveryoneMask |= (uint)flag; | ||
714 | } | 763 | } |
715 | uint currflag = (uint) m_flags; | 764 | uint currflag = (uint) m_flags; |
716 | //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); | 765 | //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); |
@@ -724,6 +773,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
724 | { | 773 | { |
725 | //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); | 774 | //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); |
726 | m_flags &= ~flag; | 775 | m_flags &= ~flag; |
776 | BaseMask &= ~(uint)flag; | ||
777 | GroupMask &= ~(uint)flag; | ||
778 | EveryoneMask &= ~(uint)flag; | ||
727 | } | 779 | } |
728 | //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); | 780 | //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); |
729 | //ScheduleFullUpdate(); | 781 | //ScheduleFullUpdate(); |
@@ -1201,19 +1253,36 @@ namespace OpenSim.Region.Environment.Scenes | |||
1201 | } | 1253 | } |
1202 | break; | 1254 | break; |
1203 | } | 1255 | } |
1256 | } | ||
1257 | // If you can't edit it, send the base permissions minus the flag to edit | ||
1258 | if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) | ||
1259 | { | ||
1260 | if (ParentGroup.m_scene.PermissionsMngr.CanEditObject(remoteClient.AgentId, this.ParentGroup.UUID)) | ||
1261 | { | ||
1262 | //clientFlags = ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; | ||
1263 | //clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; | ||
1264 | //clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; | ||
1265 | //clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | ||
1266 | // Send EveryoneMask | ||
1267 | clientFlags = ObjectFlags; | ||
1268 | |||
1269 | } | ||
1204 | else | 1270 | else |
1205 | { | 1271 | { |
1206 | // If you can't edit it, send the base permissions minus the flag to edit | 1272 | clientFlags = ObjectFlags; |
1207 | if (!ParentGroup.m_scene.PermissionsMngr.CanEditObject(remoteClient.AgentId, this.ParentGroup.UUID)) | 1273 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) |
1208 | { | 1274 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; |
1209 | clientFlags = ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; | 1275 | if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) |
1210 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; | 1276 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; |
1211 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; | 1277 | |
1212 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | 1278 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; |
1213 | } | 1279 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; |
1280 | clientFlags = clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; | ||
1281 | clientFlags = EveryoneMask; | ||
1214 | } | 1282 | } |
1215 | } | 1283 | } |
1216 | 1284 | ||
1285 | |||
1217 | byte[] color = new byte[] { m_color.R, m_color.G, m_color.B, m_color.A }; | 1286 | byte[] color = new byte[] { m_color.R, m_color.G, m_color.B, m_color.A }; |
1218 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, | 1287 | remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, |
1219 | OwnerID, | 1288 | OwnerID, |