diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index b557186..a972ca6 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -145,7 +145,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
145 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 145 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
146 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 146 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
147 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 147 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
148 | private IFriendsModule m_friendsModule = null; | 148 | private IFriendsModule m_friendsModule; |
149 | private IGroupsModule m_groupsModule; | ||
149 | 150 | ||
150 | #endregion | 151 | #endregion |
151 | 152 | ||
@@ -370,9 +371,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
370 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | 371 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); |
371 | 372 | ||
372 | if (m_friendsModule == null) | 373 | if (m_friendsModule == null) |
373 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | 374 | m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work"); |
374 | else | 375 | |
375 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); | 376 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); |
377 | |||
378 | if (m_groupsModule == null) | ||
379 | m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); | ||
376 | } | 380 | } |
377 | 381 | ||
378 | public void Close() | 382 | public void Close() |
@@ -407,14 +411,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
407 | // with the powers requested (powers = 0 for no powers check) | 411 | // with the powers requested (powers = 0 for no powers check) |
408 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) | 412 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) |
409 | { | 413 | { |
410 | ScenePresence sp = m_scene.GetScenePresence(userID); | 414 | if (null == m_groupsModule) |
411 | if (sp != null) | 415 | return false; |
412 | { | ||
413 | IClientAPI client = sp.ControllingClient; | ||
414 | 416 | ||
415 | return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && | 417 | GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); |
416 | ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); | 418 | |
419 | if (gmd != null) | ||
420 | { | ||
421 | if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers) | ||
422 | return true; | ||
417 | } | 423 | } |
424 | |||
418 | return false; | 425 | return false; |
419 | } | 426 | } |
420 | 427 | ||
@@ -705,8 +712,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
705 | permission = false; | 712 | permission = false; |
706 | } | 713 | } |
707 | 714 | ||
715 | // m_log.DebugFormat( | ||
716 | // "[PERMISSIONS]: group.GroupID = {0}, part.GroupMask = {1}, isGroupMember = {2} for {3}", | ||
717 | // group.GroupID, | ||
718 | // m_scene.GetSceneObjectPart(objId).GroupMask, | ||
719 | // IsGroupMember(group.GroupID, currentUser, 0), | ||
720 | // currentUser); | ||
721 | |||
708 | // Group members should be able to edit group objects | 722 | // Group members should be able to edit group objects |
709 | if ((group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0)) | 723 | if ((group.GroupID != UUID.Zero) |
724 | && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) | ||
725 | && IsGroupMember(group.GroupID, currentUser, 0)) | ||
710 | { | 726 | { |
711 | // Return immediately, so that the administrator can shares group objects | 727 | // Return immediately, so that the administrator can shares group objects |
712 | return true; | 728 | return true; |
@@ -941,7 +957,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
941 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 957 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
942 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 958 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
943 | 959 | ||
944 | |||
945 | return GenericObjectPermission(editorID, objectID, false); | 960 | return GenericObjectPermission(editorID, objectID, false); |
946 | } | 961 | } |
947 | 962 | ||
@@ -1048,7 +1063,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1048 | 1063 | ||
1049 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) | 1064 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) |
1050 | return false; | 1065 | return false; |
1051 | } else { | 1066 | } |
1067 | else | ||
1068 | { | ||
1052 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 1069 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) |
1053 | return false; | 1070 | return false; |
1054 | } | 1071 | } |
@@ -1064,7 +1081,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1064 | return false; | 1081 | return false; |
1065 | 1082 | ||
1066 | if (!IsGroupMember(ti.GroupID, user, 0)) | 1083 | if (!IsGroupMember(ti.GroupID, user, 0)) |
1067 | return false; | 1084 | return false; |
1068 | } | 1085 | } |
1069 | 1086 | ||
1070 | // Require full perms | 1087 | // Require full perms |
@@ -1468,14 +1485,16 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1468 | if (part.OwnerID != user) | 1485 | if (part.OwnerID != user) |
1469 | { | 1486 | { |
1470 | if (part.GroupID == UUID.Zero) | 1487 | if (part.GroupID == UUID.Zero) |
1471 | return false; | 1488 | return false; |
1472 | 1489 | ||
1473 | if (!IsGroupMember(part.GroupID, user, 0)) | 1490 | if (!IsGroupMember(part.GroupID, user, 0)) |
1474 | return false; | 1491 | return false; |
1475 | 1492 | ||
1476 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) | 1493 | if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) |
1477 | return false; | 1494 | return false; |
1478 | } else { | 1495 | } |
1496 | else | ||
1497 | { | ||
1479 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) | 1498 | if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) |
1480 | return false; | 1499 | return false; |
1481 | } | 1500 | } |
@@ -1791,7 +1810,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1791 | // Is it correct to be less restrictive for lists of objects to be returned? | 1810 | // Is it correct to be less restrictive for lists of objects to be returned? |
1792 | } | 1811 | } |
1793 | 1812 | ||
1794 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { | 1813 | private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) |
1814 | { | ||
1795 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); | 1815 | //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); |
1796 | switch (scriptType) { | 1816 | switch (scriptType) { |
1797 | case 0: | 1817 | case 0: |
@@ -1825,4 +1845,4 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1825 | return(false); | 1845 | return(false); |
1826 | } | 1846 | } |
1827 | } | 1847 | } |
1828 | } | 1848 | } \ No newline at end of file |