aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2008-04-23 13:22:06 +0000
committerAdam Frisby2008-04-23 13:22:06 +0000
commite456cb7533dff72aa22a87f261a758e294e707b1 (patch)
tree8cc321c8b4438acd298bb756768ba124feb09661
parent* Patch #1026 - llDialog support -- Thanks Melanie! (diff)
downloadopensim-SC-e456cb7533dff72aa22a87f261a758e294e707b1.zip
opensim-SC-e456cb7533dff72aa22a87f261a758e294e707b1.tar.gz
opensim-SC-e456cb7533dff72aa22a87f261a758e294e707b1.tar.bz2
opensim-SC-e456cb7533dff72aa22a87f261a758e294e707b1.tar.xz
* Patch for #973 - Object Rez from Inventory ignores permissions - Thanks tglion!
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs38
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs62
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs25
4 files changed, 126 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 12ef110..0343d21 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -159,6 +159,44 @@ namespace OpenSim.Region.Environment
159 return permission; 159 return permission;
160 } 160 }
161 161
162 /// <summary>
163 /// Permissions check - can user enter an object?
164 /// </summary>
165 /// <param name="user">User attempting move an object</param>
166 /// <param name="oldPos">Source object-position</param>
167 /// <param name="newPos">Target object-position</param>
168 /// <returns>Has permission?</returns>
169 public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
170 {
171 ILandObject land1 = m_scene.LandChannel.getLandObject(oldPos.X, oldPos.Y);
172 ILandObject land2 = m_scene.LandChannel.getLandObject(newPos.X, newPos.Y);
173 if (land1 == null || land2 == null)
174 {
175 return false;
176 }
177
178 if (land1.landData.globalID == land2.landData.globalID)
179 {
180 return true;
181 }
182
183 if ((land2.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
184 {
185 return true;
186 }
187
188 //TODO: check for group rights
189
190 if (GenericParcelPermission(user, newPos))
191 {
192 return true;
193 }
194
195 SendPermissionError(user, "Not allowed to move objects in this parcel!");
196
197 return false;
198 }
199
162 #region Object Permissions 200 #region Object Permissions
163 201
164 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) 202 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 329f900..2b28b2a 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -981,6 +981,12 @@ namespace OpenSim.Region.Environment.Scenes
981 SceneObjectGroup group = GetGroupByPrim(localID); 981 SceneObjectGroup group = GetGroupByPrim(localID);
982 if (group != null) 982 if (group != null)
983 { 983 {
984 LLVector3 oldPos = group.AbsolutePosition;
985 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos))
986 {
987 group.SendGroupTerseUpdate();
988 return;
989 }
984 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 990 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
985 { 991 {
986 group.UpdateSinglePosition(pos, localID); 992 group.UpdateSinglePosition(pos, localID);
@@ -999,6 +1005,12 @@ namespace OpenSim.Region.Environment.Scenes
999 SceneObjectGroup group = GetGroupByPrim(localID); 1005 SceneObjectGroup group = GetGroupByPrim(localID);
1000 if (group != null) 1006 if (group != null)
1001 { 1007 {
1008 LLVector3 oldPos = group.AbsolutePosition;
1009 if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos))
1010 {
1011 group.SendGroupTerseUpdate();
1012 return;
1013 }
1002 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID)) 1014 if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
1003 { 1015 {
1004 group.UpdateGroupPosition(pos); 1016 group.UpdateGroupPosition(pos);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index e4a9551..9bf6728 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -855,9 +855,23 @@ namespace OpenSim.Region.Environment.Scenes
855 } 855 }
856 if (selectedEnt != null) 856 if (selectedEnt != null)
857 { 857 {
858 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) 858 bool permission;
859 if (DeRezPacket.AgentBlock.Destination == 1)
860 { // Take Copy
861 permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
862 ((SceneObjectGroup) selectedEnt).UUID);
863 }
864 else
865 { // Take
866 permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId,
867 ((SceneObjectGroup) selectedEnt).UUID);
868 }
869
870 if (permission)
859 { 871 {
860 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); 872 SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt;
873 string sceneObjectXml = objectGroup.ToXmlString();
874
861 CachedUserInfo userInfo = 875 CachedUserInfo userInfo =
862 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 876 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
863 if (userInfo != null) 877 if (userInfo != null)
@@ -871,8 +885,8 @@ namespace OpenSim.Region.Environment.Scenes
871 AssetCache.AddAsset(asset); 885 AssetCache.AddAsset(asset);
872 886
873 InventoryItemBase item = new InventoryItemBase(); 887 InventoryItemBase item = new InventoryItemBase();
888 item.Creator = objectGroup.RootPart.CreatorID;
874 item.Owner = remoteClient.AgentId; 889 item.Owner = remoteClient.AgentId;
875 item.Creator = remoteClient.AgentId;
876 item.ID = LLUUID.Random(); 890 item.ID = LLUUID.Random();
877 item.AssetID = asset.FullID; 891 item.AssetID = asset.FullID;
878 item.Description = asset.Description; 892 item.Description = asset.Description;
@@ -880,12 +894,18 @@ namespace OpenSim.Region.Environment.Scenes
880 item.AssetType = asset.Type; 894 item.AssetType = asset.Type;
881 item.InvType = asset.InvType; 895 item.InvType = asset.InvType;
882 item.Folder = DeRezPacket.AgentBlock.DestinationID; 896 item.Folder = DeRezPacket.AgentBlock.DestinationID;
883 item.CurrentPermissions = 2147483647; 897 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
884 item.NextPermissions = 2147483647; 898 if (remoteClient.AgentId != objectGroup.RootPart.OwnerID) {
885 item.EveryOnePermissions = 899 item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
886 ((SceneObjectGroup) selectedEnt).RootPart.EveryoneMask; 900 item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
887 item.BasePermissions = ((SceneObjectGroup) selectedEnt).RootPart.BaseMask; 901 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
888 item.CurrentPermissions = ((SceneObjectGroup) selectedEnt).RootPart.OwnerMask; 902 }
903 else
904 {
905 item.BasePermissions = objectGroup.RootPart.BaseMask;
906 item.CurrentPermissions = objectGroup.RootPart.OwnerMask;
907 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
908 }
889 909
890 userInfo.AddItem(remoteClient.AgentId, item); 910 userInfo.AddItem(remoteClient.AgentId, item);
891 remoteClient.SendInventoryItemCreateUpdate(item); 911 remoteClient.SendInventoryItemCreateUpdate(item);
@@ -894,7 +914,7 @@ namespace OpenSim.Region.Environment.Scenes
894 // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy 914 // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy
895 if (DeRezPacket.AgentBlock.Destination != 1) 915 if (DeRezPacket.AgentBlock.Destination != 1)
896 { 916 {
897 DeleteSceneObjectGroup((SceneObjectGroup) selectedEnt); 917 DeleteSceneObjectGroup(objectGroup);
898 } 918 }
899 } 919 }
900 } 920 }
@@ -941,6 +961,11 @@ namespace OpenSim.Region.Environment.Scenes
941 RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1), 961 RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
942 BypassRayCast, bRayEndIsIntersection); 962 BypassRayCast, bRayEndIsIntersection);
943 963
964 if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos))
965 {
966 return;
967 }
968
944 // Rez object 969 // Rez object
945 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 970 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
946 if (userInfo != null) 971 if (userInfo != null)
@@ -966,7 +991,22 @@ namespace OpenSim.Region.Environment.Scenes
966 // object itself before we rez. 991 // object itself before we rez.
967 rootPart.Name = item.Name; 992 rootPart.Name = item.Name;
968 rootPart.Description = item.Description; 993 rootPart.Description = item.Description;
969 994
995 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
996 foreach (SceneObjectPart part in partList)
997 {
998 if (part.OwnerID != item.Owner)
999 {
1000 part.LastOwnerID = part.OwnerID;
1001 part.OwnerID = item.Owner;
1002 part.EveryoneMask = item.EveryOnePermissions;
1003 part.BaseMask = item.BasePermissions;
1004 part.OwnerMask = item.CurrentPermissions;
1005 part.NextOwnerMask = item.NextPermissions;
1006 part.ChangeInventoryOwner(item.Owner);
1007 }
1008 }
1009
970 rootPart.TrimPermissions(); 1010 rootPart.TrimPermissions();
971 group.ApplyPhysics(m_physicalPrim); 1011 group.ApplyPhysics(m_physicalPrim);
972 group.StartScripts(); 1012 group.StartScripts();
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
index 9b99df7..6e815a6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs
@@ -115,6 +115,31 @@ namespace OpenSim.Region.Environment.Scenes
115 } 115 }
116 } 116 }
117 117
118 public void ChangeInventoryOwner(LLUUID ownerId)
119 {
120 lock (TaskInventory)
121 {
122 if (0 == TaskInventory.Count)
123 {
124 return;
125 }
126
127 HasInventoryChanged = true;
128
129 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values);
130 foreach (TaskInventoryItem item in items)
131 {
132 if (ownerId != item.OwnerID)
133 {
134 item.LastOwnerID = item.OwnerID;
135 item.OwnerID = ownerId;
136 item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
137 item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
138 }
139 }
140 }
141 }
142
118 /// <summary> 143 /// <summary>
119 /// Start all the scripts contained in this prim's inventory 144 /// Start all the scripts contained in this prim's inventory
120 /// </summary> 145 /// </summary>