diff options
author | Teravus Ovares | 2008-02-10 21:27:32 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-10 21:27:32 +0000 |
commit | 38f0615ffef1b60d98029ca433d158d97c0d0183 (patch) | |
tree | 56b476fcb1696dcb8de3e310e8e93b79f36a125a /OpenSim | |
parent | Removed some ScriptEngine config debugging. (diff) | |
download | opensim-SC-38f0615ffef1b60d98029ca433d158d97c0d0183.zip opensim-SC-38f0615ffef1b60d98029ca433d158d97c0d0183.tar.gz opensim-SC-38f0615ffef1b60d98029ca433d158d97c0d0183.tar.bz2 opensim-SC-38f0615ffef1b60d98029ca433d158d97c0d0183.tar.xz |
* This updates adds locking capability. Thanks, lbsa71 for pointing out my bitmasking error of the objectflags! It's still a little bit wonky when you check the checkbox, however it 'takes' and doesn't break anything.
Diffstat (limited to 'OpenSim')
4 files changed, 49 insertions, 66 deletions
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index bb0a756..47e29a3 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs | |||
@@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment | |||
42 | private uint PERM_MODIFY = (uint) 16384; | 42 | private uint PERM_MODIFY = (uint) 16384; |
43 | private uint PERM_MOVE = (uint) 524288; | 43 | private uint PERM_MOVE = (uint) 524288; |
44 | private uint PERM_TRANS = (uint) 8192; | 44 | private uint PERM_TRANS = (uint) 8192; |
45 | private uint PERM_LOCKED = (uint) 540672; | ||
45 | // Bypasses the permissions engine (always returns OK) | 46 | // Bypasses the permissions engine (always returns OK) |
46 | // disable in any production environment | 47 | // disable in any production environment |
47 | // TODO: Change this to false when permissions are a desired default | 48 | // TODO: Change this to false when permissions are a desired default |
@@ -201,28 +202,25 @@ namespace OpenSim.Region.Environment | |||
201 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate | 202 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate |
202 | // in the next bit of code | 203 | // in the next bit of code |
203 | 204 | ||
204 | objflags &= (uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object | 205 | objflags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object |
205 | objflags &= (uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object | 206 | objflags &= ~(uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object |
206 | objflags &= (uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod) | 207 | objflags &= ~(uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod) |
207 | objflags &= (uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it | 208 | objflags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it |
208 | objflags &= (uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object | 209 | objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object |
209 | objflags &= (uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set | 210 | objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set |
210 | 211 | ||
211 | 212 | ||
212 | // Creating the three ObjectFlags options for this method to choose from. | 213 | // Creating the three ObjectFlags options for this method to choose from. |
213 | bool tasklocked = task.GetLocked(); // more debug needed to apply this, so we're going to set this to false for now | 214 | // Customize the OwnerMask |
214 | tasklocked = false; | 215 | uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags); |
215 | |||
216 | uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags, tasklocked); | ||
217 | objectOwnerMask = AddBackBrokenObjectProperties(task.RootPart, objectOwnerMask); | ||
218 | |||
219 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner; | 216 | objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner; |
220 | 217 | ||
221 | uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags, tasklocked); | 218 | // Customize the GroupMask |
222 | objectGroupMask = AddBackBrokenObjectProperties(task.RootPart,objectGroupMask); | 219 | uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags); |
223 | 220 | ||
224 | uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags, tasklocked); | 221 | // Customize the EveryoneMask |
225 | objectEveryoneMask = AddBackBrokenObjectProperties(task.RootPart,objectEveryoneMask); | 222 | uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags); |
223 | |||
226 | 224 | ||
227 | // Hack to allow collaboration until Groups and Group Permissions are implemented | 225 | // Hack to allow collaboration until Groups and Group Permissions are implemented |
228 | if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0) | 226 | if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0) |
@@ -259,44 +257,14 @@ namespace OpenSim.Region.Environment | |||
259 | 257 | ||
260 | return objectEveryoneMask; | 258 | return objectEveryoneMask; |
261 | } | 259 | } |
262 | private uint AddBackBrokenObjectProperties(SceneObjectPart task, uint objectmask) | 260 | |
263 | { | ||
264 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0) | ||
265 | objectmask |= (uint)LLObject.ObjectFlags.Physics; | ||
266 | |||
267 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Scripted) != 0) | ||
268 | objectmask |= (uint)LLObject.ObjectFlags.Scripted; | ||
269 | |||
270 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.TemporaryOnRez) != 0) | ||
271 | objectmask |= (uint)LLObject.ObjectFlags.TemporaryOnRez; | ||
272 | 261 | ||
273 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0) | ||
274 | objectmask |= (uint)LLObject.ObjectFlags.Phantom; | ||
275 | |||
276 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0) | ||
277 | objectmask |= (uint)LLObject.ObjectFlags.Touch; | ||
278 | |||
279 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Scripted) != 0) | ||
280 | objectmask |= (uint)LLObject.ObjectFlags.Scripted; | ||
281 | |||
282 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.AllowInventoryDrop) != 0) | ||
283 | objectmask |= (uint)LLObject.ObjectFlags.AllowInventoryDrop; | ||
284 | |||
285 | |||
286 | if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.CastShadows) != 0) | ||
287 | objectmask |= (uint)LLObject.ObjectFlags.CastShadows; | ||
288 | |||
289 | return objectmask; | ||
290 | } | ||
291 | 262 | ||
292 | 263 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) | |
293 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool locked) | ||
294 | { | 264 | { |
295 | // We are adding the temporary objectflags to the object's objectflags based on the | 265 | // We are adding the temporary objectflags to the object's objectflags based on the |
296 | // permission flag given. These change the F flags on the client. | 266 | // permission flag given. These change the F flags on the client. |
297 | if (!locked) | 267 | |
298 | { | ||
299 | |||
300 | if ((setPermissionMask & (uint)PermissionMask.Copy) != 0) | 268 | if ((setPermissionMask & (uint)PermissionMask.Copy) != 0) |
301 | { | 269 | { |
302 | objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy; | 270 | objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy; |
@@ -316,14 +284,15 @@ namespace OpenSim.Region.Environment | |||
316 | { | 284 | { |
317 | objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer; | 285 | objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer; |
318 | } | 286 | } |
319 | } | 287 | |
320 | return objectFlagsMask; | 288 | return objectFlagsMask; |
321 | } | 289 | } |
322 | 290 | ||
323 | protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) | 291 | protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) |
324 | { | 292 | { |
325 | // Default: deny | 293 | // Default: deny |
326 | bool permission = false; | 294 | bool permission = false; |
295 | bool locked = false; | ||
327 | 296 | ||
328 | if (!m_scene.Entities.ContainsKey(objId)) | 297 | if (!m_scene.Entities.ContainsKey(objId)) |
329 | { | 298 | { |
@@ -340,6 +309,19 @@ namespace OpenSim.Region.Environment | |||
340 | SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; | 309 | SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; |
341 | 310 | ||
342 | LLUUID objectOwner = group.OwnerID; | 311 | LLUUID objectOwner = group.OwnerID; |
312 | locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0); | ||
313 | |||
314 | // People shouldn't be able to do anything with locked objects, except the Administrator | ||
315 | // The 'set permissions' runs through a different permission check, so when an object owner | ||
316 | // sets an object locked, the only thing that they can do is unlock it. | ||
317 | // | ||
318 | // Nobody but the object owner can set permissions on an object | ||
319 | // | ||
320 | |||
321 | if (locked && (!IsAdministrator(currentUser))) | ||
322 | { | ||
323 | return false; | ||
324 | } | ||
343 | 325 | ||
344 | // Object owners should be able to edit their own content | 326 | // Object owners should be able to edit their own content |
345 | if (currentUser == objectOwner) | 327 | if (currentUser == objectOwner) |
@@ -419,8 +401,15 @@ namespace OpenSim.Region.Environment | |||
419 | // Added this because at this point in time it wouldn't be wise for | 401 | // Added this because at this point in time it wouldn't be wise for |
420 | // the administrator object permissions to take effect. | 402 | // the administrator object permissions to take effect. |
421 | LLUUID objectOwner = task.OwnerID; | 403 | LLUUID objectOwner = task.OwnerID; |
404 | |||
405 | // Anyone can move | ||
422 | if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0) | 406 | if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0) |
423 | permission = true; | 407 | permission = true; |
408 | |||
409 | // Locked | ||
410 | if ((task.RootPart.OwnerMask & PERM_LOCKED) != 0) | ||
411 | permission = false; | ||
412 | |||
424 | } | 413 | } |
425 | return permission; | 414 | return permission; |
426 | } | 415 | } |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index ca3b858..7421957 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -768,6 +768,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
768 | { | 768 | { |
769 | group.GrabMovement(offset, pos, remoteClient); | 769 | group.GrabMovement(offset, pos, remoteClient); |
770 | } | 770 | } |
771 | group.SendGroupTerseUpdate(); | ||
771 | } | 772 | } |
772 | } | 773 | } |
773 | 774 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 3cef65c..2917056 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
60 | /// since the group's last persistent backup | 60 | /// since the group's last persistent backup |
61 | /// </summary> | 61 | /// </summary> |
62 | public bool HasGroupChanged = false; | 62 | public bool HasGroupChanged = false; |
63 | private bool m_locked = false; | 63 | |
64 | 64 | ||
65 | private LLVector3 lastPhysGroupPos; | 65 | private LLVector3 lastPhysGroupPos; |
66 | private LLQuaternion lastPhysGroupRot; | 66 | private LLQuaternion lastPhysGroupRot; |
@@ -1225,15 +1225,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1225 | Children.Values.CopyTo(partArray, 0); | 1225 | Children.Values.CopyTo(partArray, 0); |
1226 | return partArray; | 1226 | return partArray; |
1227 | } | 1227 | } |
1228 | public bool GetLocked() | 1228 | |
1229 | { | ||
1230 | return m_locked; | ||
1231 | } | ||
1232 | public void SetLocked(bool val) | ||
1233 | { | ||
1234 | m_locked = val; | ||
1235 | |||
1236 | } | ||
1237 | /// <summary> | 1229 | /// <summary> |
1238 | /// | 1230 | /// |
1239 | /// </summary> | 1231 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8c25dfa..06c0472 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1620,13 +1620,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1620 | { | 1620 | { |
1621 | if (addRemTF == (byte)0) | 1621 | if (addRemTF == (byte)0) |
1622 | { | 1622 | { |
1623 | m_parentGroup.SetLocked(true); | 1623 | //m_parentGroup.SetLocked(true); |
1624 | //OwnerMask &= ~mask; | 1624 | //PermissionMask. |
1625 | OwnerMask &= ~mask; | ||
1625 | } | 1626 | } |
1626 | else | 1627 | else |
1627 | { | 1628 | { |
1628 | m_parentGroup.SetLocked(false); | 1629 | //m_parentGroup.SetLocked(false); |
1629 | //OwnerMask |= mask; | 1630 | OwnerMask |= mask; |
1630 | } | 1631 | } |
1631 | SendFullUpdateToAllClients(); | 1632 | SendFullUpdateToAllClients(); |
1632 | 1633 | ||