diff options
author | UbitUmarov | 2017-05-03 21:12:16 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-03 21:12:16 +0100 |
commit | d62aed7f468d50a3b1f9ee678be9ba66d77a9218 (patch) | |
tree | 77d0c937e568d1ab21c82b813b07127337918814 /OpenSim | |
parent | fix right to change permissions of group owned taskitems (diff) | |
download | opensim-SC-d62aed7f468d50a3b1f9ee678be9ba66d77a9218.zip opensim-SC-d62aed7f468d50a3b1f9ee678be9ba66d77a9218.tar.gz opensim-SC-d62aed7f468d50a3b1f9ee678be9ba66d77a9218.tar.bz2 opensim-SC-d62aed7f468d50a3b1f9ee678be9ba66d77a9218.tar.xz |
fix right to change permissions of group owned objects
Diffstat (limited to 'OpenSim')
3 files changed, 57 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 4c4a8a5..45c1c56 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -293,6 +293,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
293 | scenePermissions.OnDeleteObject += CanDeleteObject; | 293 | scenePermissions.OnDeleteObject += CanDeleteObject; |
294 | scenePermissions.OnEditObjectByIDs += CanEditObjectByIDs; | 294 | scenePermissions.OnEditObjectByIDs += CanEditObjectByIDs; |
295 | scenePermissions.OnEditObject += CanEditObject; | 295 | scenePermissions.OnEditObject += CanEditObject; |
296 | scenePermissions.OnEditObjectPerms += CanEditObjectPerms; | ||
296 | scenePermissions.OnInventoryTransfer += CanInventoryTransfer; | 297 | scenePermissions.OnInventoryTransfer += CanInventoryTransfer; |
297 | scenePermissions.OnMoveObject += CanMoveObject; | 298 | scenePermissions.OnMoveObject += CanMoveObject; |
298 | scenePermissions.OnTakeObject += CanTakeObject; | 299 | scenePermissions.OnTakeObject += CanTakeObject; |
@@ -391,6 +392,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
391 | scenePermissions.OnDeleteObject -= CanDeleteObject; | 392 | scenePermissions.OnDeleteObject -= CanDeleteObject; |
392 | scenePermissions.OnEditObjectByIDs -= CanEditObjectByIDs; | 393 | scenePermissions.OnEditObjectByIDs -= CanEditObjectByIDs; |
393 | scenePermissions.OnEditObject -= CanEditObject; | 394 | scenePermissions.OnEditObject -= CanEditObject; |
395 | scenePermissions.OnEditObjectPerms -= CanEditObjectPerms; | ||
394 | scenePermissions.OnInventoryTransfer -= CanInventoryTransfer; | 396 | scenePermissions.OnInventoryTransfer -= CanInventoryTransfer; |
395 | scenePermissions.OnMoveObject -= CanMoveObject; | 397 | scenePermissions.OnMoveObject -= CanMoveObject; |
396 | scenePermissions.OnTakeObject -= CanTakeObject; | 398 | scenePermissions.OnTakeObject -= CanTakeObject; |
@@ -1387,6 +1389,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1387 | return true; | 1389 | return true; |
1388 | } | 1390 | } |
1389 | 1391 | ||
1392 | private bool CanEditObjectPerms(SceneObjectGroup sog, UUID userID) | ||
1393 | { | ||
1394 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
1395 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
1396 | |||
1397 | if (sog == null) | ||
1398 | return false; | ||
1399 | |||
1400 | if(sog.OwnerID == userID || IsAdministrator(userID)) | ||
1401 | return true; | ||
1402 | |||
1403 | UUID sogGroupID = sog.GroupID; | ||
1404 | if(sogGroupID == UUID.Zero || sogGroupID != sog.OwnerID) | ||
1405 | return false; | ||
1406 | |||
1407 | uint perms = sog.EffectiveOwnerPerms; | ||
1408 | if((perms & (uint)PermissionMask.Modify) == 0) | ||
1409 | return false; | ||
1410 | |||
1411 | ulong powers = 0; | ||
1412 | if(GroupMemberPowers(sogGroupID, userID, ref powers)) | ||
1413 | { | ||
1414 | if((powers & (ulong)GroupPowers.ObjectManipulate) != 0) | ||
1415 | return true; | ||
1416 | } | ||
1417 | |||
1418 | return false; | ||
1419 | } | ||
1420 | |||
1390 | private bool CanEditObjectInventory(UUID objectID, UUID userID) | 1421 | private bool CanEditObjectInventory(UUID objectID, UUID userID) |
1391 | { | 1422 | { |
1392 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1423 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
@@ -2306,7 +2337,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
2306 | ulong powers = 0; | 2337 | ulong powers = 0; |
2307 | if(GroupMemberPowers(sogGroupID, userID, ref powers)) | 2338 | if(GroupMemberPowers(sogGroupID, userID, ref powers)) |
2308 | { | 2339 | { |
2309 | if(powers == (ulong)GroupPowers.ObjectManipulate) | 2340 | if((powers & (ulong)GroupPowers.ObjectManipulate) != 0) |
2310 | return true; | 2341 | return true; |
2311 | 2342 | ||
2312 | if((ti.EveryonePermissions & (uint)PermissionMask.Copy) != 0) | 2343 | if((ti.EveryonePermissions & (uint)PermissionMask.Copy) != 0) |
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/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 | { |