aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-04-05 20:42:20 +0100
committerJustin Clark-Casey (justincc)2010-04-05 20:44:19 +0100
commit48d2e8309a4b16843687a37b5458d00535e139d8 (patch)
treed814ee80669da6cfa7c95677110e240cd0b5090f
parentlog exceptions that end up at the top of a asynchronous viewer packet method ... (diff)
downloadopensim-SC_OLD-48d2e8309a4b16843687a37b5458d00535e139d8.zip
opensim-SC_OLD-48d2e8309a4b16843687a37b5458d00535e139d8.tar.gz
opensim-SC_OLD-48d2e8309a4b16843687a37b5458d00535e139d8.tar.bz2
opensim-SC_OLD-48d2e8309a4b16843687a37b5458d00535e139d8.tar.xz
check group membership and powers with the groups module rather than just the client's active group id
this resolves the earlier issue where notecards/scripts shared with group could only be edited if the user had that group active
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs39
1 files changed, 27 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 0f830e1..d940564 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -162,7 +162,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
162 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); 162 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
163 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); 163 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
164 private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); 164 private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
165 private IFriendsModule m_friendsModule = null; 165 private IFriendsModule m_friendsModule;
166 private IGroupsModule m_groupsModule;
166 167
167 #endregion 168 #endregion
168 169
@@ -386,9 +387,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
386 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 387 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
387 388
388 if (m_friendsModule == null) 389 if (m_friendsModule == null)
389 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); 390 m_log.Warn("[PERMISSIONS]: Friends module not found, friend permissions will not work");
390 else 391
391 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); 392 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
393
394 if (m_groupsModule == null)
395 m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
392 } 396 }
393 397
394 public void Close() 398 public void Close()
@@ -423,14 +427,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
423 // with the powers requested (powers = 0 for no powers check) 427 // with the powers requested (powers = 0 for no powers check)
424 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) 428 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
425 { 429 {
426 ScenePresence sp = m_scene.GetScenePresence(userID); 430 if (null == m_groupsModule)
427 if (sp != null) 431 return false;
428 { 432
429 IClientAPI client = sp.ControllingClient; 433 GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID);
430 434
431 return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && 435 if (gmd != null)
432 ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); 436 {
437 if (((gmd.GroupPowers != 0) && powers == 0) || (gmd.GroupPowers & powers) == powers)
438 return true;
433 } 439 }
440
434 return false; 441 return false;
435 } 442 }
436 443
@@ -721,8 +728,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions
721 permission = false; 728 permission = false;
722 } 729 }
723 730
731// m_log.DebugFormat(
732// "[PERMISSIONS]: group.GroupID = {0}, part.GroupMask = {1}, isGroupMember = {2} for {3}",
733// group.GroupID,
734// m_scene.GetSceneObjectPart(objId).GroupMask,
735// IsGroupMember(group.GroupID, currentUser, 0),
736// currentUser);
737
724 // Group members should be able to edit group objects 738 // Group members should be able to edit group objects
725 if ((group.GroupID != UUID.Zero) && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0) && IsGroupMember(group.GroupID, currentUser, 0)) 739 if ((group.GroupID != UUID.Zero)
740 && ((m_scene.GetSceneObjectPart(objId).GroupMask & (uint)PermissionMask.Modify) != 0)
741 && IsGroupMember(group.GroupID, currentUser, 0))
726 { 742 {
727 // Return immediately, so that the administrator can shares group objects 743 // Return immediately, so that the administrator can shares group objects
728 return true; 744 return true;
@@ -957,7 +973,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
957 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 973 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
958 if (m_bypassPermissions) return m_bypassPermissionsValue; 974 if (m_bypassPermissions) return m_bypassPermissionsValue;
959 975
960
961 return GenericObjectPermission(editorID, objectID, false); 976 return GenericObjectPermission(editorID, objectID, false);
962 } 977 }
963 978