aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups/Service/GroupsService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Addons/Groups/Service/GroupsService.cs')
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs40
1 files changed, 27 insertions, 13 deletions
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index 0668870..037ef59 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -130,6 +130,13 @@ namespace OpenSim.Groups
130 { 130 {
131 reason = string.Empty; 131 reason = string.Empty;
132 132
133 // Check if the group already exists
134 if (m_Database.RetrieveGroup(name) != null)
135 {
136 reason = "A group with that name already exists";
137 return UUID.Zero;
138 }
139
133 // Create the group 140 // Create the group
134 GroupData data = new GroupData(); 141 GroupData data = new GroupData();
135 data.GroupID = UUID.Random(); 142 data.GroupID = UUID.Random();
@@ -248,13 +255,20 @@ namespace OpenSim.Groups
248 return members; 255 return members;
249 List<RoleData> rolesList = new List<RoleData>(roles); 256 List<RoleData> rolesList = new List<RoleData>(roles);
250 257
251 // Is the requester a member of the group? 258 // Check visibility?
252 bool isInGroup = false; 259 // When we don't want to check visibility, we pass it "all" as the requestingAgentID
253 if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null) 260 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
254 isInGroup = true;
255 261
256 if (!isInGroup) // reduce the roles to the visible ones 262 if (checkVisibility)
257 rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0); 263 {
264 // Is the requester a member of the group?
265 bool isInGroup = false;
266 if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
267 isInGroup = true;
268
269 if (!isInGroup) // reduce the roles to the visible ones
270 rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0);
271 }
258 272
259 MembershipData[] datas = m_Database.RetrieveMembers(GroupID); 273 MembershipData[] datas = m_Database.RetrieveMembers(GroupID);
260 if (datas == null || (datas != null && datas.Length == 0)) 274 if (datas == null || (datas != null && datas.Length == 0))
@@ -723,12 +737,12 @@ namespace OpenSim.Groups
723 737
724 #region Actions without permission checks 738 #region Actions without permission checks
725 739
726 private void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) 740 protected void _AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
727 { 741 {
728 _AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty); 742 _AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, string.Empty);
729 } 743 }
730 744
731 public void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) 745 protected void _RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
732 { 746 {
733 // 1. Delete membership 747 // 1. Delete membership
734 m_Database.DeleteMember(GroupID, AgentID); 748 m_Database.DeleteMember(GroupID, AgentID);
@@ -780,7 +794,7 @@ namespace OpenSim.Groups
780 794
781 } 795 }
782 796
783 private bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add) 797 protected bool _AddOrUpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, bool add)
784 { 798 {
785 RoleData data = m_Database.RetrieveRole(groupID, roleID); 799 RoleData data = m_Database.RetrieveRole(groupID, roleID);
786 800
@@ -810,12 +824,12 @@ namespace OpenSim.Groups
810 return m_Database.StoreRole(data); 824 return m_Database.StoreRole(data);
811 } 825 }
812 826
813 private void _RemoveGroupRole(UUID groupID, UUID roleID) 827 protected void _RemoveGroupRole(UUID groupID, UUID roleID)
814 { 828 {
815 m_Database.DeleteRole(groupID, roleID); 829 m_Database.DeleteRole(groupID, roleID);
816 } 830 }
817 831
818 private void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) 832 protected void _AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
819 { 833 {
820 RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID); 834 RoleMembershipData data = m_Database.RetrieveRoleMember(GroupID, RoleID, AgentID);
821 if (data != null) 835 if (data != null)
@@ -840,7 +854,7 @@ namespace OpenSim.Groups
840 854
841 } 855 }
842 856
843 private List<GroupRolesData> _GetGroupRoles(UUID groupID) 857 protected List<GroupRolesData> _GetGroupRoles(UUID groupID)
844 { 858 {
845 List<GroupRolesData> roles = new List<GroupRolesData>(); 859 List<GroupRolesData> roles = new List<GroupRolesData>();
846 860
@@ -865,7 +879,7 @@ namespace OpenSim.Groups
865 return roles; 879 return roles;
866 } 880 }
867 881
868 private List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup) 882 protected List<ExtendedGroupRoleMembersData> _GetGroupRoleMembers(UUID GroupID, bool isInGroup)
869 { 883 {
870 List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>(); 884 List<ExtendedGroupRoleMembersData> rmembers = new List<ExtendedGroupRoleMembersData>();
871 885