aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Addons/Groups
diff options
context:
space:
mode:
authorDiva Canto2014-09-21 09:22:32 -0700
committerDiva Canto2014-09-21 09:22:32 -0700
commit94619cba58a6783efd61acae56599332d7c111ba (patch)
tree9d2a0cc3aaee432853455dc814e5063bd71704ef /OpenSim/Addons/Groups
parentThis fixes the Scene thread renaming issue (diff)
downloadopensim-SC_OLD-94619cba58a6783efd61acae56599332d7c111ba.zip
opensim-SC_OLD-94619cba58a6783efd61acae56599332d7c111ba.tar.gz
opensim-SC_OLD-94619cba58a6783efd61acae56599332d7c111ba.tar.bz2
opensim-SC_OLD-94619cba58a6783efd61acae56599332d7c111ba.tar.xz
Fixed a hard-to-run-into bug in groups: at the time of creation of a group, the OwnerRoleID in the groups table was inconsistent with the roleID in the roles table. OpenSim core was not running into this bug, but 3rd party modules (like Wifi) were.
Diffstat (limited to 'OpenSim/Addons/Groups')
-rw-r--r--OpenSim/Addons/Groups/Service/GroupsService.cs28
1 files changed, 18 insertions, 10 deletions
diff --git a/OpenSim/Addons/Groups/Service/GroupsService.cs b/OpenSim/Addons/Groups/Service/GroupsService.cs
index f44c094..7cbc796 100644
--- a/OpenSim/Addons/Groups/Service/GroupsService.cs
+++ b/OpenSim/Addons/Groups/Service/GroupsService.cs
@@ -150,7 +150,8 @@ namespace OpenSim.Groups
150 data.Data["ShowInList"] = showInList ? "1" : "0"; 150 data.Data["ShowInList"] = showInList ? "1" : "0";
151 data.Data["AllowPublish"] = allowPublish ? "1" : "0"; 151 data.Data["AllowPublish"] = allowPublish ? "1" : "0";
152 data.Data["MaturePublish"] = maturePublish ? "1" : "0"; 152 data.Data["MaturePublish"] = maturePublish ? "1" : "0";
153 data.Data["OwnerRoleID"] = UUID.Random().ToString(); 153 UUID roleID = UUID.Random();
154 data.Data["OwnerRoleID"] = roleID.ToString();
154 155
155 if (!m_Database.StoreGroup(data)) 156 if (!m_Database.StoreGroup(data))
156 return UUID.Zero; 157 return UUID.Zero;
@@ -159,7 +160,6 @@ namespace OpenSim.Groups
159 _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group", "Member of " + name, (ulong)DefaultEveryonePowers, true); 160 _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, UUID.Zero, "Everyone", "Everyone in the group", "Member of " + name, (ulong)DefaultEveryonePowers, true);
160 161
161 // Create Owner role 162 // Create Owner role
162 UUID roleID = UUID.Random();
163 _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, roleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true); 163 _AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, roleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
164 164
165 // Add founder to group 165 // Add founder to group
@@ -247,6 +247,9 @@ namespace OpenSim.Groups
247 if (group == null) 247 if (group == null)
248 return members; 248 return members;
249 249
250 // Unfortunately this doesn't quite work on legacy group data because of a bug
251 // that's also being fixed here on CreateGroup. The OwnerRoleID sent to the DB was wrong.
252 // See how to find the ownerRoleID a few lines below.
250 UUID ownerRoleID = new UUID(group.Data["OwnerRoleID"]); 253 UUID ownerRoleID = new UUID(group.Data["OwnerRoleID"]);
251 254
252 RoleData[] roles = m_Database.RetrieveRoles(GroupID); 255 RoleData[] roles = m_Database.RetrieveRoles(GroupID);
@@ -255,6 +258,11 @@ namespace OpenSim.Groups
255 return members; 258 return members;
256 List<RoleData> rolesList = new List<RoleData>(roles); 259 List<RoleData> rolesList = new List<RoleData>(roles);
257 260
261 // Let's find the "real" ownerRoleID
262 RoleData ownerRole = rolesList.Find(r => r.Data["Powers"] == ((long)OwnerPowers).ToString());
263 if (ownerRole != null)
264 ownerRoleID = ownerRole.RoleID;
265
258 // Check visibility? 266 // Check visibility?
259 // When we don't want to check visibility, we pass it "all" as the requestingAgentID 267 // When we don't want to check visibility, we pass it "all" as the requestingAgentID
260 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString()); 268 bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
@@ -291,17 +299,17 @@ namespace OpenSim.Groups
291 { 299 {
292 m.Title = selected.Data["Title"]; 300 m.Title = selected.Data["Title"];
293 m.AgentPowers = UInt64.Parse(selected.Data["Powers"]); 301 m.AgentPowers = UInt64.Parse(selected.Data["Powers"]);
302 }
294 303
295 m.AgentID = d.PrincipalID; 304 m.AgentID = d.PrincipalID;
296 m.AcceptNotices = d.Data["AcceptNotices"] == "1" ? true : false; 305 m.AcceptNotices = d.Data["AcceptNotices"] == "1" ? true : false;
297 m.Contribution = Int32.Parse(d.Data["Contribution"]); 306 m.Contribution = Int32.Parse(d.Data["Contribution"]);
298 m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false; 307 m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
299 308
300 // Is this person an owner of the group? 309 // Is this person an owner of the group?
301 m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false; 310 m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
302 311
303 members.Add(m); 312 members.Add(m);
304 }
305 } 313 }
306 314
307 return members; 315 return members;