diff options
author | MW | 2008-01-16 17:31:07 +0000 |
---|---|---|
committer | MW | 2008-01-16 17:31:07 +0000 |
commit | 795a339af5accc19f5ff82b2013e79312d15eea2 (patch) | |
tree | ed548e50cba8e89e5f80a710d7a176e37e86b6c0 | |
parent | * Slowed down the sim stats update to once every 5 seconds because the networ... (diff) | |
download | opensim-SC-795a339af5accc19f5ff82b2013e79312d15eea2.zip opensim-SC-795a339af5accc19f5ff82b2013e79312d15eea2.tar.gz opensim-SC-795a339af5accc19f5ff82b2013e79312d15eea2.tar.bz2 opensim-SC-795a339af5accc19f5ff82b2013e79312d15eea2.tar.xz |
First part of changing prim's permission flags to use the correct enum (libsl PermissionMask)
-rw-r--r-- | OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/PermissionManager.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 50 |
3 files changed, 53 insertions, 59 deletions
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index 98a3287..fc31283 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Modules | |||
41 | //this is a first attempt, to start breaking the mess thats called the assetcache up. | 41 | //this is a first attempt, to start breaking the mess thats called the assetcache up. |
42 | // basically this should be the texture sending (to clients) code moved out of assetcache | 42 | // basically this should be the texture sending (to clients) code moved out of assetcache |
43 | //and some small clean up | 43 | //and some small clean up |
44 | // but on first tests it didn't seem to work very well so is currently not in use. | ||
45 | public class TextureDownloadModule : IRegionModule | 44 | public class TextureDownloadModule : IRegionModule |
46 | { | 45 | { |
47 | private Scene m_scene; | 46 | private Scene m_scene; |
@@ -173,5 +172,6 @@ namespace OpenSim.Region.Environment.Modules | |||
173 | sender.Sending = false; | 172 | sender.Sending = false; |
174 | m_scene.AddPendingDownloads(-1); | 173 | m_scene.AddPendingDownloads(-1); |
175 | } | 174 | } |
175 | |||
176 | } | 176 | } |
177 | } \ No newline at end of file | 177 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index db1cac5..f72ae66 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -172,48 +172,72 @@ namespace OpenSim.Region.Environment | |||
172 | 172 | ||
173 | //return task.RootPart.ObjectFlags;task.RootPart.ObjectFlags | | 173 | //return task.RootPart.ObjectFlags;task.RootPart.ObjectFlags | |
174 | 174 | ||
175 | uint OwnerMask = task.RootPart.ObjectFlags | task.RootPart.OwnerMask; | 175 | uint objectOwnerMask = task.RootPart.ObjectFlags; |
176 | uint GroupMask = task.RootPart.ObjectFlags | task.RootPart.GroupMask; | 176 | |
177 | uint EveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask; | 177 | if((task.RootPart.OwnerMask & (uint)PermissionMask.Copy) != 0) |
178 | { | ||
179 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy; | ||
180 | } | ||
181 | |||
182 | if ((task.RootPart.OwnerMask & (uint) PermissionMask.Move) != 0) | ||
183 | { | ||
184 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove; | ||
185 | } | ||
186 | |||
187 | if ((task.RootPart.OwnerMask & (uint) PermissionMask.Modify) != 0) | ||
188 | { | ||
189 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify; | ||
190 | } | ||
191 | |||
192 | if ((task.RootPart.OwnerMask & (uint) PermissionMask.Transfer) != 0) | ||
193 | { | ||
194 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer; | ||
195 | } | ||
196 | |||
197 | uint objectGroupMask = task.RootPart.ObjectFlags | task.RootPart.GroupMask; | ||
198 | uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask; | ||
178 | 199 | ||
179 | if (m_bypassPermissions) | 200 | if (m_bypassPermissions) |
180 | return OwnerMask; | 201 | return objectOwnerMask; |
181 | 202 | ||
182 | // Object owners should be able to edit their own content | 203 | // Object owners should be able to edit their own content |
183 | if (user == objectOwner) | 204 | if (user == objectOwner) |
184 | return OwnerMask; | 205 | { |
206 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner; | ||
207 | return objectOwnerMask; | ||
208 | } | ||
185 | 209 | ||
186 | // Users should be able to edit what is over their land. | 210 | // Users should be able to edit what is over their land. |
187 | Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); | 211 | Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); |
188 | if (parcel != null && parcel.landData.ownerID == user) | 212 | if (parcel != null && parcel.landData.ownerID == user) |
189 | return OwnerMask; | 213 | return objectOwnerMask; |
190 | 214 | ||
191 | // Estate users should be able to edit anything in the sim | 215 | // Estate users should be able to edit anything in the sim |
192 | if (IsEstateManager(user)) | 216 | if (IsEstateManager(user)) |
193 | return OwnerMask; | 217 | return objectOwnerMask; |
194 | 218 | ||
195 | // Admin objects should not be editable by the above | 219 | // Admin objects should not be editable by the above |
196 | if (IsAdministrator(taskOwner)) | 220 | if (IsAdministrator(taskOwner)) |
197 | return EveryoneMask; | 221 | return objectEveryoneMask; |
198 | 222 | ||
199 | // Admin should be able to edit anything in the sim (including admin objects) | 223 | // Admin should be able to edit anything in the sim (including admin objects) |
200 | if (IsAdministrator(user)) | 224 | if (IsAdministrator(user)) |
201 | return OwnerMask; | 225 | return objectOwnerMask; |
202 | 226 | ||
203 | if (((EveryoneMask & PERM_MOVE) != 0) || ((EveryoneMask & PERM_COPY) != 0)) | 227 | if (((objectEveryoneMask & PERM_MOVE) != 0) || ((objectEveryoneMask & PERM_COPY) != 0)) |
204 | { | 228 | { |
205 | if ((EveryoneMask & PERM_MOVE) != 0) | 229 | if ((objectEveryoneMask & PERM_MOVE) != 0) |
206 | OwnerMask &= ~PERM_MOVE; | 230 | objectOwnerMask &= ~PERM_MOVE; |
207 | 231 | ||
208 | if ((EveryoneMask & PERM_COPY) != 0) | 232 | if ((objectEveryoneMask & PERM_COPY) != 0) |
209 | OwnerMask &= ~PERM_COPY; | 233 | objectOwnerMask &= ~PERM_COPY; |
210 | 234 | ||
211 | OwnerMask &= ~PERM_MODIFY; | 235 | objectOwnerMask &= ~PERM_MODIFY; |
212 | OwnerMask &= ~PERM_TRANS; | 236 | objectOwnerMask &= ~PERM_TRANS; |
213 | 237 | ||
214 | return OwnerMask; | 238 | return objectOwnerMask; |
215 | } | 239 | } |
216 | return EveryoneMask; | 240 | return objectEveryoneMask; |
217 | } | 241 | } |
218 | 242 | ||
219 | protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) | 243 | protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 660deaf..c1522bc 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -44,12 +44,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
44 | { | 44 | { |
45 | public partial class SceneObjectPart : IScriptHost | 45 | public partial class SceneObjectPart : IScriptHost |
46 | { | 46 | { |
47 | private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL = | 47 | private const PermissionMask OBJFULL_MASK_GENERAL = |
48 | LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer; | 48 | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Move; |
49 | 49 | ||
50 | private const LLObject.ObjectFlags OBJFULL_MASK_OWNER = | 50 | private const PermissionMask OBJFULL_MASK_OWNER = |
51 | LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectOwnerModify | | 51 | PermissionMask.Copy | PermissionMask.Modify | |
52 | LLObject.ObjectFlags.ObjectTransfer | LLObject.ObjectFlags.ObjectYouOwner; | 52 | PermissionMask.Transfer; |
53 | 53 | ||
54 | private const uint OBJNEXT_OWNER = 2147483647; | 54 | private const uint OBJNEXT_OWNER = 2147483647; |
55 | 55 | ||
@@ -76,10 +76,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
76 | // | 76 | // |
77 | // Main grid has default permissions as follows | 77 | // Main grid has default permissions as follows |
78 | // | 78 | // |
79 | public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER; | 79 | public uint OwnerMask =(uint) PermissionMask.All; |
80 | public uint NextOwnerMask = OBJNEXT_OWNER; | 80 | public uint NextOwnerMask = OBJNEXT_OWNER; |
81 | public uint GroupMask = (uint) LLObject.ObjectFlags.None; | 81 | public uint GroupMask = (uint) PermissionMask.None; |
82 | public uint EveryoneMask = (uint) LLObject.ObjectFlags.None; | 82 | public uint EveryoneMask = (uint)PermissionMask.None; |
83 | public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER; | 83 | public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER; |
84 | 84 | ||
85 | protected byte[] m_particleSystem = new byte[0]; | 85 | protected byte[] m_particleSystem = new byte[0]; |
@@ -697,21 +697,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
697 | public void ApplySanePermissions() | 697 | public void ApplySanePermissions() |
698 | { | 698 | { |
699 | // These are some flags that The OwnerMask should never have | 699 | // These are some flags that The OwnerMask should never have |
700 | OwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned; | 700 | |
701 | OwnerMask &= ~(uint) LLObject.ObjectFlags.Physics; | ||
702 | OwnerMask &= ~(uint) LLObject.ObjectFlags.Phantom; | ||
703 | OwnerMask &= ~(uint) LLObject.ObjectFlags.Scripted; | ||
704 | OwnerMask &= ~(uint) LLObject.ObjectFlags.Touch; | ||
705 | OwnerMask &= ~(uint) LLObject.ObjectFlags.Temporary; | ||
706 | OwnerMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez; | ||
707 | OwnerMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed; | ||
708 | OwnerMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop; | ||
709 | OwnerMask &= ~(uint) LLObject.ObjectFlags.AnimSource; | ||
710 | OwnerMask &= ~(uint) LLObject.ObjectFlags.Money; | ||
711 | OwnerMask &= ~(uint) LLObject.ObjectFlags.CastShadows; | ||
712 | OwnerMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty; | ||
713 | OwnerMask &= ~(uint) LLObject.ObjectFlags.CreateSelected; | ||
714 | |||
715 | 701 | ||
716 | // These are some flags that the next owner mask should never have | 702 | // These are some flags that the next owner mask should never have |
717 | NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner; | 703 | NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner; |
@@ -754,23 +740,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
754 | 740 | ||
755 | 741 | ||
756 | // These are some flags that EveryoneMask should never have | 742 | // These are some flags that EveryoneMask should never have |
757 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner; | 743 | //EveryoneMask = (uint)OBJFULL_MASK_EVERYONE; |
758 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer; | ||
759 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify; | ||
760 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned; | ||
761 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.Physics; | ||
762 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.Phantom; | ||
763 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.Scripted; | ||
764 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.Touch; | ||
765 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.Temporary; | ||
766 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez; | ||
767 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed; | ||
768 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop; | ||
769 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.AnimSource; | ||
770 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.Money; | ||
771 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.CastShadows; | ||
772 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty; | ||
773 | EveryoneMask &= ~(uint) LLObject.ObjectFlags.CreateSelected; | ||
774 | 744 | ||
775 | 745 | ||
776 | // These are some flags that ObjectFlags (m_flags) should never have | 746 | // These are some flags that ObjectFlags (m_flags) should never have |