From 82690e138448ebac6456ab03dcca4b0a8a1cc57a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 24 Nov 2012 02:43:31 +0000
Subject: Fix bug where loading an OAR with a deeded parcel would always set
 the parcel owner ID to the estate owner even if the group UUID was present.

Aims to address http://opensimulator.org/mantis/view.php?id=6355
As part of this work, an incomplete IXGroupsData was added which currently only allows store/fetch/delete of group records
(i.e. no membership data etc)
This is subject to change and currently only an in-memory storage implementation exists for regression test purposes.
---
 .../XmlRpcGroups/IGroupsServicesConnector.cs       |  15 +++
 .../XmlRpcGroupsServicesConnectorModule.cs         | 127 ++++++++++-----------
 2 files changed, 76 insertions(+), 66 deletions(-)

(limited to 'OpenSim/Region/OptionalModules')

diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index 6d26075..6b5b40a 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -36,7 +36,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
     {
         UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
         void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
+
+        /// <summary>
+        /// Get the group record.
+        /// </summary>
+        /// <returns></returns>
+        /// <param name='RequestingAgentID'>The UUID of the user making the request.</param>
+        /// <param name='GroupID'>
+        /// The ID of the record to retrieve.  
+        /// GroupName may be specified instead, in which case this parameter will be UUID.Zero
+        /// </param>
+        /// <param name='GroupName'>
+        /// The name of the group to retrieve.
+        /// GroupID may be specified instead, in which case this parmeter will be null.
+        /// </param>
         GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName);
+       
         List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search);
         List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID);
 
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index d0c3ea5..1101851 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -54,13 +54,62 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
 
         private bool m_debugEnabled = false;
 
-        public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome |
-            GroupPowers.Accountable |
-            GroupPowers.JoinChat |
-            GroupPowers.AllowVoiceChat |
-            GroupPowers.ReceiveNotices |
-            GroupPowers.StartProposal |
-            GroupPowers.VoteOnProposal;
+        public const GroupPowers DefaultEveryonePowers 
+            = GroupPowers.AllowSetHome 
+                | GroupPowers.Accountable 
+                | GroupPowers.JoinChat 
+                | GroupPowers.AllowVoiceChat 
+                | GroupPowers.ReceiveNotices 
+                | GroupPowers.StartProposal 
+                | GroupPowers.VoteOnProposal;
+
+        // Would this be cleaner as (GroupPowers)ulong.MaxValue?
+        public const GroupPowers DefaultOwnerPowers 
+            = GroupPowers.Accountable
+                | GroupPowers.AllowEditLand
+                | GroupPowers.AllowFly
+                | GroupPowers.AllowLandmark
+                | GroupPowers.AllowRez
+                | GroupPowers.AllowSetHome
+                | GroupPowers.AllowVoiceChat
+                | GroupPowers.AssignMember
+                | GroupPowers.AssignMemberLimited
+                | GroupPowers.ChangeActions
+                | GroupPowers.ChangeIdentity
+                | GroupPowers.ChangeMedia
+                | GroupPowers.ChangeOptions
+                | GroupPowers.CreateRole
+                | GroupPowers.DeedObject
+                | GroupPowers.DeleteRole
+                | GroupPowers.Eject
+                | GroupPowers.FindPlaces
+                | GroupPowers.Invite
+                | GroupPowers.JoinChat
+                | GroupPowers.LandChangeIdentity
+                | GroupPowers.LandDeed
+                | GroupPowers.LandDivideJoin
+                | GroupPowers.LandEdit
+                | GroupPowers.LandEjectAndFreeze
+                | GroupPowers.LandGardening
+                | GroupPowers.LandManageAllowed
+                | GroupPowers.LandManageBanned
+                | GroupPowers.LandManagePasses
+                | GroupPowers.LandOptions
+                | GroupPowers.LandRelease
+                | GroupPowers.LandSetSale
+                | GroupPowers.ModerateChat
+                | GroupPowers.ObjectManipulate
+                | GroupPowers.ObjectSetForSale
+                | GroupPowers.ReceiveNotices
+                | GroupPowers.RemoveMember
+                | GroupPowers.ReturnGroupOwned
+                | GroupPowers.ReturnGroupSet
+                | GroupPowers.ReturnNonGroup
+                | GroupPowers.RoleProperties
+                | GroupPowers.SendNotices
+                | GroupPowers.SetLandingPoint
+                | GroupPowers.StartProposal
+                | GroupPowers.VoteOnProposal;
 
         private bool m_connectorEnabled = false;
 
@@ -219,59 +268,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             param["AllowPublish"] = allowPublish == true ? 1 : 0;
             param["MaturePublish"] = maturePublish == true ? 1 : 0;
             param["FounderID"] = founderID.ToString();
-            param["EveryonePowers"] = ((ulong)m_DefaultEveryonePowers).ToString();
+            param["EveryonePowers"] = ((ulong)DefaultEveryonePowers).ToString();
             param["OwnerRoleID"] = OwnerRoleID.ToString();
-
-            // Would this be cleaner as (GroupPowers)ulong.MaxValue;
-            GroupPowers OwnerPowers = GroupPowers.Accountable
-                                    | GroupPowers.AllowEditLand
-                                    | GroupPowers.AllowFly
-                                    | GroupPowers.AllowLandmark
-                                    | GroupPowers.AllowRez
-                                    | GroupPowers.AllowSetHome
-                                    | GroupPowers.AllowVoiceChat
-                                    | GroupPowers.AssignMember
-                                    | GroupPowers.AssignMemberLimited
-                                    | GroupPowers.ChangeActions
-                                    | GroupPowers.ChangeIdentity
-                                    | GroupPowers.ChangeMedia
-                                    | GroupPowers.ChangeOptions
-                                    | GroupPowers.CreateRole
-                                    | GroupPowers.DeedObject
-                                    | GroupPowers.DeleteRole
-                                    | GroupPowers.Eject
-                                    | GroupPowers.FindPlaces
-                                    | GroupPowers.Invite
-                                    | GroupPowers.JoinChat
-                                    | GroupPowers.LandChangeIdentity
-                                    | GroupPowers.LandDeed
-                                    | GroupPowers.LandDivideJoin
-                                    | GroupPowers.LandEdit
-                                    | GroupPowers.LandEjectAndFreeze
-                                    | GroupPowers.LandGardening
-                                    | GroupPowers.LandManageAllowed
-                                    | GroupPowers.LandManageBanned
-                                    | GroupPowers.LandManagePasses
-                                    | GroupPowers.LandOptions
-                                    | GroupPowers.LandRelease
-                                    | GroupPowers.LandSetSale
-                                    | GroupPowers.ModerateChat
-                                    | GroupPowers.ObjectManipulate
-                                    | GroupPowers.ObjectSetForSale
-                                    | GroupPowers.ReceiveNotices
-                                    | GroupPowers.RemoveMember
-                                    | GroupPowers.ReturnGroupOwned
-                                    | GroupPowers.ReturnGroupSet
-                                    | GroupPowers.ReturnNonGroup
-                                    | GroupPowers.RoleProperties
-                                    | GroupPowers.SendNotices
-                                    | GroupPowers.SetLandingPoint
-                                    | GroupPowers.StartProposal
-                                    | GroupPowers.VoteOnProposal;
-            param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
-
-
-
+            param["OwnersPowers"] = ((ulong)DefaultOwnerPowers).ToString();
 
             Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param);
 
@@ -612,8 +611,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             }
 
             return Roles;
-
-
         }
 
         public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
@@ -676,7 +673,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             }
 
             return members;
-
         }
 
         public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
@@ -727,9 +723,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
                     values.Add(data);
                 }
             }
-            return values;
 
+            return values;
         }
+
         public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
         {
             Hashtable param = new Hashtable();
@@ -737,7 +734,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
 
             Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param);
 
-
             if (respData.Contains("error"))
             {
                 return null;
@@ -761,6 +757,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
 
             return data;
         }
+
         public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
         {
             string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
@@ -777,8 +774,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
             XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
         }
 
-
-
         #endregion
 
         #region GroupSessionTracking
-- 
cgit v1.1