aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-02 20:25:47 +0000
committerTeravus Ovares2008-01-02 20:25:47 +0000
commita72d33d3a5da5bb48e9c95fd355458be335fee3e (patch)
tree968f98add2cb0e846d98c8f00826d4c22cbe59f9 /OpenSim
parentFixed buffer overrun bug in ZeroDecodeCommand (diff)
downloadopensim-SC_OLD-a72d33d3a5da5bb48e9c95fd355458be335fee3e.zip
opensim-SC_OLD-a72d33d3a5da5bb48e9c95fd355458be335fee3e.tar.gz
opensim-SC_OLD-a72d33d3a5da5bb48e9c95fd355458be335fee3e.tar.bz2
opensim-SC_OLD-a72d33d3a5da5bb48e9c95fd355458be335fee3e.tar.xz
* Added the ability for Region Owners to add and remove estate managers using the estate tools.
* Estate managers get abilities like the region owner for now. * Estate managers, you'll need to request server admin status to be able to activate the estate tools dialog (haven't figured out why this is the case yet) * Switching from grid mode to standalone or switching grids will make the stored Estate Manager UUIDs not match up with a valid account so you'll see (waiting) listed there instead of a user until you reset them or go back to the grid you added them from.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/EstateSettings.cs61
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs106
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
3 files changed, 142 insertions, 29 deletions
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index 1078c10..9e4b9a4 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -646,8 +646,8 @@ namespace OpenSim.Framework
646 for (int i = 0; i < numEstateManagers; i++) 646 for (int i = 0; i < numEstateManagers; i++)
647 { 647 {
648 pos = GetNextEstateManager(pos); 648 pos = GetNextEstateManager(pos);
649 649
650 rEstateManagers[i] = GetEstateManagerAtPos(pos); 650 rEstateManagers[i] = GetEstateManagerAtPos(pos); pos++;
651 651
652 } 652 }
653 return rEstateManagers; 653 return rEstateManagers;
@@ -683,8 +683,63 @@ namespace OpenSim.Framework
683 return numEstateManagers; 683 return numEstateManagers;
684 } 684 }
685 685
686 public void AddEstateManager(LLUUID avatarID)
687 {
688 LLUUID[] testateManagers = GetEstateManagers();
689 LLUUID[] nestateManagers = new LLUUID[testateManagers.Length + 1];
690
691 int i = 0;
692 for (i = 0; i < testateManagers.Length; i++)
693 {
694 nestateManagers[i] = testateManagers[i];
695 }
696
697 nestateManagers[i] = avatarID;
698
699 //Saves it to the estate settings file
700 estateManagers = nestateManagers;
701
702 }
703 public void RemoveEstateManager(LLUUID avatarID)
704 {
705 int notfoundparam = 11; // starting high so the condense routine (max ten) doesn't run if we don't find it.
706 LLUUID[] testateManagers = GetEstateManagers(); // temporary estate managers list
707
708
709 int i = 0;
710 int foundpos = notfoundparam;
711
712 // search for estate manager.
713 for (i = 0; i < testateManagers.Length; i++)
714 {
715 if (testateManagers[i] == avatarID)
716 {
717 foundpos = i;
718 break;
719 }
720 }
721 if (foundpos < notfoundparam)
722 {
723 LLUUID[] restateManagers = new LLUUID[testateManagers.Length - 1];
724
725 // fill new estate managers array up to the found spot
726 for (int j = 0; j < foundpos; j++)
727 restateManagers[j] = testateManagers[j];
728
729 // skip over the estate manager we're removing and compress
730 for (int j = foundpos + 1; j < testateManagers.Length; j++)
731 restateManagers[j - 1] = testateManagers[j];
732
733 estateManagers = restateManagers;
734 }
735 else
736 {
737 OpenSim.Framework.Console.MainLog.Instance.Error("ESTATESETTINGS", "Unable to locate estate manager : " + avatarID.ToString() + " for removal");
738 }
739 }
740
686 #endregion 741 #endregion
687 742
688 private ConfigurationMember configMember; 743 private ConfigurationMember configMember;
689 744
690 public EstateSettings() 745 public EstateSettings()
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index d0dbaea..9fe11fc 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -155,8 +155,8 @@ namespace OpenSim.Region.Environment
155 switch (Helpers.FieldToUTF8String(packet.MethodData.Method)) 155 switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
156 { 156 {
157 case "getinfo": 157 case "getinfo":
158 158
159 159 //MainLog.Instance.Verbose("ESTATE","CLIENT--->" + packet.ToString());
160 sendRegionInfoPacketToAll(); 160 sendRegionInfoPacketToAll();
161 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId)) 161 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
162 { 162 {
@@ -198,6 +198,12 @@ namespace OpenSim.Region.Environment
198 EstateChangeCovenant(packet); 198 EstateChangeCovenant(packet);
199 } 199 }
200 break; 200 break;
201 case "estateaccessdelta":
202 if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
203 {
204 estateAccessDelta(remote_client, packet);
205 }
206 break;
201 default: 207 default:
202 MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString()); 208 MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
203 break; 209 break;
@@ -220,53 +226,105 @@ namespace OpenSim.Region.Environment
220 //Sending Estate Settings 226 //Sending Estate Settings
221 returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + m_scene.RegionInfo.MasterAvatarLastName); 227 returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + m_scene.RegionInfo.MasterAvatarLastName);
222 returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString()); 228 returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString());
223 returnblock[2].Parameter = Helpers.IntToBytes((int)m_scene.RegionInfo.EstateSettings.estateID); 229 returnblock[2].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString());
224 returnblock[3].Parameter = Helpers.IntToBytes(269516800); 230
225 returnblock[4].Parameter = Helpers.IntToBytes(0); 231 // TODO: Resolve Magic numbers here
226 returnblock[5].Parameter = Helpers.IntToBytes(1); 232 returnblock[3].Parameter = Helpers.StringToField("269516800");
227 returnblock[6].Parameter = Helpers.StringToField(LLUUID.Random().ToString()); 233 returnblock[4].Parameter = Helpers.StringToField("0");
228 returnblock[7].Parameter = Helpers.IntToBytes(1160895077); 234 returnblock[5].Parameter = Helpers.StringToField("1");
229 returnblock[8].Parameter = Helpers.IntToBytes(1); 235 returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString());
236 returnblock[7].Parameter = Helpers.StringToField("1160895077");
237 returnblock[8].Parameter = Helpers.StringToField("1");
238
230 packet.ParamList = returnblock; 239 packet.ParamList = returnblock;
240 //MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString());
231 remote_client.OutPacket(packet, ThrottleOutPacketType.Task); 241 remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
232 242
233 // Stuck here at the moment The client sends a bunch of getinfo methods that need to be decoded the hard way 243 sendEstateManagerList(remote_client, packet);
244
245 }
246
247 private void sendEstateManagerList(IClientAPI remote_client, EstateOwnerMessagePacket packet)
248 {
249 LLUUID invoice = packet.MethodData.Invoice;
250
234 //Sending Estate Managers 251 //Sending Estate Managers
235 packet = new EstateOwnerMessagePacket(); 252 packet = new EstateOwnerMessagePacket();
236 packet.AgentData.TransactionID = LLUUID.Random(); 253 packet.AgentData.TransactionID = LLUUID.Random();
237 packet.AgentData.AgentID=remote_client.AgentId; 254 packet.AgentData.AgentID = remote_client.AgentId;
238 packet.AgentData.SessionID=remote_client.SessionId; 255 packet.AgentData.SessionID = remote_client.SessionId;
239 packet.MethodData.Invoice = invoice; 256 packet.MethodData.Invoice = invoice;
240 packet.MethodData.Method = Helpers.StringToField("setaccess"); 257 packet.MethodData.Method = Helpers.StringToField("setaccess");
241 258
242 LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers; 259 LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers;
243 260
244 returnblock = new EstateOwnerMessagePacket.ParamListBlock[6+EstateManagers.Length]; 261 EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length];
245 262
246 for (int i = 0; i < (6 + EstateManagers.Length); i++) 263 for (int i = 0; i < (6 + EstateManagers.Length); i++)
247 { 264 {
248 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); 265 returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
249 } 266 }
250 int j=0; 267 int j = 0;
251 returnblock[j].Parameter = Helpers.IntToBytes((int)m_scene.RegionInfo.EstateSettings.estateID); j++; 268 returnblock[j].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); j++;
252 returnblock[j].Parameter = Helpers.IntToBytes((int)EstateAccessCodex.EstateManagers); j++; 269 returnblock[j].Parameter = Helpers.StringToField(((int)EstateAccessCodex.EstateManagers).ToString()); j++;
253 returnblock[j].Parameter = Helpers.IntToBytes(0); j++; 270 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
254 returnblock[j].Parameter = Helpers.IntToBytes(0); j++; 271 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
255 returnblock[j].Parameter = Helpers.IntToBytes(0); j++; 272 returnblock[j].Parameter = Helpers.StringToField("0"); j++;
256 returnblock[j].Parameter = Helpers.IntToBytes(EstateManagers.Length); j++; 273 returnblock[j].Parameter = Helpers.StringToField(EstateManagers.Length.ToString()); j++;
257 for (int i = 0; i < EstateManagers.Length; i++) 274 for (int i = 0; i < EstateManagers.Length; i++)
258 { 275 {
259 returnblock[j].Parameter = Helpers.StringToField(EstateManagers[i].ToString()); j++; 276 returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++;
260 } 277 }
261 packet.ParamList = returnblock; 278 packet.ParamList = returnblock;
279 //MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString());
262 remote_client.OutPacket(packet, ThrottleOutPacketType.Task); 280 remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
281 }
282
283 private void estateAccessDelta(IClientAPI remote_client, EstateOwnerMessagePacket packet)
284 {
285 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
286 int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
263 287
288 switch (estateAccessType)
289 {
290 case 256:
291
292 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
293 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
294 if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
295 {
296 m_scene.RegionInfo.EstateSettings.AddEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)));
297 sendEstateManagerList(remote_client, packet);
298 }
299 else
300 {
301 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
302 }
303
304 break;
305 case 512:
306 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
307 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
308 if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
309 {
310 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)));
311 sendEstateManagerList(remote_client, packet);
312 }
313 else
314 {
315 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
316 }
317 break;
264 318
319 default:
265 320
321 MainLog.Instance.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString());
322 break;
323 }
324 //MainLog.Instance.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString());
266 325
267 326
268 } 327 }
269
270 private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet) 328 private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet)
271 { 329 {
272 if (packet.ParamList.Length != 9) 330 if (packet.ParamList.Length != 9)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index ba99640..09b58e0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1790,7 +1790,7 @@ namespace OpenSim.Region.Environment.Scenes
1790 IClientAPI controllingClient) 1790 IClientAPI controllingClient)
1791 { 1791 {
1792 // First check that this is the sim owner 1792 // First check that this is the sim owner
1793 if (agentID == RegionInfo.MasterAvatarAssignedUUID) 1793 if (m_permissionManager.GenericEstatePermission(agentID))
1794 { 1794 {
1795 // User needs to be logged into this sim 1795 // User needs to be logged into this sim
1796 if (m_scenePresences.ContainsKey(agentID)) 1796 if (m_scenePresences.ContainsKey(agentID))
@@ -1826,7 +1826,7 @@ namespace OpenSim.Region.Environment.Scenes
1826 LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb"); 1826 LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb");
1827 if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID) 1827 if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID)
1828 { 1828 {
1829 if (godID == RegionInfo.MasterAvatarAssignedUUID) 1829 if (m_permissionManager.GenericEstatePermission(godID))
1830 { 1830 {
1831 if (agentID == kickUserID) 1831 if (agentID == kickUserID)
1832 { 1832 {